summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-12-09 12:20:19 +0100
committerAndrew Bartlett <abartlet@samba.org>2016-12-20 01:11:24 +0100
commit6b18ac69156de588ec44d812e74ec8391c07d633 (patch)
tree6ded2fcafa69d274adda078063fbcc06c258dd39 /auth
parent86558b5ce8c4df9a6e5b86536c81cd584cdeb20e (diff)
downloadsamba-6b18ac69156de588ec44d812e74ec8391c07d633.tar.gz
auth/credentials: let cli_credentials_parse_string() always reset username and domain
If cli_credentials_parse_string() is used we should no longer use any guessed values and need to make sure username and domain are reset if principal and realm are set. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/credentials/credentials.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index a0f91e92b73..cca772d9f41 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -781,6 +781,14 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
}
if ((p = strchr_m(uname,'@'))) {
+ /*
+ * We also need to set username and domain
+ * in order to undo the effect of
+ * cli_credentials_guess().
+ */
+ cli_credentials_set_username(credentials, uname, obtained);
+ cli_credentials_set_domain(credentials, "", obtained);
+
cli_credentials_set_principal(credentials, uname, obtained);
*p = 0;
cli_credentials_set_realm(credentials, p+1, obtained);