diff options
author | Jeremy Allison <jra@samba.org> | 2014-11-25 17:43:25 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-11-26 19:05:37 +0100 |
commit | c426f97238e4f664d1b13781101ca9c942aa7d0d (patch) | |
tree | 7168efbaf7ec39ccb69d092455d6297ead453065 | |
parent | 068f9e26486fbcd36c109df9ada50c9384ba52c5 (diff) | |
download | samba-c426f97238e4f664d1b13781101ca9c942aa7d0d.tar.gz |
libcli: SMB2: Pure SMB2-only negprot fix to make us behave as a Windows client does.
Required as some servers return zero when asked for
zero credits in an initial SMB2-only negprot.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
-rw-r--r-- | libcli/smb/smb2_negotiate_context.h | 1 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libcli/smb/smb2_negotiate_context.h b/libcli/smb/smb2_negotiate_context.h index d98104a1a76..55aa032665e 100644 --- a/libcli/smb/smb2_negotiate_context.h +++ b/libcli/smb/smb2_negotiate_context.h @@ -50,5 +50,6 @@ NTSTATUS smb2_negotiate_context_add(TALLOC_CTX *mem_ctx, struct smb2_negotiate_c */ struct smb2_negotiate_context *smb2_negotiate_context_find(const struct smb2_negotiate_contexts *b, uint16_t type); +#define WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK 31 #endif /* _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_ */ diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 61ac6f04f12..a3a7ecb801c 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -3864,6 +3864,16 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, */ conn->dispatch_incoming = smb2cli_conn_dispatch_incoming; + /* + * As we're starting with an SMB2 negprot, emulate Windows + * and ask for 31 credits in the initial SMB2 negprot. + * If we don't and leave requested credits at + * zero, MacOSX servers return zero credits on + * the negprot reply and we fail to connect. + */ + smb2cli_conn_set_max_credits(conn, + WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK); + subreq = smbXcli_negprot_smb2_subreq(state); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); |