From patchwork Thu Jun 23 11:43:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5698 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LTJLY3hFcz3wcT for ; Thu, 23 Jun 2022 11:44:05 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LTJLX2ptfzq4; Thu, 23 Jun 2022 11:44:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LTJLX1jsyz2yCy; Thu, 23 Jun 2022 11:44:04 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LTJLW1BY6z2xNB for ; Thu, 23 Jun 2022 11:44:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4LTJLV5v6Yz7n; Thu, 23 Jun 2022 11:44:02 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1655984642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kAIclt8pA7ES9e9DSYjEYxZ9fW7moCXfwu5mGVbQKV4=; b=yRL7vKiImSauAO4j0rmorvJ00c3fXjmoQVraA9xu3vNIZJUBBF6GQJbL2bEe7Y7Nr2kS9x P7GTezDWaIpHfnAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1655984642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kAIclt8pA7ES9e9DSYjEYxZ9fW7moCXfwu5mGVbQKV4=; b=jCzlf1zXAbRgTFFoUVBmWpBFJYM3hjmITeOgc6WkAeEzwofspg0cddN7sVBe4Qx0kNN0Mt aqoHXCP+u7YgGD32XODq5GGegPbNtR3P7hveEdovuCj+94iHWpcoZ2DzlbHoxtu7LfhxIV pWewy/q6jM3oJSzJkmngygzxMVg2wZN5yGlQ98vhqomWMBvL42K9b99BCXSiZ3aFG+M9A0 /9C9tnA3ySpz/6NtKNoSZDmhoX6uXImz0bZ1+DjulkCaY8jPOnkltaRG9hjp/qi/qhTyQA 9lAPyPx4swOeMR1WQgxUEN+MBn0vCjg4DDMY//JyuhGXNlCgAKmPXw0xKOmzBQ== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] misc-progs: Fix passing argument list Date: Thu, 23 Jun 2022 11:43:56 +0000 Message-Id: <20220623114356.2394544-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" The run() function expects all arguments without the basename of the program. This regression was introduced in a609195a26f2666a177b988a6691bc27b10e6d64. Fixes: #12886 Signed-off-by: Michael Tremer Acked-by: Peter Müller --- src/misc-progs/backupctrl.c | 2 +- src/misc-progs/extrahdctrl.c | 2 +- src/misc-progs/getipstat.c | 2 +- src/misc-progs/mpfirectrl.c | 2 +- src/misc-progs/pakfire.c | 2 +- src/misc-progs/sambactrl.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/misc-progs/backupctrl.c b/src/misc-progs/backupctrl.c index 0a85141ca..bb2ca69ef 100644 --- a/src/misc-progs/backupctrl.c +++ b/src/misc-progs/backupctrl.c @@ -11,5 +11,5 @@ int main(int argc, char** argv) { if (!initsetuid()) exit(1); - return run("/var/ipfire/backup/bin/backup.pl", argv); + return run("/var/ipfire/backup/bin/backup.pl", argv + 1); } diff --git a/src/misc-progs/extrahdctrl.c b/src/misc-progs/extrahdctrl.c index 49a25387f..255050acd 100644 --- a/src/misc-progs/extrahdctrl.c +++ b/src/misc-progs/extrahdctrl.c @@ -11,5 +11,5 @@ int main(int argc, char** argv) { if (!initsetuid()) exit(1); - return run("/var/ipfire/extrahd/bin/extrahd.pl", argv); + return run("/var/ipfire/extrahd/bin/extrahd.pl", argv + 1); } diff --git a/src/misc-progs/getipstat.c b/src/misc-progs/getipstat.c index 37e01c81a..66d5b5a92 100644 --- a/src/misc-progs/getipstat.c +++ b/src/misc-progs/getipstat.c @@ -27,7 +27,7 @@ int main(int argc, char** argv) // but /sbin/iptables is actually a symlink to /sbin/xtables-legacy-multi hence that program is executed // however without the notion that it was called as "iptables". So we have to pass "iptables" as first // argument. - char *args[10] = {"iptables", "--list", "--verbose", "--numeric", "--wait", "5", NULL, NULL, NULL, NULL}; + char *args[] = {"--list", "--verbose", "--numeric", "--wait", "5", NULL, NULL, NULL, NULL}; char *usage = "getipstat [-x][-f|-n|-m]"; unsigned int pcount = 6; unsigned int table_set = 0; diff --git a/src/misc-progs/mpfirectrl.c b/src/misc-progs/mpfirectrl.c index a71789c0f..4ea1fb543 100644 --- a/src/misc-progs/mpfirectrl.c +++ b/src/misc-progs/mpfirectrl.c @@ -11,5 +11,5 @@ int main(int argc, char** argv) { if (!initsetuid()) exit(1); - return run("/var/ipfire/mpfire/bin/mpfire.pl", argv); + return run("/var/ipfire/mpfire/bin/mpfire.pl", argv + 1); } diff --git a/src/misc-progs/pakfire.c b/src/misc-progs/pakfire.c index 93a18e604..35bea8677 100644 --- a/src/misc-progs/pakfire.c +++ b/src/misc-progs/pakfire.c @@ -11,5 +11,5 @@ int main(int argc, char** argv) { if (!initsetuid()) exit(1); - return run("/opt/pakfire/pakfire", argv); + return run("/opt/pakfire/pakfire", argv + 1); } diff --git a/src/misc-progs/sambactrl.c b/src/misc-progs/sambactrl.c index 501535799..38c26089c 100644 --- a/src/misc-progs/sambactrl.c +++ b/src/misc-progs/sambactrl.c @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba User' -m -g sambauser -s /bin/false %s >/dev/null", argv[2]); safe_system(command); - run("/usr/sbin/samba-change-password", argv + 1); + run("/usr/sbin/samba-change-password", argv + 2); } else if (strcmp(argv[1], "smbchangepw") == 0) { if (!is_valid_argument_alnum(argv[2])) { @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { exit(2); } - run("/usr/sbin/samba-change-password", argv + 1); + run("/usr/sbin/samba-change-password", argv + 2); } else if (strcmp(argv[1], "readsmbpasswd") == 0) { safe_system("/bin/chown root:nobody /var/ipfire/samba/private >/dev/null");