diff options
author | Jeremy Allison <jra@samba.org> | 2010-02-24 16:16:30 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-02-24 16:16:30 -0800 |
commit | 26891651ec8dd68113ff0f49d996c3e70d55933e (patch) | |
tree | 6999b220923184b2b9b319c6148ffef9f9821437 | |
parent | 76f4e6f16b624c6a680122b4bed7f5922bc1f236 (diff) | |
download | samba-26891651ec8dd68113ff0f49d996c3e70d55933e.tar.gz samba-26891651ec8dd68113ff0f49d996c3e70d55933e.tar.bz2 samba-26891651ec8dd68113ff0f49d996c3e70d55933e.zip |
Change the credential handling so that we start with maxmux creds,
and then return to the client the number of credits per operation
that they asked for. This is a more sensible algorithm than just
blindly returning "20" on every reply, although we will probably
still need more changes to this going forward.
Jeremy.
-rw-r--r-- | source3/smbd/smb2_server.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 9e5be404ef..1d95d4be3f 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -234,7 +234,8 @@ static NTSTATUS smbd_smb2_request_create(struct smbd_server_connection *sconn, return NT_STATUS_OK; } -static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req) +static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req, + uint16_t *p_creds_requested) { int count; int idx; @@ -266,6 +267,8 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req) return NT_STATUS_INVALID_PARAMETER; } + *p_creds_requested = SVAL(inhdr, SMB2_HDR_CREDIT); + flags = IVAL(inhdr, SMB2_HDR_FLAGS); if (idx == 1) { /* @@ -314,7 +317,7 @@ static NTSTATUS smbd_smb2_request_validate(struct smbd_smb2_request *req) return NT_STATUS_OK; } -static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req) +static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req, uint16_t creds) { struct iovec *vector; int count; @@ -371,8 +374,7 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req) NT_STATUS_V(NT_STATUS_INTERNAL_ERROR)); SSVAL(outhdr, SMB2_HDR_OPCODE, SVAL(inhdr, SMB2_HDR_OPCODE)); - /* Make up a number for now... JRA. FIXME ! FIXME !*/ - SSVAL(outhdr, SMB2_HDR_CREDIT, 20); + SSVAL(outhdr, SMB2_HDR_CREDIT, creds); SIVAL(outhdr, SMB2_HDR_FLAGS, IVAL(inhdr, SMB2_HDR_FLAGS) | SMB2_HDR_FLAG_REDIRECT); SIVAL(outhdr, SMB2_HDR_NEXT_COMMAND, next_command_ofs); @@ -1510,7 +1512,7 @@ void smbd_smb2_first_negprot(struct smbd_server_connection *sconn, return; } - status = smbd_smb2_request_setup_out(req); + status = smbd_smb2_request_setup_out(req, (uint16_t)lp_maxmux()); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(sconn, nt_errstr(status)); return; @@ -1533,6 +1535,7 @@ void smbd_smb2_first_negprot(struct smbd_server_connection *sconn, static void smbd_smb2_request_incoming(struct tevent_req *subreq) { + uint16_t creds_requested = 0; struct smbd_server_connection *sconn = tevent_req_callback_data(subreq, struct smbd_server_connection); NTSTATUS status; @@ -1557,13 +1560,13 @@ static void smbd_smb2_request_incoming(struct tevent_req *subreq) DEBUG(10,("smbd_smb2_request_incoming: idx[%d] of %d vectors\n", req->current_idx, req->in.vector_count)); - status = smbd_smb2_request_validate(req); + status = smbd_smb2_request_validate(req, &creds_requested); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(sconn, nt_errstr(status)); return; } - status = smbd_smb2_request_setup_out(req); + status = smbd_smb2_request_setup_out(req, creds_requested); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(sconn, nt_errstr(status)); return; |