[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed May 5 16:58:59 MDT 2010


The branch, master has been updated
       via  d58b795... Move to MS-FSA algorithm when checking for invalid lock range.
      from  c6ebab8... s3: only include gen_ndr headers where needed.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d58b7955871213a4d0d4b77d080f6fc716350054
Author: Jeremy Allison <jra at samba.org>
Date:   Wed May 5 15:57:57 2010 -0700

    Move to MS-FSA algorithm when checking for invalid lock range.
    
    Satisfies SMB and SMB2.
    
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/locking/brlock.c |   13 ++++++-------
 source3/smbd/smb2_lock.c |    7 -------
 2 files changed, 6 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index ee0eaf5..8250e5a 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -333,12 +333,12 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
 
 	SMB_ASSERT(plock->lock_type != UNLOCK_LOCK);
 
-	for (i=0; i < br_lck->num_locks; i++) {
-		if (locks[i].start + locks[i].size < locks[i].start) {
-			/* 64-bit wrap. Error. */
-			return NT_STATUS_INVALID_LOCK_RANGE;
-		}
+	if ((plock->start + plock->size - 1 < plock->start) &&
+			plock->size != 0) {
+		return NT_STATUS_INVALID_LOCK_RANGE;
+	}
 
+	for (i=0; i < br_lck->num_locks; i++) {
 		/* Do any Windows or POSIX locks conflict ? */
 		if (brl_conflict(&locks[i], plock)) {
 			/* Remember who blocked us. */
@@ -716,8 +716,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
 	}
 
 	/* Don't allow 64-bit lock wrap. */
-	if (plock->start + plock->size < plock->start ||
-			plock->start + plock->size < plock->size) {
+	if (plock->start + plock->size - 1 < plock->start) {
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 9e69915..7b01889 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -277,7 +277,6 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
 	}
 
 	for (i=0; i<in_lock_count; i++) {
-		uint64_t max_count;
 		bool invalid = false;
 
 		switch (in_locks[i].flags) {
@@ -346,12 +345,6 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
 		} else {
 			locks[i].brltype = UNLOCK_LOCK;
 		}
-
-		max_count = UINT64_MAX - locks[i].offset;
-		if (locks[i].count > max_count) {
-			tevent_req_nterror(req, NT_STATUS_INVALID_LOCK_RANGE);
-			return tevent_req_post(req, ev);
-		}
 	}
 
 	state->locks = locks;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list