From 9b16804c5f56430fa28d42f65654505a341e4084 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 29 May 2006 00:09:52 +0000 Subject: [PATCH] STABLE14-windows-get-acls-20060528 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 | 20 +++++++++++++------- src/WINNT/afsd/cm_callback.c | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/WINNT/afsd/cm_access.c b/src/WINNT/afsd/cm_access.c index 1203309db..1cff06472 100644 --- a/src/WINNT/afsd/cm_access.c +++ b/src/WINNT/afsd/cm_access.c @@ -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; diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index d1617de9f..9b568e955 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -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); -- 2.39.5