diff options
author | David Disseldorp <ddiss@samba.org> | 2015-01-16 16:21:23 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2015-01-29 21:15:10 +0100 |
commit | 371d159e2db2679d7346475b625a870dda4a5852 (patch) | |
tree | 3814a822e0a0d96a083a734630fb2083095004ac /source3 | |
parent | 2856b641f321ecfd430fef24cd1158c0e2a1dd01 (diff) | |
download | samba-371d159e2db2679d7346475b625a870dda4a5852.tar.gz |
libsmb: provide authinfo domain for DFS referral auth
libsmbclient uses the smbc_init->smbc_get_auth_data_fn() provided
workgroup/domain in initial connections, but then switches to the
default smb.conf workgroup/domain when handling DFS referrals.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11059
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6c9de0cd056afc0b478c02f1bdb0e06532388037)
[ddiss@samba.org: 4.0 rebase with cli_init_creds() call]
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clidfs.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 93c964a4d02..750fd449dab 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -95,6 +95,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, char *newserver, *newshare; const char *username; const char *password; + const char *domain; NTSTATUS status; int flags = 0; @@ -162,11 +163,15 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, username = get_cmdline_auth_info_username(auth_info); password = get_cmdline_auth_info_password(auth_info); + domain = get_cmdline_auth_info_domain(auth_info); + if ((domain == NULL) || (domain[0] == '\0')) { + domain = lp_workgroup(); + } status = cli_session_setup(c, username, password, strlen(password), password, strlen(password), - lp_workgroup()); + domain); if (!NT_STATUS_IS_OK(status)) { /* If a password was not supplied then * try again with a null username. */ @@ -187,7 +192,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, d_printf("Anonymous login successful\n"); status = cli_init_creds(c, "", lp_workgroup(), ""); } else { - status = cli_init_creds(c, username, lp_workgroup(), password); + status = cli_init_creds(c, username, domain, password); } if (!NT_STATUS_IS_OK(status)) { @@ -218,7 +223,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, force_encrypt, username, password, - lp_workgroup())) { + domain)) { cli_shutdown(c); return do_connect(ctx, newserver, newshare, auth_info, false, @@ -240,7 +245,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, status = cli_cm_force_encryption(c, username, password, - lp_workgroup(), + domain, sharename); if (!NT_STATUS_IS_OK(status)) { cli_shutdown(c); |