From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH] misc-progs: Fix passing argument list Date: Thu, 23 Jun 2022 13:20:47 +0000 Message-ID: In-Reply-To: <20220623114356.2394544-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2340351005950661498==" List-Id: --===============2340351005950661498== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Acked-by: Peter M=C3=BCller > The run() function expects all arguments without the basename of the > program. >=20 > This regression was introduced in a609195a26f2666a177b988a6691bc27b10e6d64. >=20 > Fixes: #12886 > Signed-off-by: Michael Tremer > --- > 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(-) >=20 > 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); > =20 > - 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); > =20 > - 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 hav= e to pass "iptables" as first > // argument. > - char *args[10] =3D {"iptables", "--list", "--verbose", "--numeric", "--wa= it", "5", NULL, NULL, NULL, NULL}; > + char *args[] =3D {"--list", "--verbose", "--numeric", "--wait", "5", NULL= , NULL, NULL, NULL}; > char *usage =3D "getipstat [-x][-f|-n|-m]"; > unsigned int pcount =3D 6; > unsigned int table_set =3D 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); > =20 > - 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); > =20 > - 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); > =20 > - run("/usr/sbin/samba-change-password", argv + 1); > + run("/usr/sbin/samba-change-password", argv + 2); > =20 > } else if (strcmp(argv[1], "smbchangepw") =3D=3D 0) { > if (!is_valid_argument_alnum(argv[2])) { > @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { > exit(2); > } > =20 > - run("/usr/sbin/samba-change-password", argv + 1); > + run("/usr/sbin/samba-change-password", argv + 2); > =20 > } else if (strcmp(argv[1], "readsmbpasswd") =3D=3D 0) { > safe_system("/bin/chown root:nobody /var/ipfire/samba/private >/dev/null= "); --===============2340351005950661498==--