libcli/smb: fix the credit handling on a SMB1 => SMB2 negotiate
authorStefan Metzmacher <metze@samba.org>
Wed, 14 Aug 2013 06:12:08 +0000 (08:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 14 Aug 2013 19:12:08 +0000 (21:12 +0200)
Our cur_credit value had 1 credit to much in the case of
an SMB1 => SMB2 upgrade. When we max out the credits the server
disconnected the connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
libcli/smb/smbXcli_base.c

index 7397f83a0ad21f2b9c8f65d8faf04ce6266c0080..3b24f9a07aafb1acb3c77ab96278f449cac6f1c9 100644 (file)
@@ -4405,9 +4405,14 @@ static NTSTATUS smbXcli_negprot_dispatch_incoming(struct smbXcli_conn *conn,
 
                /*
                 * we got an SMB2 answer, which consumed sequence number 0
-                * so we need to use 1 as the next one
+                * so we need to use 1 as the next one.
+                *
+                * we also need to set the current credits to 0
+                * as we consumed the initial one. The SMB2 answer
+                * hopefully grant us a new credit.
                 */
                conn->smb2.mid = 1;
+               conn->smb2.cur_credits = 0;
                tevent_req_set_callback(subreq, smbXcli_negprot_smb2_done, req);
                conn->dispatch_incoming = smb2cli_conn_dispatch_incoming;
                return smb2cli_conn_dispatch_incoming(conn, tmp_mem, inbuf);