]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-windows-get-acls-20060528
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 29 May 2006 00:09:52 +0000 (00:09 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 29 May 2006 00:09:52 +0000 (00:09 +0000)
It is possible to have a valid callback but not to have the
required ACL info for the current user.  Force acquisition of
a FetchStatus but do so without making multiple calls.

(cherry picked from commit 83732fdb158e79b64774667ee09fc1b81062707e)

src/WINNT/afsd/cm_access.c
src/WINNT/afsd/cm_callback.c

index 1203309db9e06487671ee21bb831393417303291..1cff06472fe755bbc9f1f81d2481315f3ccbbc79 100644 (file)
@@ -119,6 +119,7 @@ long cm_GetAccessRights(struct cm_scache *scp, struct cm_user *up,
     long code;
     cm_fid_t tfid;
     cm_scache_t *aclScp;
+    int got_cb = 0;
 
     /* pretty easy: just force a pass through the fetch status code */
         
@@ -127,10 +128,14 @@ long cm_GetAccessRights(struct cm_scache *scp, struct cm_user *up,
     /* first, start by finding out whether we have a directory or something
      * else, so we can find what object's ACL we need.
      */
-    code = cm_SyncOp(scp, NULL, up, reqp, 0, 
-                     CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-    if (code) 
-        return code;
+    if (!cm_HaveCallback(scp)) {
+       code = cm_SyncOp(scp, NULL, up, reqp, 0, 
+                        CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+       if (code) 
+           return code;
+
+       got_cb = 1;
+    }
         
     if (scp->fileType != CM_SCACHETYPE_DIRECTORY) {
         /* not a dir, use parent dir's acl */
@@ -147,11 +152,12 @@ long cm_GetAccessRights(struct cm_scache *scp, struct cm_user *up,
                 
         osi_Log1(afsd_logp, "GetAccess parent scp %x user %x", aclScp, up);
         lock_ObtainMutex(&aclScp->mx);
-       code = cm_SyncOp(aclScp, NULL, up, reqp, 0,
-                         CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-        lock_ReleaseMutex(&aclScp->mx);
+       code = cm_GetCallback(aclScp, up, reqp, 1);
+       lock_ReleaseMutex(&aclScp->mx);
         cm_ReleaseSCache(aclScp);
         lock_ObtainMutex(&scp->mx);
+    } else if (!got_cb) {
+       code = cm_GetCallback(scp, up, reqp, 1);
     }
 
     return code;
index d1617de9fc2c1409259375f692b86a74befdcb7a..9b568e955bcb82e72130e2b96d6524a8490731f3 100644 (file)
@@ -1662,7 +1662,7 @@ long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp,
 
         /* otherwise, we have to make an RPC to get the status */
         sflags = CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK;
-        cm_SyncOp(scp, NULL, NULL, NULL, 0, sflags);
+        cm_SyncOp(scp, NULL, userp, reqp, 0, sflags);
         cm_StartCallbackGrantingCall(scp, &cbr);
         sfid = scp->fid;
         lock_ReleaseMutex(&scp->mx);