]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-viced-write-perm-grants-read-lock-20070423
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 24 Apr 2007 01:41:03 +0000 (01:41 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 24 Apr 2007 01:41:03 +0000 (01:41 +0000)
the permission to obtain a write-lock is granted either by having the
"w" permission or the "i" when owning the file.  The permission to obtain
a read-lock has been granted by having the "k" permission.  However it
makes no sense that someone can obtain a write-lock but not a read-lock.
This patch grants permission to obtain read-locks to those who can obtain
write-locks.

(cherry picked from commit bb61e1dc678ea28132c195438fc1f157fa580cd1)

src/viced/afsfileprocs.c

index 2fef7eba5d462989440edc489bfbec5d80c7c19e..0d6c75ec5f2b9f9951514fbfdd57909fbdb241b6 100644 (file)
@@ -1760,7 +1760,9 @@ HandleLocking(Vnode * targetptr, struct client *client, afs_int32 rights, ViceLo
                0;
        Time += AFS_LOCKWAIT;
        if (LockingType == LockRead) {
-           if ( !(rights & PRSFS_LOCK) )
+           if ( !(rights & PRSFS_LOCK) &&
+                 !(rights & PRSFS_WRITE) &&
+                 !(OWNSp(client, targetptr) && (rights & PRSFS_INSERT)) )
                return(EACCES);
  
            if (targetptr->disk.lock.lockCount >= 0) {