From: Samuel Cabrero Date: Thu, 7 Sep 2023 12:51:15 +0000 (+0200) Subject: auth:credentials: Check if password_obtained > obtained X-Git-Tag: tevent-0.16.0~651 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65b2110937c4b97be4030ecb49aa0801fc940bf8;p=thirdparty%2Fsamba.git auth:credentials: Check if password_obtained > obtained Fixes reading the password from STDIN or environment vars if it was already given in the command line: $ export PASSWD_FD=0 $ ./bin/net offlinejoin composeodj <...> --password=FOO Signed-off-by: Samuel Cabrero Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Mon Sep 11 03:36:28 UTC 2023 on atb-devel-224 --- diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 3690ac8c3a4..ab5efd90f26 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -1555,6 +1555,10 @@ _PUBLIC_ bool cli_credentials_parse_password_fd(struct cli_credentials *credenti char *p; char pass[128]; + if (credentials->password_obtained >= obtained) { + return false; + } + for(p = pass, *p = '\0'; /* ensure that pass is null-terminated */ p && p - pass < sizeof(pass) - 1;) { switch (read(fd, p, 1)) {