]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth:creds: Add cli_credentials_get_password_and_obtained()
authorAndreas Schneider <asn@samba.org>
Tue, 1 Sep 2020 13:33:18 +0000 (15:33 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 28 Apr 2021 03:43:34 +0000 (03:43 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/credentials.c
auth/credentials/credentials.h

index ac2b42a669ba0523571933a74609fad5fb565b42..5c39569e34aaaaa550d426c2eeeab1a50ae2512e 100644 (file)
@@ -446,6 +446,26 @@ _PUBLIC_ const char *cli_credentials_get_password(struct cli_credentials *cred)
        return cred->password;
 }
 
+/**
+ * @brief Obtain the password for this credentials context.
+ *
+ * @param[in]  cred  The credential context.
+ *
+ * @param[in]  obtained  A pointer to store the obtained information.
+ *
+ * return The user name or NULL if an error occured.
+ */
+_PUBLIC_ const char *
+cli_credentials_get_password_and_obtained(struct cli_credentials *cred,
+                                         enum credentials_obtained *obtained)
+{
+       if (obtained != NULL) {
+               *obtained = cred->password_obtained;
+       }
+
+       return cli_credentials_get_password(cred);
+}
+
 /* Set a password on the credentials context, including an indication
  * of 'how' the password was obtained */
 
index bea734f06dc09a0924df2c3bf5dcebf3ba9389e8..04cf5138aec973b870c9c7e8042349f4615fd808 100644 (file)
@@ -91,6 +91,8 @@ struct cli_credentials *cli_credentials_init_server(TALLOC_CTX *mem_ctx,
 void cli_credentials_set_anonymous(struct cli_credentials *cred);
 bool cli_credentials_wrong_password(struct cli_credentials *cred);
 const char *cli_credentials_get_password(struct cli_credentials *cred);
+const char *cli_credentials_get_password_and_obtained(struct cli_credentials *cred,
+                                                     enum credentials_obtained *obtained);
 void cli_credentials_get_ntlm_username_domain(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, 
                                              const char **username, 
                                              const char **domain);