1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

cmdline:burn: handle arguments separated from their --options

We weren't treating "--password secret" the same as "--password=secret",
which sometimes led to secrets not being redacted.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15674

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
This commit is contained in:
Douglas Bagnall 2024-06-27 15:40:16 +12:00 committed by Douglas Bagnall
parent 2f6020cf3d
commit 53a1184525
2 changed files with 26 additions and 2 deletions

View File

@ -180,7 +180,32 @@ bool samba_cmdline_burn(int argc, char *argv[])
char *q = NULL;
if (strlen(p) == ulen) {
continue;
/*
* The option string has no '=', so
* its argument will come in the NEXT
* argv member. If there is one, we
* can just step forward and take it,
* setting ulen to 0.
*
* {"--password=secret"} --> {"--password"}
* {"--password", "secret"} --> {"--password", ""}
* {"-Uadmin%secret"} --> {"-Uadmin"}
* {"-U", "admin%secret"} --> {"-U", "admin"}
*/
i++;
if (i == argc) {
/*
* this looks like an invalid
* command line, but that's
* for the caller to decide.
*/
return burnt;
}
p = argv[i];
if (p == NULL) {
return false;
}
ulen = 0;
}
if (is_user) {

View File

@ -1 +0,0 @@
^samba.unittests.cmdline.torture_cmdline_burn.none.$