s3:smbd: cancel all locks that are made before the first failure
authorStefan Metzmacher <metze@samba.org>
Tue, 7 Jul 2009 15:16:21 +0000 (17:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 Jul 2009 15:22:08 +0000 (17:22 +0200)
We never reached the cleanup code and directly returned the error.

metze

source3/smbd/reply.c

index 87001468599b71177382c5babaeb345f422e4330..c07ac336793789ce6ca7b9c81174a04c94566510 100644 (file)
@@ -7491,18 +7491,18 @@ void reply_lockingX(struct smb_request *req)
                }
 
                if (NT_STATUS_V(status)) {
-                       END_PROFILE(SMBlockingX);
-                       reply_nterror(req, status);
-                       return;
+                       break;
                }
        }
 
        /* If any of the above locks failed, then we must unlock
           all of the previous locks (X/Open spec). */
+       if (num_locks != 0 && !NT_STATUS_IS_OK(status)) {
+
+               if (locktype & LOCKING_ANDX_CANCEL_LOCK) {
+                       i = -1; /* we want to skip the for loop */
+               }
 
-       if (!(locktype & LOCKING_ANDX_CANCEL_LOCK) &&
-                       (i != num_locks) &&
-                       (num_locks != 0)) {
                /*
                 * Ensure we don't do a remove on the lock that just failed,
                 * as under POSIX rules, if we have a lock already there, we