From 52bcb024b755390d41c5623086554a30efc0a065 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 14 Nov 2014 09:31:51 +0100 Subject: [PATCH 1/3] s3-lib: Do not require a password with --use-ccache. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10279 Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner (cherry picked from commit 1e148a91fd20053f823b57e19d757665fa30c53d) --- source3/lib/util_cmdline.c | 3 ++- source3/script/tests/test_smbclient_s3.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source3/lib/util_cmdline.c b/source3/lib/util_cmdline.c index d15f325..80c3ecd 100644 --- a/source3/lib/util_cmdline.c +++ b/source3/lib/util_cmdline.c @@ -251,7 +251,8 @@ void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info) TALLOC_CTX *frame; if (get_cmdline_auth_info_got_pass(auth_info) || - get_cmdline_auth_info_use_kerberos(auth_info)) { + get_cmdline_auth_info_use_ccache(auth_info) || + get_cmdline_auth_info_use_kerberos(auth_info)) { /* Already got one... */ return; } diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 596cd42..f73643f 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -602,7 +602,7 @@ test_ccache_access() return fi - $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \ + $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \ -c quit 2>&1 ret=$? @@ -621,7 +621,7 @@ test_ccache_access() return fi - $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \ + $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \ -c quit 2>&1 ret=$? -- 2.1.3 From 5531bad275b79a15de208b0c0841caaa6e9a45f5 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 14 Nov 2014 10:03:07 +0100 Subject: [PATCH 2/3] s3-libsmb: Set the netbios_name in use_ccache case too. If we do not set the netbios_name we are not able to connect to a Windows DC. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10279 Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner (cherry picked from commit 206f25d815024248214f076fd60c35862e9de8a1) --- source3/libsmb/ntlmssp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index e8c9ebf..0a62b8b 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -383,6 +383,15 @@ static NTSTATUS ntlmssp3_client_challenge(struct ntlmssp_state *ntlmssp_state, wbcErr wbc_status; int i; + /* + * We need to set the netbios name or we are not able to connect + * a Windows DC. + */ + if (ntlmssp_state->server.netbios_domain == NULL || + ntlmssp_state->server.netbios_domain[0] == '\0') { + ntlmssp_state->server.netbios_domain = ntlmssp_state->domain; + } + params.account_name = ntlmssp_state->user; params.domain_name = ntlmssp_state->domain; params.level = WBC_CREDENTIAL_CACHE_LEVEL_NTLMSSP; -- 2.1.3 From 15f8a8f9b8ac056cece0164d61a591731038a91e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 14 Nov 2014 10:05:13 +0100 Subject: [PATCH 3/3] s3-libsmb: Duplicate the memory before we free it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10279 Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner (cherry picked from commit 8c41795c81d85114e383e694ba7421e95bacb912) --- source3/libsmb/ntlmssp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index 0a62b8b..617b34b 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -422,9 +422,12 @@ static NTSTATUS ntlmssp3_client_challenge(struct ntlmssp_state *ntlmssp_state, goto noccache; } - *next_request = data_blob(wbc_next->data, wbc_next->length); - ntlmssp_state->session_key = data_blob( - wbc_session_key->data, wbc_session_key->length); + *next_request = data_blob_talloc(ntlmssp_state, + wbc_next->data, + wbc_next->length); + ntlmssp_state->session_key = data_blob_talloc(ntlmssp_state, + wbc_session_key->data, + wbc_session_key->length); wbcFreeMemory(info); goto done; -- 2.1.3