]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Only mask Delete permission for SMB reqs
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 18 Jul 2011 20:16:42 +0000 (16:16 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Mon, 5 Sep 2011 04:34:35 +0000 (21:34 -0700)
For SMB requests the Delete permission is masked if the
readonly attribute is set on the file.  Do not apply this
heuristic to non-SMB requests.

Change-Id: I6617e935cb32796e4a95b4eac0bec9519bd3e937
Reviewed-on: http://gerrit.openafs.org/5342
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
src/WINNT/afsd/cm_access.c
src/WINNT/afsd/cm_access.h
src/WINNT/afsd/cm_scache.c

index 4230fb1b747a0928705f911e8b069fe6acd0e972..24807fcd88bd364f85a33a352ed8279c25b3c116 100644 (file)
@@ -33,7 +33,8 @@ int cm_accessPerFileCheck = 0;
  * can't be locked.  Thus, this must always be called in a while loop to stabilize
  * things, since we can always lose the race condition getting to the parent vnode.
  */
-int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 rights,
+int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, cm_req_t *reqp,
+                        afs_uint32 rights,
                         afs_uint32 *outRightsp)
 {
     cm_scache_t *aclScp;
@@ -106,7 +107,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
                      scp, scp->unixModeBits);
            *outRightsp &= ~PRSFS_WRITE;
        }
-       if ((scp->unixModeBits & 0200) == 0 && !cm_deleteReadOnly) {
+       if ((scp->unixModeBits & 0200) == 0 && !cm_deleteReadOnly && (reqp->flags & CM_REQ_SOURCE_SMB)) {
            osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing DELETE scp 0x%p unix 0%o",
                      scp, scp->unixModeBits);
            *outRightsp &= ~PRSFS_DELETE;
index 69c7c45d40fe9f5737288da6c2aca1db9b6acdf1..37f756aed9186d457c51b5d0633f820b5a036085 100644 (file)
@@ -13,7 +13,7 @@
 #include "cm_user.h"
 
 extern int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *up,
-       afs_uint32 rights, afs_uint32 *outRights);
+       struct cm_req *reqp, afs_uint32 rights, afs_uint32 *outRights);
 
 extern long cm_GetAccessRights(struct cm_scache *scp, struct cm_user *up,
        struct cm_req *reqp);
index 906ba892f44316e974f041477fd34d0c2bebfa03..af3b21996259fd54711ab1091c9b637d030d04ba 100644 (file)
@@ -1293,7 +1293,7 @@ long cm_SyncOp(cm_scache_t *scp, cm_buf_t *bufp, cm_user_t *userp, cm_req_t *req
             if ((rights & (PRSFS_WRITE|PRSFS_DELETE)) && (scp->flags & CM_SCACHEFLAG_RO))
                 return CM_ERROR_READONLY;
 
-            if (cm_HaveAccessRights(scp, userp, rights, &outRights)) {
+            if (cm_HaveAccessRights(scp, userp, reqp, rights, &outRights)) {
                 if (~outRights & rights)
                    return CM_ERROR_NOACCESS;
             }