The branch, v3-5-test has been updated
       via  3ec654d... Make Samba3 pass the RAW-LOCK test as Windows.
      from  242d117... s3: bug #6967: Prevent glibc error on net ads join:  
talloc()ed memory should not be SAFE_FREE()ed.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 3ec654de706f4bd2576245333cc98105388a3c10
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Dec 4 14:04:08 2009 -0800

    Make Samba3 pass the RAW-LOCK test as Windows.
    
    Implement the win7 NT_STATUS_INVALID_LOCK_RANGE.
    Make smbd behave as Windows does in canceling locks.
    
    Jeremy.
    (cherry picked from commit 32915ceefc718621e2e9b17fee97da82744ab67a)

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

Summary of changes:
 source3/locking/brlock.c |    5 +++++
 source3/smbd/reply.c     |   24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index b021293..22c6c9e 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -333,6 +333,11 @@ 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;
+               }
+
                /* Do any Windows or POSIX locks conflict ? */
                if (brl_conflict(&locks[i], plock)) {
                        /* Remember who blocked us. */
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 030939f..185f601 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -7038,6 +7038,30 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
                if (type & LOCKING_ANDX_CANCEL_LOCK) {
                        struct blocking_lock_record *blr = NULL;
 
+                       if (num_locks > 1) {
+                               /*
+                                * MS-CIFS (2.2.4.32.1) states that a cancel is 
honored if and only
+                                * if the lock vector contains one entry. When 
given mutliple cancel
+                                * requests in a single PDU we expect the 
server to return an
+                                * error. Windows servers seem to accept the 
request but only
+                                * cancel the first lock.
+                                * JRA - Do what Windows does (tm) :-).
+                                */
+
+#if 0
+                               /* MS-CIFS (2.2.4.32.1) behavior. */
+                               return NT_STATUS_DOS(ERRDOS,
+                                               ERRcancelviolation);
+#else
+                               /* Windows behavior. */
+                               if (i != 0) {
+                                       DEBUG(10,("smbd_do_locking: ignoring 
subsequent "
+                                               "cancel request\n"));
+                                       continue;
+                               }
+#endif
+                       }
+
                        if (lp_blocking_locks(SNUM(conn))) {
 
                                /* Schedule a message to ourselves to


-- 
Samba Shared Repository

Reply via email to