mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
auth:creds: Add cli_credentials_get_domain_and_obtained()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
1041dae03f
commit
a7622bc7db
@ -738,6 +738,28 @@ _PUBLIC_ const char *cli_credentials_get_domain(struct cli_credentials *cred)
|
|||||||
return cred->domain;
|
return cred->domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Obtain the domain for this credential context.
|
||||||
|
*
|
||||||
|
* @param[in] cred The credential context.
|
||||||
|
*
|
||||||
|
* @param[out] obtained A pointer to store the obtained information.
|
||||||
|
*
|
||||||
|
* @return The domain name or NULL if an error occurred.
|
||||||
|
*/
|
||||||
|
_PUBLIC_ const char *cli_credentials_get_domain_and_obtained(
|
||||||
|
struct cli_credentials *cred,
|
||||||
|
enum credentials_obtained *obtained)
|
||||||
|
{
|
||||||
|
const char *domain = cli_credentials_get_domain(cred);
|
||||||
|
|
||||||
|
if (obtained != NULL) {
|
||||||
|
*obtained = cred->domain_obtained;
|
||||||
|
}
|
||||||
|
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_PUBLIC_ bool cli_credentials_set_domain(struct cli_credentials *cred,
|
_PUBLIC_ bool cli_credentials_set_domain(struct cli_credentials *cred,
|
||||||
const char *val,
|
const char *val,
|
||||||
|
@ -127,6 +127,9 @@ int cli_credentials_get_keytab(struct cli_credentials *cred,
|
|||||||
struct loadparm_context *lp_ctx,
|
struct loadparm_context *lp_ctx,
|
||||||
struct keytab_container **_ktc);
|
struct keytab_container **_ktc);
|
||||||
const char *cli_credentials_get_domain(struct cli_credentials *cred);
|
const char *cli_credentials_get_domain(struct cli_credentials *cred);
|
||||||
|
const char *cli_credentials_get_domain_and_obtained(
|
||||||
|
struct cli_credentials *cred,
|
||||||
|
enum credentials_obtained *obtained);
|
||||||
struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred);
|
struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred);
|
||||||
void cli_credentials_set_machine_account_pending(struct cli_credentials *cred,
|
void cli_credentials_set_machine_account_pending(struct cli_credentials *cred,
|
||||||
struct loadparm_context *lp_ctx);
|
struct loadparm_context *lp_ctx);
|
||||||
|
@ -48,6 +48,7 @@ static void torture_creds_init(void **state)
|
|||||||
const char *username = NULL;
|
const char *username = NULL;
|
||||||
const char *domain = NULL;
|
const char *domain = NULL;
|
||||||
const char *password = NULL;
|
const char *password = NULL;
|
||||||
|
enum credentials_obtained dom_obtained = CRED_UNINITIALISED;
|
||||||
enum credentials_obtained usr_obtained = CRED_UNINITIALISED;
|
enum credentials_obtained usr_obtained = CRED_UNINITIALISED;
|
||||||
enum credentials_obtained pwd_obtained = CRED_UNINITIALISED;
|
enum credentials_obtained pwd_obtained = CRED_UNINITIALISED;
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -65,6 +66,11 @@ static void torture_creds_init(void **state)
|
|||||||
domain = cli_credentials_get_domain(creds);
|
domain = cli_credentials_get_domain(creds);
|
||||||
assert_string_equal(domain, "WURST");
|
assert_string_equal(domain, "WURST");
|
||||||
|
|
||||||
|
domain = cli_credentials_get_domain_and_obtained(creds,
|
||||||
|
&dom_obtained);
|
||||||
|
assert_int_equal(dom_obtained, CRED_SPECIFIED);
|
||||||
|
assert_string_equal(domain, "WURST");
|
||||||
|
|
||||||
username = cli_credentials_get_username(creds);
|
username = cli_credentials_get_username(creds);
|
||||||
assert_null(username);
|
assert_null(username);
|
||||||
ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED);
|
ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED);
|
||||||
|
Loading…
Reference in New Issue
Block a user