[SCM] Samba Shared Repository - branch v3-6-test updated
Karolin Seeger
kseeger at samba.org
Wed Nov 16 12:35:04 MST 2011
The branch, v3-6-test has been updated
via 3556436 Ensure we correctly calculate reply credits over all returned SMB2 replies, and do as Windows does and return the total in the last SMB2 reply. Fixes an issue found by Christian M Ambach <christian.ambach at de.ibm.com> (and thanks to Christian for the initial patch this was based on). (cherry picked from commit 65566dfa8629136eaf0dc1491502dc651d1a4858)
from 5336e30 s3:smb2_flush: outbody only needs 4 bytes
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 35564365f49fda6505d6e350fa8b0e5ef1a4e33c
Author: Jeremy Allison <jra at samba.org>
Date: Tue Nov 15 11:27:56 2011 -0800
Ensure we correctly calculate reply credits over all returned
SMB2 replies, and do as Windows does and return the total in the
last SMB2 reply. Fixes an issue found by Christian M Ambach <christian.ambach at de.ibm.com>
(and thanks to Christian for the initial patch this was based on).
(cherry picked from commit 65566dfa8629136eaf0dc1491502dc651d1a4858)
Fix bug #8614 (SMB2: not granting credits for all requests in a compound
request).
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/smb2_server.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 0e70983..8a5d81f 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -514,13 +514,24 @@ static void smb2_calculate_credits(const struct smbd_smb2_request *inreq,
struct smbd_smb2_request *outreq)
{
int count, idx;
+ uint16_t total_credits = 0;
count = outreq->out.vector_count;
for (idx=1; idx < count; idx += 3) {
+ uint8_t *outhdr = (uint8_t *)outreq->out.vector[idx].iov_base;
smb2_set_operation_credit(outreq->sconn,
&inreq->in.vector[idx],
&outreq->out.vector[idx]);
+ /* To match Windows, count up what we
+ just granted. */
+ total_credits += SVAL(outhdr, SMB2_HDR_CREDIT);
+ /* Set to zero in all but the last reply. */
+ if (idx + 3 < count) {
+ SSVAL(outhdr, SMB2_HDR_CREDIT, 0);
+ } else {
+ SSVAL(outhdr, SMB2_HDR_CREDIT, total_credits);
+ }
}
}
@@ -1739,11 +1750,9 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req)
smb2_setup_nbt_length(req->out.vector, req->out.vector_count);
- /* Set credit for this operation (zero credits if this
+ /* Set credit for these operations (zero credits if this
is a final reply for an async operation). */
- smb2_set_operation_credit(req->sconn,
- &req->in.vector[i],
- &req->out.vector[i]);
+ smb2_calculate_credits(req, req);
if (req->do_signing) {
NTSTATUS status;
--
Samba Shared Repository
More information about the samba-cvs
mailing list