From patchwork Tue Jul 9 11:08:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Glembotzki X-Patchwork-Id: 1958330 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=Niy8nO+l; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=AutCThx1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::138; helo=mail-lf1-x138.google.com; envelope-from=swupdate+bncbdy5juxlviebbs5xws2amgqeg6yj6dq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lf1-x138.google.com (mail-lf1-x138.google.com [IPv6:2a00:1450:4864:20::138]) (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 4WJJLl6WCQz1xpd for ; Tue, 9 Jul 2024 21:15:27 +1000 (AEST) Received: by mail-lf1-x138.google.com with SMTP id 2adb3069b0e04-52ea249d1c9sf4787470e87.0 for ; Tue, 09 Jul 2024 04:15:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720523724; cv=pass; d=google.com; s=arc-20160816; b=kuYfVCzeSwnlQGTIe0MW6FF0cuOgeStwSfzLfMONfeyjkT/6rv0xivZXtvl3B/9/Ir tmIcmxtx4kdnkh82jGIAOcWmAjlREb3eO3r0o6HnEOCIo9Jm2rz2gd0fef7QvPHLZTyR QmaCq5ZCK+FHuuQQTIGw0xFtm1LM9kgjxRkpzAPdzdqqm70ojGPDN3c1XKeZg37ZqX4W hkgZSZ6jqOJ22DVBispqDpQ6Gxnp+1e5Mhs2Fh26EISyZg7WLMxfzSY301KjoDn1Yx2p ntsThuIv9LlEZzJWhxYq6Fkn7PH5bR5MiRIXMYg1Q24g0Viv/pVtfEx93YqFS7NpKZZp ly+g== 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=ukIxYUHxICyjgB5CCYwUJ345pypzhJ/q6b/ab9qw+tA=; fh=LzjOCPMUgrxhWbgOv05qMPACS8k1Xd2EXslCy64finA=; b=W4/mcJxUS/oB8AG2bUbEJ1AZXQ+6eyeuzWGDchGwR3afzBq+A9pLOGe/9tKKlj7Cr+ Vq4SHnncRjVq5DFhvYmQC3zBmhmDUg1A5xrDWXH1d/gyVAllyJNmrZrOQYWchHJF96W3 SMzSZOPQQEiJ7p8r4Kl0JCf80plN+sYuS8Powkld3g5JB55zrAM5lZG7qaG4VND/5r7F wmlN1w+dzdJuL8S+teNt0QT2Dv95b+AUMqvnX/Lds7GK3evUEKs9zh2epZrBwZj3tP7s 74w+vb2NBGd2mkr2seX8CrD+DlUyY6HqnXIaFTWS5pDYaGMtT95hR9dM2KZkx8sb35ql cgFw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VBW79JXB; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52c 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=1720523724; x=1721128524; 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=ukIxYUHxICyjgB5CCYwUJ345pypzhJ/q6b/ab9qw+tA=; b=Niy8nO+leY0oXrcyhRZwRlYcJjJrf1b8xE9g09+YqxulxIP17A+DbV2MAcxmgFBltE b8ioYSl/Vax+sms/fT3lDiAfehv9fuHxCb4GLJ3U9O8nF/EzQjmUyfGgt5VSbxeW9MtC Ca7i76TTScL64BCoOW0645BEq0ZC0LslFv2Yb4Urm/pDRupKpUnrPYHWA0XGl9AfBeLi aEYc1yevY2COO4nUoOY9wY7KgAJf+mXALmImrm26cEN5ORBFXkWAEseWgswBqRrAJbE6 kz4UZRUwqrnFcBArZtQ3iwBpFsI0+eOoWSRopfL/Qx1xtOXEIsHLPxWs2KGbkoVwW9K6 Wyyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720523724; x=1721128524; 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=ukIxYUHxICyjgB5CCYwUJ345pypzhJ/q6b/ab9qw+tA=; b=AutCThx1Lr/LlIGlduJ5poYIhraolPlIfFBUi3FXmDtqbs7gES5fxrT9bFRKI1O/ED 9dS+B00HVpmY1CHDrnTv8WsVmJWDYXym7oyVxByI3//CBk0OD8fQ8WamuPxARCzhLoos z0FHInekSPANtKurjSjUJvBIu0s6nM1Y0lPryRS5ODTcBZ0NqQS6EOH7aGR6MGHaDIwF aXQNvHFJOWKvD2LrL9yosXhVDdFfcfaZW5z7YvescTqHRwAYUT9g0KMNSUSG6iWuM2yk GTuC2nd84PFW0vAAdTRnNCyA6NxT0RsdtjUGktpoVzea3nixiWArfRjlYYEZ6ajIXMb+ Yigg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720523724; x=1721128524; 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=ukIxYUHxICyjgB5CCYwUJ345pypzhJ/q6b/ab9qw+tA=; b=Xgb4PxtyPZPlU9JwTx9S/74Ou+XFTcGh9D9cFDSSL+AdOl4hvvEOsxMlCWP2y+lgJx H6cs2/Sfd25WlzYoJ/62XbtUGFLe7H28KKiNn0eQf02gCRxHlwFbm6hcTfRK9ftFtnbE ITtRiunu1PlSb8SMrwQ6GvQ+NYD5W/fK+S7AFp8AEFNJxbRNHwFs3llAAbFjorwzqwUx FX8pGulBTAMTz2t3qB4Ua6qGKE/AOVnSOb7lB78Smnw3MZ7E4GM13gWjE99ILJttu/MJ yduZFDb16Oo664kY7JQgJKo4/nflOdcab2bU1BP33EJ9O8L6ONY+JvKv+FoS7qGYwMPK VIIA== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXBFQtLVkFabkLu+YU+HMeDRenKu057MoIbgiYg+vXLKZ3DlqFLwGw4k4/KI97AfscLJujN6e4x+ekkRJa1fp94p88X1kGTkAqXXPyn3g== X-Gm-Message-State: AOJu0YzQV0+tOi+5y3TAXU6GS4CixFY+E4FvGLjQ1/Gmwkc+pfOUXwcT PGLj3WUPIcv8RzAvnfQktyDmzq7dCG21ZUgggPHhd9uDBYHKTUW5 X-Google-Smtp-Source: AGHT+IFiOTfvUXO7/hvK3HkATIqVksmow+r97z3Kype+GQvn8XBnTacRIXHfloLGelSaGjvYlO8aAQ== X-Received: by 2002:a05:6512:2107:b0:52e:9d6c:4462 with SMTP id 2adb3069b0e04-52eb99978d9mr950299e87.23.1720523723999; Tue, 09 Jul 2024 04:15:23 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:1d2e:b0:57d:555d:8ddd with SMTP id 4fb4d7f45d1cf-58e20383d0dls2532225a12.0.-pod-prod-02-eu; Tue, 09 Jul 2024 04:15:21 -0700 (PDT) X-Received: by 2002:a05:6402:4301:b0:57a:4c22:bd with SMTP id 4fb4d7f45d1cf-594baa8bb40mr1635289a12.7.1720523721302; Tue, 09 Jul 2024 04:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720523721; cv=none; d=google.com; s=arc-20160816; b=OCjlCN9TXMQwRRSzjzj/qxJ8MqAhEm/eoI7T3dP+2Wn8mbOfPRg0XiPdLF6olqa/MK AnAC7q6czA7+jFjQWc+yDt1D5kPHH+Itji+pUJMxeYq/MxIjMKk6gruahaeCkRfegFJK 2gA9K5sHyJzZ2CN7kHQOXhMd1Xa9ViU9v3DlcC7KBTa9LZyk32FLNKENpWAqbElAW4GT aDlj2IasUBVy7EShdyZqdnSIwwdbKJphJVjVrEjeP2cMfyj6ypuxJMsXUpe/VxqBaK4u u36ooZGkAJTgzi2WBFH8A94tqTy6ZEx5Mv1QR8Gg8UtoWmcJRcAXgT/zYRfpGGFuft1f b4LQ== 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=aieVwIgNnta8TmyAYlly0urlo3PD1OUE006yjaOh56krd0KnHIuIikSKwLs3CEpq+B c4WTVXGt9yghWlsBORoLxJTP8Aiq3Y12SHV7swOvB8Bwbn+wJwlWmaD/0O1GhEH/xgGZ WG4CRKYLP9mu5FmWfrCsHGG7kI0skNHGdy5ZYNyT/AMJj90OJ5+2Obaj429VaSuq91vL f2JEjJ0IXajdXRLBopm8K3/Y735B6vcQ/J6FZ1GLBydJvvG+BCEeyHQYsOpgaHWGiqKU SY2gO0iuZversAB2z8+FqdS/qdMaND5eOBZlBR7ogHKuOjrznM0oLx3AGrwIANrV6xVF 6iNw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VBW79JXB; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52c 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-x52c.google.com (mail-ed1-x52c.google.com. [2a00:1450:4864:20::52c]) by gmr-mx.google.com with ESMTPS id 4fb4d7f45d1cf-594bcaaea74si43465a12.1.2024.07.09.04.15.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Jul 2024 04:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52c as permitted sender) client-ip=2a00:1450:4864:20::52c; Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-59589a9be92so365462a12.2 for ; Tue, 09 Jul 2024 04:15:21 -0700 (PDT) X-Received: by 2002:a17:906:390e:b0:a77:ddce:e9b1 with SMTP id a640c23a62f3a-a780b89d430mr134559266b.75.1720523720509; Tue, 09 Jul 2024 04:15:20 -0700 (PDT) Received: from PC-2635.irisgmbh.local (dslb-002-203-138-100.002.203.pools.vodafone-ip.de. [2.203.138.100]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6bc8adsm70739166b.14.2024.07.09.04.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 04:15:19 -0700 (PDT) From: Michael Glembotzki To: swupdate@googlegroups.com Cc: Michael Glembotzki Subject: [swupdate] [V3][PATCH 11/21] mongoose: Replace deprecated struct mg_str::ptr with struct mg_str::buf Date: Tue, 9 Jul 2024 13:08:47 +0200 Message-ID: <20240709111440.8215-12-Michael.Glembotzki@iris-sensing.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240709111440.8215-1-Michael.Glembotzki@iris-sensing.com> References: <20240709111440.8215-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=VBW79JXB; spf=pass (google.com: domain of m.glembo@gmail.com designates 2a00:1450:4864:20::52c 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';