diff options
author | Andreas Schneider <asn@samba.org> | 2020-09-01 15:33:18 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2021-04-28 03:43:34 +0000 |
commit | bd2b18250158ba90768c304d2c7cb4d7e81d8dcd (patch) | |
tree | df854964cbe780e76578ebc3644ce20b677ad42d /auth | |
parent | 3b78f4f093251bface20f307eb673ca632add34f (diff) | |
download | samba-bd2b18250158ba90768c304d2c7cb4d7e81d8dcd.tar.gz |
auth:creds: Add cli_credentials_get_password_and_obtained()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth')
-rw-r--r-- | auth/credentials/credentials.c | 20 | ||||
-rw-r--r-- | auth/credentials/credentials.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index ac2b42a669b..5c39569e34a 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -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 */ diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h index bea734f06dc..04cf5138aec 100644 --- a/auth/credentials/credentials.h +++ b/auth/credentials/credentials.h @@ -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); |