]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:client: avoid cli_credentials_get_password() to check for a specified password
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Apr 2022 11:49:39 +0000 (13:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 May 2024 11:30:33 +0000 (11:30 +0000)
Using cli_credentials_get_password_obtained() is more lightweight as
it avoids a possible password prompt.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/client/client.c

index 65012f51260672ec0f0434689067814430d1954d..2052eb5ed4c595bcc2656a03b44ebc6c3409e13a 100644 (file)
@@ -6627,7 +6627,7 @@ int main(int argc,char *argv[])
 
                /* if the service has already been retrieved then check if we have also a password */
                if (service_opt &&
-                   cli_credentials_get_password(creds) == NULL &&
+                   cli_credentials_get_password_obtained(creds) != CRED_SPECIFIED &&
                    poptPeekArg(pc)) {
                        cli_credentials_set_password(creds,
                                                     poptGetArg(pc),
@@ -6731,7 +6731,7 @@ int main(int argc,char *argv[])
 
        /* if the service has already been retrieved then check if we have also a password */
        if (service_opt &&
-           cli_credentials_get_password(creds) == NULL &&
+           cli_credentials_get_password_obtained(creds) != CRED_SPECIFIED &&
            poptPeekArg(pc)) {
                cli_credentials_set_password(creds,
                                             poptGetArg(pc),