From patchwork Sat Jun 15 19:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Glembotzki X-Patchwork-Id: 1948208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=ou6Glhjq; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=iumeR98U; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::237; helo=mail-lj1-x237.google.com; envelope-from=swupdate+bncbdy5juxlviebb6wsw6zqmgqebidzfzy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x237.google.com (mail-lj1-x237.google.com [IPv6:2a00:1450:4864:20::237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W1mFV6zTLz20ZB for ; Sun, 16 Jun 2024 05:20:30 +1000 (AEST) Received: by mail-lj1-x237.google.com with SMTP id 38308e7fff4ca-2ec1709d233sf12514651fa.3 for ; Sat, 15 Jun 2024 12:20:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718479228; cv=pass; d=google.com; s=arc-20160816; b=AQakTqBbAgDeTgKTIQOXhPVfZzahSyxoe1USxFw5GtW60+7gqYFd1+MlVItesZqtxP Lm092ROy3ulC3y6jm0Hp9ieyspCIllaPNNyabWvudwPtULBActMLYfiSREwI4EgLz3JM OPQGSMhl7a9HOwFm/n/dIu7pSZa/fjMJ9CVOhPHKgzenAd9+v+4VnVjQ4Ulw2FZ3oJwD TjGWUKKHbmqirk7NZOhvTeTlTiC0cP7ivOit86gqKb2LhGJOzt9a1cBpAYvlFG0xn2TR YmVTQwjMlt+8xBc2cCFicbm9FApXUPWts6pTu0s1jPec1AXazR+IXRFU/StZdnuAqQ8T TxvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature :dkim-signature; bh=l126ItX1TjL5FY2zoTPQkMPZ6SKbr4V2m6NCivN28dw=; fh=XIG8s2aAnBw/nuIb0b0/jdpHpH4pQ/kGJyfVzHwhHgw=; b=l19vOYi3IheDpamBqPogSLSIaGVMjjKdsq/neuqfko+Aexd7mprgUNzsShTzLaUI1Y J4J9ZTJOCwoXgmWmVgs2rXFOc18QmG1GPoqoptAGnqoqiK0s1TiHJ1xorsT/m5gKLMHT kmqGveicbLkkJb5YeWYF2CuwEzz4Mw98/V2wdlNqsfyOU3eOjrSG7esWbnGWfR/Gr/mA j9flr2OT/CdLmc7mk5IrdED4QaHHKzRUsfLsEUYIOMCSYAYCPHzdKte2yKMnlOuVzpP+ krLYEbKVgh1rCfNzq3xfX91xTN9u3uYlJz7rm/gRVyOYsGddPBtKaIhYH860gNbM71rZ qcSw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JuVfFErK; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::630 as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1718479228; x=1719084028; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=l126ItX1TjL5FY2zoTPQkMPZ6SKbr4V2m6NCivN28dw=; b=ou6GlhjqU3IKkNwlpDrqvh+pdHnqrbhagcCwSAJ4iaR2dIhJNhKVhf1W0LmCmbB49k Y06LhbndifajjHWsEjo/SDdLaIUkIdv++1B/JxxVGGMVf3njKVO3WY0bX5C0qr3PsOq7 71tePg3BP+8tCL5469BUNsL+YpprTmo91FeD09VH1Ef02MNOjZ4wPcJN0UsoCF6jXGel V0M3SLTuffyfddm5cRgYoukeq5fefMyqT6U/6go+y/tLFjQV26Huqfg88Pj4lUVNE2QU RtkLEDMOoF2NSoCT6U5ORnt4/vxdRun8T3aygA11q6un5gCTQS3+8mu80agIS7g//D7M Mgfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718479228; x=1719084028; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=l126ItX1TjL5FY2zoTPQkMPZ6SKbr4V2m6NCivN28dw=; b=iumeR98U3xPOgpb9OvxcfSWyINj/T3SBQ75lDji6uvEXdUHyWP28So4wdtKX2SQgDK C3vkVwKBSOqyLJJwNXS2cwEKGvEPROVRlulMdNX/ZwYiT5jL3bfHU+XyQ0rl7KUgMHi0 upjS1ss+2UqAQgUeR+S4nhNwmizqBcF1vFp83hX41VJH6g3IR6zHWLa4DJAIOUE3Fx/Y mRnNvikEJg1PPXHzmc0DloLyH03LaT1gBDIfbQgjYCu3Q8+ryOpR5SuC0+3kiJOWxOIH PdOl6zuCEymptYfmNIwB1drkGC5afdfHTgsXDfWed7Y/5V/kywXIEbcWwy8D2ysyd7+Z KP+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718479228; x=1719084028; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=l126ItX1TjL5FY2zoTPQkMPZ6SKbr4V2m6NCivN28dw=; b=A3gJTNQGWUjtKqFng6cqvFP07yNiYkfoBsXYfmQumb6J9Ig+OY9jWcydioBky2bzoJ qXrEc4FqWvyr34v9URnsJsmDRpsOyL72T2s0keGnIKYzOiiYVILs/OypYNSuA8xeXSGA tI48SgQPPqXjFVLiKZffQX9YtPext3bnwOZTXg6830ozuxXb4HBylY2R/M7t/3px22Bf 1tz+l+hvPCh0f8HTF4t9L5QOcvu9Yhx5fUHRZsBtj7uRKOz0wJAH9KuSWeJaqtPZNHF8 isVYhTJqXrfk74mHABbZo/qOdkpsFIudnqj7ErMdCGy2iPgbcrrueYejV2/cAtu6pnsU 5Jyg== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWpE6Tbax0Sse5Pw+OGxZHnLH/4oi+p0olUfaQ3qiRRD97yWU1jUurBD574Oxa0WjxNkn9Y7HaXw7zfZCxVsK18iWHQ8Cq+TNewWgolNA== X-Gm-Message-State: AOJu0Yxz3MNazFpyZOkC8DwrdKqYluJ87RHofX17Jt5tnSYTlfb/9+zx Z9/ewwv9wMuOlQwAA8Vvp/QA70+eRDbDZQpIy4hExZnU6MFooKl9 X-Google-Smtp-Source: AGHT+IGemgOTohqrUmCa2KslAhmAHKVtJYw6Tz+hyz4lRvUcCy9lLEbYlXUmyxSxwgjxduTyeDgaNw== X-Received: by 2002:a2e:6e17:0:b0:2ec:199:8b0e with SMTP id 38308e7fff4ca-2ec0e5b5edemr40389831fa.8.1718479226876; Sat, 15 Jun 2024 12:20:26 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:651c:103c:b0:2ea:ea7c:240d with SMTP id 38308e7fff4ca-2ec0292eb66ls15745911fa.1.-pod-prod-06-eu; Sat, 15 Jun 2024 12:20:24 -0700 (PDT) X-Received: by 2002:a2e:3619:0:b0:2ec:1dfc:45bf with SMTP id 38308e7fff4ca-2ec1dfc46e6mr17228051fa.42.1718479223838; Sat, 15 Jun 2024 12:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718479223; cv=none; d=google.com; s=arc-20160816; b=K1PAct0NB1yDS4cS5mFlqFMt7qIBrlCFZAnwMBVHVyARO+sEswAwc4H0adnlwl5jGK 05C/U01Vij4b5osdxoAnUYevnGnOWJuXihJHj7BKrbO3ruHrR/x4IxMMItd3PDINbaul 4vXgcDfp3rT+iqy1xlkh+l38pRQ2rQUrcJOyY0GSPG9+5n8VGvx8FX4+XKDVAzRWCgaE cmTN6A4F+mtdx+BN844amSAoFclWd7ibCrYoGYMzNlNwA+S82+k9u8xjG3JO7EqVCI4b AYWm5UgAjuoVz8z81oCCk+KoUgXgSQwEbsZjvkPI1InVa2eWM7rgRPmqgRRIGdKSY0pZ 87GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ccYwuPiN3c7I0a5+ZXVxtl9OOYdvruqvCLYDyGHh3fw=; fh=zydHuzCQWrku2OPQyZfraJZFcOpEXLQ/YBcu3QNiBd0=; b=STh896cKzLt8H/DMGUyDZHzukTIj3n/cn1UxEMX+8bRGuDVKOypc0GsiKl4hXdpuCk RI2w0M8NgkL4j0WhMTwcCcoVSdKJ4fjV9oJzrnJiLUqNEXZ8OCPxVPiZBBFQDOKTxlFC 5SJph7SwDoe4gsC/GTIq660wkmucTjOh/XWMdxy+PrUGpv9xDTN98cppU1AEp1xhcAyk 6OfYEw9LTaFLs8uqwGlAZvEodqq2Vn9/2qqfk+l3NP6N++3TBUNjevMapcSxPLfkSY9l 4x2P8pXUJNzN1tC47DPyRfOhsxE3s+Q9iQDD6VZJFAgdMWdE8dp5RJqLqk1xsdgVyvaN y44w==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JuVfFErK; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::630 as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com. [2a00:1450:4864:20::630]) by gmr-mx.google.com with ESMTPS id 38308e7fff4ca-2ec05cbb4desi960161fa.6.2024.06.15.12.20.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jun 2024 12:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::630 as permitted sender) client-ip=2a00:1450:4864:20::630; Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a6267778b3aso329363066b.3 for ; Sat, 15 Jun 2024 12:20:23 -0700 (PDT) X-Received: by 2002:a17:906:99d4:b0:a6f:64b0:1250 with SMTP id a640c23a62f3a-a6f64b01749mr347024466b.35.1718479222785; Sat, 15 Jun 2024 12:20:22 -0700 (PDT) Received: from PC-2635.irisgmbh.local ([2a02:8108:96c0:76fc::80bb]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56db61e0sm327283766b.49.2024.06.15.12.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 12:20:21 -0700 (PDT) From: Michael Glembotzki To: swupdate@googlegroups.com Cc: Michael Glembotzki Subject: [swupdate] [PATCH 11/21] mongoose: Replace deprecated struct mg_str::ptr with struct mg_str::buf Date: Sat, 15 Jun 2024 21:11:24 +0200 Message-ID: <20240615191941.40301-12-Michael.Glembotzki@iris-sensing.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240615191941.40301-1-Michael.Glembotzki@iris-sensing.com> References: <20240615191941.40301-1-Michael.Glembotzki@iris-sensing.com> MIME-Version: 1.0 X-Original-Sender: m.glembo@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JuVfFErK; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::630 as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , .. and fix removed constness. mongoose rev-id: b46bee0540c83c780ae9622ef18b9cc8a7b3ebab Signed-off-by: Michael Glembotzki --- mongoose/mongoose_interface.c | 16 ++++++++-------- mongoose/mongoose_multipart.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 66de0723..21b2bf9c 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -190,9 +190,9 @@ static void mg_mkmd5resp(struct mg_str method, struct mg_str uri, struct mg_str static const char colon[] = ":"; static const size_t one = 1; char ha2[33]; - cs_md5(ha2, method.ptr, method.len, colon, one, uri.ptr, uri.len, NULL); - cs_md5(resp, ha1.ptr, ha1.len, colon, one, nonce.ptr, nonce.len, colon, one, nc.ptr, - nc.len, colon, one, cnonce.ptr, cnonce.len, colon, one, qop.ptr, qop.len, + cs_md5(ha2, method.buf, method.len, colon, one, uri.buf, uri.len, NULL); + cs_md5(resp, ha1.buf, ha1.len, colon, one, nonce.buf, nonce.len, colon, one, nc.buf, + nc.len, colon, one, cnonce.buf, cnonce.len, colon, one, qop.buf, qop.len, colon, one, ha2, sizeof(ha2) - 1, NULL); } @@ -212,7 +212,7 @@ static double mg_time(void) static int mg_check_nonce(struct mg_str nonce) { unsigned long now = (unsigned long) mg_time(); - unsigned long val = (unsigned long) strtoul(nonce.ptr, NULL, 16); + unsigned long val = (unsigned long) strtoul(nonce.buf, NULL, 16); return (now >= val) && (now - val < 60 * 60); } @@ -236,7 +236,7 @@ static int mg_check_digest_auth(struct mg_str method, struct mg_str uri, mg_vcmp(&auth_domain, f_domain) == 0) { /* Username and domain matched, check the password */ mg_mkmd5resp(method, uri, mg_str_s(f_ha1), nonce, nc, cnonce, qop, exp_resp); - return mg_ncasecmp(response.ptr, exp_resp, strlen(exp_resp)) == 0; + return mg_ncasecmp(response.buf, exp_resp, strlen(exp_resp)) == 0; } } @@ -268,7 +268,7 @@ static int mg_http_check_digest_auth(struct mg_http_message *hm, struct mg_str a return mg_check_digest_auth( hm->method, mg_str_n( - hm->uri.ptr, + hm->uri.buf, hm->uri.len + (hm->query.len ? hm->query.len + 1 : 0)), username, cnonce, response, qop, nc, nonce, auth_domain, fp); } @@ -585,7 +585,7 @@ static void upload_handler(struct mg_connection *nc, int ev, void *ev_data) struct swupdate_request req; swupdate_prepare_req(&req); req.len = mp->len; - strncpy(req.info, mp->part.filename.ptr, sizeof(req.info) - 1); + strncpy(req.info, mp->part.filename.buf, sizeof(req.info) - 1); req.source = SOURCE_WEBSERVER; fus->fd = ipc_inst_start_ext(&req, sizeof(req)); if (fus->fd < 0) { @@ -620,7 +620,7 @@ static void upload_handler(struct mg_connection *nc, int ev, void *ev_data) if (!fus) break; - written = write(fus->fd, (char *) mp->part.body.ptr, mp->part.body.len); + written = write(fus->fd, (char *) mp->part.body.buf, mp->part.body.len); /* * IPC seems to block, wait for a while */ diff --git a/mongoose/mongoose_multipart.c b/mongoose/mongoose_multipart.c index 29ec8a0b..6db59aff 100644 --- a/mongoose/mongoose_multipart.c +++ b/mongoose/mongoose_multipart.c @@ -42,9 +42,9 @@ struct mg_http_multipart_stream { static void mg_http_free_proto_data_mp_stream( struct mg_http_multipart_stream *mp) { - free((void *) mp->boundary.ptr); - free((void *) mp->part.name.ptr); - free((void *) mp->part.filename.ptr); + free((void *) mp->boundary.buf); + free((void *) mp->part.name.buf); + free((void *) mp->part.filename.buf); memset(mp, 0, sizeof(*mp)); } @@ -76,7 +76,7 @@ static void mg_http_multipart_begin(struct mg_connection *c, } /* Content-type should start with "multipart" */ - if (ct->len < 9 || strncmp(ct->ptr, "multipart", 9) != 0) { + if (ct->len < 9 || strncmp(ct->buf, "multipart", 9) != 0) { return; } @@ -108,7 +108,7 @@ static void mg_http_multipart_begin(struct mg_connection *c, } mp_stream->state = MPS_BEGIN; mp_stream->boundary = mg_strdup(boundary); - mp_stream->part.name.ptr = mp_stream->part.filename.ptr = NULL; + mp_stream->part.name.buf = mp_stream->part.filename.buf = NULL; mp_stream->part.name.len = mp_stream->part.filename.len = 0; mp_stream->len = hm->body.len; c->pfn_data = mp_stream; @@ -128,7 +128,7 @@ static size_t mg_http_multipart_call_handler(struct mg_connection *c, int ev, mp.part.name = mp_stream->part.name; mp.part.filename = mp_stream->part.filename; mp.user_data = mp_stream->user_data; - mp.part.body.ptr = data; + mp.part.body.buf = (char*) data; mp.part.body.len = data_len; mp.num_data_consumed = data_len; mp.len = mp_stream->len; @@ -207,7 +207,7 @@ static int mg_http_multipart_process_boundary(struct mg_connection *c) { sizeof(CONTENT_DISPOSITION) - 1) == 0) { struct mg_str header; - header.ptr = block_begin + sizeof(CONTENT_DISPOSITION) - 1; + header.buf = (char*) (block_begin + sizeof(CONTENT_DISPOSITION) - 1); header.len = line_len - sizeof(CONTENT_DISPOSITION) - 1; mp_stream->part.name = mg_strdup(mg_http_get_header_var(header, mg_str_n("name", 4))); @@ -342,7 +342,7 @@ void multipart_upload_handler(struct mg_connection *c, int ev, void *ev_data) return; } s = mg_http_get_header(hm, "Content-Type"); - if (s != NULL && s->len >= 9 && strncmp(s->ptr, "multipart", 9) == 0) { + if (s != NULL && s->len >= 9 && strncmp(s->buf, "multipart", 9) == 0) { /* New request - new proto data */ c->data[0] = 'M';