diff options
author | Jeremy Allison <jra@samba.org> | 2010-05-18 17:11:54 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-05-18 17:11:54 -0700 |
commit | c7982074a7ea85219411311ebf31444ea4c501a5 (patch) | |
tree | 7080ecd72786d97b73cc3dce527d318ce42964e5 | |
parent | ad9050a6ff57d847ba7d95f2cb33353d369dc42b (diff) | |
download | samba-c7982074a7ea85219411311ebf31444ea4c501a5.tar.gz samba-c7982074a7ea85219411311ebf31444ea4c501a5.tar.bz2 samba-c7982074a7ea85219411311ebf31444ea4c501a5.zip |
Keep track of credits we're giving out. Set initial credits to 1 (MS-SMB2 spec required).
Jeremy.
-rw-r--r-- | source3/smbd/globals.h | 1 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index ad175bc420..f6dd36ea72 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -570,6 +570,7 @@ struct smbd_server_connection { bool blocking_lock_unlock_state; } locks; struct smbd_smb2_request *requests; + uint64_t credits_granted; } smb2; }; diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index d8e6ba10a3..75c818bcda 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -437,6 +437,10 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req, uint1 SSVAL(outhdr, SMB2_HDR_OPCODE, SVAL(inhdr, SMB2_HDR_OPCODE)); SSVAL(outhdr, SMB2_HDR_CREDIT, creds); + + /* Remember what we gave out. */ + req->sconn->smb2.credits_granted += creds; + SIVAL(outhdr, SMB2_HDR_FLAGS, IVAL(inhdr, SMB2_HDR_FLAGS) | SMB2_HDR_FLAG_REDIRECT); SIVAL(outhdr, SMB2_HDR_NEXT_COMMAND, next_command_ofs); @@ -755,6 +759,9 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, SIVAL(hdr, SMB2_HDR_STATUS, NT_STATUS_V(STATUS_PENDING)); SSVAL(hdr, SMB2_HDR_OPCODE, SVAL(reqhdr, SMB2_HDR_OPCODE)); SSVAL(hdr, SMB2_HDR_CREDIT, 5); + + req->sconn->smb2.credits_granted += 5; + SIVAL(hdr, SMB2_HDR_FLAGS, flags | SMB2_HDR_FLAG_ASYNC); SIVAL(hdr, SMB2_HDR_NEXT_COMMAND, 0); SBVAL(hdr, SMB2_HDR_MESSAGE_ID, message_id); @@ -1909,7 +1916,7 @@ void smbd_smb2_first_negprot(struct smbd_server_connection *sconn, return; } - status = smbd_smb2_request_setup_out(req, (uint16_t)lp_maxmux()); + status = smbd_smb2_request_setup_out(req, 1); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(sconn, nt_errstr(status)); return; |