]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced-write-perm-grants-read-lock-20070423
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 24 Apr 2007 01:27:30 +0000 (01:27 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 24 Apr 2007 01:27:30 +0000 (01:27 +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.

src/viced/afsfileprocs.c

index 1ea8a8919c1b00fec02009e37ba6be9f0dea8a53..70c3f0463f3695246608565134d3da056122d3ac 100644 (file)
@@ -1725,8 +1725,11 @@ HandleLocking(Vnode * targetptr, struct client *client, afs_int32 rights, ViceLo
                0;
        Time += AFS_LOCKWAIT;
        if (LockingType == LockRead) {
-           if ( !(rights & PRSFS_LOCK) )
-               return(EACCES);
+           if ( !(rights & PRSFS_LOCK) && 
+                 !(rights & PRSFS_WRITE) &&
+                 !(OWNSp(client, targetptr) && (rights & PRSFS_INSERT)) )
+                    return(EACCES);
+            return(EACCES);
 
            if (targetptr->disk.lock.lockCount >= 0) {
                ++(targetptr->disk.lock.lockCount);