From patchwork Wed Jun 12 14:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Glembotzki X-Patchwork-Id: 1946972 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=fS7UMXMS; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=C8AC5dV5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33a; helo=mail-wm1-x33a.google.com; envelope-from=swupdate+bncbdy5juxlviebbyhgu2zqmgqerkyhxpq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-wm1-x33a.google.com (mail-wm1-x33a.google.com [IPv6:2a00:1450:4864:20::33a]) (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 4Vzp9w4kTBz23tB for ; Thu, 13 Jun 2024 00:40:36 +1000 (AEST) Received: by mail-wm1-x33a.google.com with SMTP id 5b1f17b1804b1-4217b3d2044sf20254665e9.0 for ; Wed, 12 Jun 2024 07:40:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718203234; cv=pass; d=google.com; s=arc-20160816; b=j0koIYoPs7eE/PYsW3/qzbktvXNqGQE+zf4QqdAeJ2IeKDqmQ6yc4gsSNPyx2j5Et8 Sphf7GgpeJn1IK44vOlnt8RbS1dF9l3n2YnRzXJgv4mUrByVzUwiDGU6PGNLP2Z7p063 Z9nP2GeyJq/Jcr4cer0moAlMsdNhVGvqvUew2twPen/qUNjc9dMyXOxod/FulAZnvFRx ajwKRNdIaEtffgu7xTDg0z3qbjy7yr33pVMCB/27oXuKdFJq0VWIgisPMIY+MVVArZyQ hSQBhk0mZveDoIMfk3eyPTYJzk3VTHiLyCDMhdevLcLISIjxZC6D/Retd4ASqfqPGhB9 w+Qg== 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=xfHmIUrr1W/TF3rp1Sa1EUuVY4eVD2VKkKEPogEMSXs=; fh=FTZTh2PixRxdoLW7Xs7V3R2NzT9JAPUAf4kCJCke1w4=; b=Pp1LgTlgfi6380Z0dn08apbwRTuA1+OtD2MOZz7Qogo/ewsQQz/L2AuiUqqAC/kEXE Mcyx4A0imfnyW408lJKpXajxrs+EN9SaMIRQxGQEgGSXr4WT3fAj9KrK7Wymdt1mbmxC Coc76KcIw4Yt4gPplbsXSylzOFddgokUsdsy7oaa6WupgaAglNUo36DfuOPCdnXEjD8T 3Pxzh/H4mYLWY4dFZ/mCFKF35gbDvYxBkmYJuOAiQK94Sr7yw4D/ARWdSOl7/sJXaBNZ gY/PkJAMaPdjvjm+AWR/FZelKqOgNrPQ/bHeN10P8PaHAKKsahGgGblRbpWdMb520LeR Z0ZA==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0FmpjeO; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::530 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=1718203234; x=1718808034; 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=xfHmIUrr1W/TF3rp1Sa1EUuVY4eVD2VKkKEPogEMSXs=; b=fS7UMXMSSqBprozqRf+DewxvPoZ9yyB9E3JXzeXKETDtXIqqIFSA+PZ3ok4ywtA0KY UJ9nrYdwzhya2Plk3lvH2sf7KgwvqWZVnPngBoBZ3C7KLKV03gFMfBDeTq/MzL/8STF4 JTu4j8F/LToPOe32KxCQqeboVuPuWZfueGcAihvOkEc1xo2FNWT4SM5O+DJTKGUE3yC7 cf83i5+ZCKIb2SxJPTuIFFrrVoPz7/pFK0ZurLMGsAAkEJx7stS0tqrn2hMAelR0JYtS 4JMEETMRGYxMSjHSlm5/QMiXscJn/sLDDdCO1ywfH1YmZdbqKRSjqOe9CBJ/CysLFXed zZEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718203234; x=1718808034; 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=xfHmIUrr1W/TF3rp1Sa1EUuVY4eVD2VKkKEPogEMSXs=; b=C8AC5dV5iaIY+eGCRwILKiBB8b6ixwKJgHqSrCld7vJlGtnueT9ZYTXlCeJhLt08pS X01suf8kp4C6fvPvo4w/BLDvyZs3VuukJ7BTXhB08W/slIBaILuSpVrtnPCYyIXK7qsP oeEFtfX1ri61e3mY8gmyX7DyiohngrsOv+mOK0DFoxrmRQsKXAjWykhtVevHkARGlgFB M+Ww1DbWuWgPvIICtytkusiaDd+ihmCv5t2ltv9IHvKHkA1RiQRhcjXKCaYMVFlU60ji XFSxGV30wrrxomYVTZltywwvqCqEfCjp9trWsdh2Ybd+rg7FXmDSLO/2pF5QvG4hW6Sr ssJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718203234; x=1718808034; 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=xfHmIUrr1W/TF3rp1Sa1EUuVY4eVD2VKkKEPogEMSXs=; b=hsT8mf7CXreR55nOguCHC8kUaaT1bKxxy7ujFTj3U5SFa7DX16R1uadBr4t/8hzQ9w Z8OqZujgOunP+Zy01TE+dT23wiE6k94jGvJ3KBuVMFcoyPU6ylb8OrV+gAjRGqsq5Xti mM5GC2J9UifAKxFm4S7iVrJ6RY72RtvVs4gvdLbcJZ0m2x/C9VmUGObUWUKtafGazfEc HnPSPz3nj+S71hfRN77mFR8n8Ty0V61jxUV4igTD3gin0jb4tDvAYRPbAs3kehQ3WAt5 B+hjIv1JcdydSk21d2UmBR3Hlw8N/+RMvlXiKlaViUriLeMBY5zxlWgvozdfxJK34sU8 vIzQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWioK6B/2IuphE2oYim6dWuPlMBZahBmfLPS10Qoc3kFpLY/tD15DhhlqfehH7hgJKIynZk8jY23r5zuf15gE2XfzcinNei/SCRP69LSA== X-Gm-Message-State: AOJu0Ywf/HAD8HCd3n7CFEm6gWqHgUJqMPLgJfXXh23BWkxCOYN61Iq6 hsEQvB4e8NMXMWIao3jbOirHtbZHo/GBf5UM6/MsH0wrvo0M8/PO X-Google-Smtp-Source: AGHT+IHbUK05rph7ekNqobuGFIPbAxiYKARQbUBYaMrKKwT7JbA9XfksLtnFjiSVDrT+/qPTN4WD8Q== X-Received: by 2002:a05:600c:4687:b0:422:7eca:db62 with SMTP id 5b1f17b1804b1-422861afa55mr20398985e9.4.1718203233325; Wed, 12 Jun 2024 07:40:33 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:1ca0:b0:422:27b5:8477 with SMTP id 5b1f17b1804b1-4223596f2bcls11271515e9.2.-pod-prod-07-eu; Wed, 12 Jun 2024 07:40:30 -0700 (PDT) X-Received: by 2002:a05:600c:3ca2:b0:422:5443:96aa with SMTP id 5b1f17b1804b1-422862acbe6mr17789765e9.15.1718203230455; Wed, 12 Jun 2024 07:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718203230; cv=none; d=google.com; s=arc-20160816; b=viZJWrCQHfyZ0CIaD5IBGT6HeehWroLPgFz4bZJ/Jthdsv7VkPEVZD5Hp6nKGA0/8M Q0RB467KYzs8/ZJKLvHlpWkPDVlWBKaCDjfCBT1SU5GdncZ8Ls2Et6IpPgT3pPob9xsR 3ydkQbETC9cXVi1mbvNctCWetsMNcQTG4SbrRYSlKyLM4EpoNOCdEcKGyeLdUI6n7QT7 NZC6tYib5ovoQkj8GyOXmxWi1f3QPguXQbzg6JMOQim0Krg42+6LZJoFPkFkR3aMot9E 5cqZHja3oUcD1HFbMktgV3ebPBrFrZVF6S6sUoBjdZYKxX46up5NxVgCdanDPhTMk2hE 9c6Q== 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=pgcJeiKs7wkI5/DHZn6/z+WO3Pe25HGaJ9+Yb4v+uH4=; fh=zydHuzCQWrku2OPQyZfraJZFcOpEXLQ/YBcu3QNiBd0=; b=makvh/rRXZLBEwCYfZnCb4WtFy7MCAx9RfpsW2Kw+OwisnXwHyVswD1MrpzFT3zY7Z 6QzXJttpYR+p+Sn92o1Z0SDukhlTU5n7seW2+2+FFTSXXw9dQfleXqqJ3Rl/eguxjcYk L7Mu4maSLCPLn9DK+rS373rDJLwC2QM8z58kR868Mz//4pcUnpbzqh92STJ+aJms4C7L nOpLnJIOPOC1bBx8oD3azTrOflEGfxGhJc7e/F1keq5U9uL1+OhpWIRZYkEXV60n2OzB QoVrGitNY8nl8r0dX1V5WRnMjTABaqcMfJTmRBjlGQVttQPTamHgIE6hqT/BmxG+8F3z cV5A==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0FmpjeO; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::530 as permitted sender) smtp.mailfrom=m.glembo@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com. [2a00:1450:4864:20::530]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-42284d0f239si444345e9.0.2024.06.12.07.40.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jun 2024 07:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::530 as permitted sender) client-ip=2a00:1450:4864:20::530; Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-57c714a1e24so2761395a12.2 for ; Wed, 12 Jun 2024 07:40:30 -0700 (PDT) X-Received: by 2002:a17:907:86a9:b0:a6f:256c:8163 with SMTP id a640c23a62f3a-a6f47b4eefdmr135012066b.0.1718203229468; Wed, 12 Jun 2024 07:40:29 -0700 (PDT) Received: from localhost.localdomain ([2a02:8108:96c0:76fc::b071]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f16b27ac7sm481179166b.54.2024.06.12.07.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 07:40:29 -0700 (PDT) From: Michael Glembotzki To: swupdate@googlegroups.com Cc: Michael Glembotzki Subject: [swupdate] [PATCH 12/23] mongoose: Replace deprecated struct mg_str::ptr with struct mg_str::buf Date: Wed, 12 Jun 2024 16:36:10 +0200 Message-ID: <20240612144010.470339-13-Michael.Glembotzki@iris-sensing.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240612144010.470339-1-Michael.Glembotzki@iris-sensing.com> References: <20240612144010.470339-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=k0FmpjeO; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::530 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 463dd073..019eae6c 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); } @@ -216,7 +216,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); } @@ -240,7 +240,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; } } @@ -272,7 +272,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); } @@ -589,7 +589,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) { @@ -624,7 +624,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';