windows-scache-locks-20041126
authorJeffrey Altman <jaltman@mit.edu>
Fri, 26 Nov 2004 08:32:16 +0000 (08:32 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 26 Nov 2004 08:32:16 +0000 (08:32 +0000)
replace all direct manipulations of the cm_scache_t refCount field
with calls to cm_{Hold,Release}SCache[NoLock]().

add missing call to cm_HoldScacheNoLock in freelance Mount Point
re-initialization code.

experiment a bit more with "special folders".   ensure that checks
for "desktop.ini" are case insensitive.

src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_freelance.c
src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/cm_scache.c
src/WINNT/afsd/cm_scache.h
src/WINNT/afsd/cm_user.c
src/WINNT/afsd/cm_user.h
src/WINNT/afsd/smb.c
src/WINNT/afsd/smb3.c

index 14dac42..7e7ec28 100644 (file)
@@ -160,7 +160,7 @@ void cm_RevokeCallback(struct rx_call *callp, AFSFid *fidp)
         if (scp->fid.volume == tfid.volume &&
              scp->fid.vnode == tfid.vnode &&
              scp->fid.unique == tfid.unique) {
-            scp->refCount++;
+            cm_HoldSCacheNoLock(scp);
             lock_ReleaseWrite(&cm_scacheLock);
             osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
             lock_ObtainMutex(&scp->mx);
@@ -168,7 +168,7 @@ void cm_RevokeCallback(struct rx_call *callp, AFSFid *fidp)
             lock_ReleaseMutex(&scp->mx);
             cm_CallbackNotifyChange(scp);
             lock_ObtainWrite(&cm_scacheLock);
-            scp->refCount--;
+            cm_ReleaseSCacheNoLock(scp);
         }
     }
     lock_ReleaseWrite(&cm_scacheLock);
@@ -201,7 +201,7 @@ void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp)
     for (hash = 0; hash < cm_hashTableSize; hash++) {
         for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
             if (scp->fid.volume == fidp->Volume) {
-                scp->refCount++;
+                cm_HoldSCacheNoLock(scp);
                 lock_ReleaseWrite(&cm_scacheLock);
                 lock_ObtainMutex(&scp->mx);
                 osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
@@ -209,7 +209,7 @@ void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp)
                 lock_ReleaseMutex(&scp->mx);
                 cm_CallbackNotifyChange(scp);
                 lock_ObtainWrite(&cm_scacheLock);
-                scp->refCount--;
+                cm_ReleaseSCacheNoLock(scp);
             }
         }      /* search one hash bucket */
     }  /* search all hash buckets */
@@ -290,7 +290,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *callp)
        lock_ObtainWrite(&cm_scacheLock);
        for (hash = 0; hash < cm_hashTableSize; hash++) {
             for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
-                scp->refCount++;
+                cm_HoldSCacheNoLock(scp);
                 lock_ReleaseWrite(&cm_scacheLock);
                 lock_ObtainMutex(&scp->mx);
                 discarded = 0;
@@ -306,7 +306,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *callp)
                 if (discarded)
                     cm_CallbackNotifyChange(scp);
                 lock_ObtainWrite(&cm_scacheLock);
-                scp->refCount--;
+                cm_ReleaseSCacheNoLock(scp);
             }  /* search one hash bucket */
        }       /* search all hash buckets */
        
@@ -909,17 +909,17 @@ void cm_CheckCBExpiration(void)
     lock_ObtainWrite(&cm_scacheLock);
     for (i=0; i<cm_hashTableSize; i++) {
         for (scp = cm_hashTablep[i]; scp; scp=scp->nextp) {
-            scp->refCount++;
+            cm_HoldSCacheNoLock(scp);
             lock_ReleaseWrite(&cm_scacheLock);
             if (scp->cbExpires > 0 && (scp->cbServerp == NULL || now > scp->cbExpires)) {
                 osi_Log1(afsd_logp, "Callback Expiration Discarding SCache scp %x", scp);
-                cm_CallbackNotifyChange(scp);
                 lock_ObtainMutex(&scp->mx);
                 cm_DiscardSCache(scp);
                 lock_ReleaseMutex(&scp->mx);
+                cm_CallbackNotifyChange(scp);
             }
             lock_ObtainWrite(&cm_scacheLock);
-            osi_assert(scp->refCount-- > 0);
+            cm_ReleaseSCacheNoLock(scp);
         }
     }
     lock_ReleaseWrite(&cm_scacheLock);
index f0358af..2fc417e 100644 (file)
@@ -377,13 +377,14 @@ int cm_reInitLocalMountPoints() {
                  ) {
 
                 // mark the scp to be reused
+                cm_HoldSCacheNoLock(scp);
                 lock_ReleaseWrite(&cm_scacheLock);
                 lock_ObtainMutex(&scp->mx);
                 cm_DiscardSCache(scp);
                 lock_ReleaseMutex(&scp->mx);
                 cm_CallbackNotifyChange(scp);
                 lock_ObtainWrite(&cm_scacheLock);
-                scp->refCount--;
+                cm_ReleaseSCacheNoLock(scp);
 
                 // take the scp out of the hash
                 lscpp = &cm_hashTablep[hash];
index b502052..b4d145f 100644 (file)
@@ -91,13 +91,13 @@ void cm_ResetACLCache(cm_user_t *userp)
     lock_ObtainWrite(&cm_scacheLock);
     for (hash=0; hash < cm_hashTableSize; hash++) {
         for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
-            scp->refCount++;
+            cm_HoldSCacheNoLock(scp);
             lock_ReleaseWrite(&cm_scacheLock);
             lock_ObtainMutex(&scp->mx);
             cm_InvalidateACLUser(scp, userp);
             lock_ReleaseMutex(&scp->mx);
             lock_ObtainWrite(&cm_scacheLock);
-            scp->refCount--;
+            cm_ReleaseSCacheNoLock(scp);
         }
     }
     lock_ReleaseWrite(&cm_scacheLock);
@@ -548,7 +548,7 @@ long cm_IoctlFlushVolume(struct smb_ioctl *ioctlp, struct cm_user *userp)
     for (i=0; i<cm_hashTableSize; i++) {
         for (scp = cm_hashTablep[i]; scp; scp = scp->nextp) {
             if (scp->fid.volume == volume) {
-                scp->refCount++;
+                cm_HoldSCacheNoLock(scp);
                 lock_ReleaseWrite(&cm_scacheLock);
 
                 /* now flush the file */
@@ -556,7 +556,7 @@ long cm_IoctlFlushVolume(struct smb_ioctl *ioctlp, struct cm_user *userp)
                 if ( code )
                     afsi_log("cm_FlushFile returns error: [%x]",code);
                 lock_ObtainWrite(&cm_scacheLock);
-                scp->refCount--;
+                cm_ReleaseSCacheNoLock(scp);
             }
         }
     }
index b5e2a76..41577dc 100644 (file)
@@ -235,7 +235,7 @@ cm_scache_t *cm_FindSCache(cm_fid_t *fidp)
     lock_ObtainWrite(&cm_scacheLock);
     for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
         if (cm_FidCmp(fidp, &scp->fid) == 0) {
-            scp->refCount++;
+            cm_HoldSCacheNoLock(scp);
             cm_AdjustLRU(scp);
             lock_ReleaseWrite(&cm_scacheLock);
             return scp;
@@ -272,9 +272,9 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
     // yj: check if we have the scp, if so, we don't need
     // to do anything else
     lock_ObtainWrite(&cm_scacheLock);
-    for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
+    for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
         if (cm_FidCmp(fidp, &scp->fid) == 0) {
-            scp->refCount++;
+            cm_HoldSCacheNoLock(scp);
             *outScpp = scp;
             cm_AdjustLRU(scp);
             lock_ReleaseWrite(&cm_scacheLock);
@@ -369,9 +369,10 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
     /* otherwise, we have the volume, now reverify that the scp doesn't
      * exist, and proceed.
      */
-    for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
+    for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
         if (cm_FidCmp(fidp, &scp->fid) == 0) {
-            scp->refCount++;
+                       osi_assert(scp->volp == volp);
+            cm_HoldSCacheNoLock(scp);
             cm_AdjustLRU(scp);
             lock_ReleaseWrite(&cm_scacheLock);
             if (volp)
@@ -978,6 +979,14 @@ void cm_AFSFidFromFid(AFSFid *afsFidp, cm_fid_t *fidp)
     afsFidp->Unique = fidp->unique;
 }       
 
+void cm_HoldSCacheNoLock(cm_scache_t *scp)
+{
+#ifdef NOLOCK_ASSERT
+    osi_assert(scp->refCount > 0);
+#endif
+    scp->refCount++;
+}
+
 void cm_HoldSCache(cm_scache_t *scp)
 {
     lock_ObtainWrite(&cm_scacheLock);
@@ -986,6 +995,11 @@ void cm_HoldSCache(cm_scache_t *scp)
     lock_ReleaseWrite(&cm_scacheLock);
 }
 
+void cm_ReleaseSCacheNoLock(cm_scache_t *scp)
+{
+    osi_assert(scp->refCount-- > 0);
+}
+
 void cm_ReleaseSCache(cm_scache_t *scp)
 {
     lock_ObtainWrite(&cm_scacheLock);
@@ -1033,9 +1047,9 @@ int cm_DumpSCache(FILE *outputFile, char *cookie)
   
     for (scp = cm_scacheLRULastp; scp; scp = (cm_scache_t *) osi_QPrev(&scp->q)) 
     {
-        if (scp->refCount != 0)
+        if (scp->refCount > 0)
         {
-            sprintf(output, "%s fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%d\n", 
+            sprintf(output, "%s fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\n", 
                     cookie, scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique, 
                     scp->refCount);
             WriteFile(outputFile, output, strlen(output), &zilch, NULL);
@@ -1051,9 +1065,9 @@ int cm_DumpSCache(FILE *outputFile, char *cookie)
         {
             if (scp)
             {
-                if (scp->refCount)
+                if (scp->refCount > 0)
                 {
-                    sprintf(output, "%s scp=0x%08X, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%d\n", 
+                    sprintf(output, "%s scp=0x%08X, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\n", 
                             cookie, (void *)scp, i, scp->fid.cell, scp->fid.volume, scp->fid.vnode, 
                             scp->fid.unique, scp->refCount);
                     WriteFile(outputFile, output, strlen(output), &zilch, NULL);
index 3cf2bf3..04f251e 100644 (file)
@@ -58,7 +58,7 @@ typedef struct cm_scache {
                                         * write-locked to prevent buffers from
                                          * being created during a truncate op, etc.
                                          */
-        unsigned long refCount;                        /* reference count; cm_scacheLock */
+        long refCount;                 /* reference count; cm_scacheLock */
         osi_queueData_t *bufReadsp;    /* queue of buffers being read */
         osi_queueData_t *bufWritesp;   /* queue of buffers being written */
 
@@ -240,8 +240,12 @@ extern void cm_MergeStatus(cm_scache_t *, struct AFSFetchStatus *, struct AFSVol
 
 extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
 
+extern void cm_HoldSCacheNoLock(cm_scache_t *);
+
 extern void cm_HoldSCache(cm_scache_t *);
 
+extern void cm_ReleaseSCacheNoLock(cm_scache_t *);
+
 extern void cm_ReleaseSCache(cm_scache_t *);
 
 extern cm_scache_t *cm_FindSCache(cm_fid_t *fidp);
index d59c236..6d7ba07 100644 (file)
@@ -27,95 +27,98 @@ cm_user_t *cm_rootUserp;
 
 void cm_InitUser(void)
 {
-       static osi_once_t once;
+    static osi_once_t once;
         
-        if (osi_Once(&once)) {
-               lock_InitializeRWLock(&cm_userLock, "cm_userLock");
-                osi_EndOnce(&once);
-       }
+    if (osi_Once(&once)) {
+        lock_InitializeRWLock(&cm_userLock, "cm_userLock");
+        osi_EndOnce(&once);
+    }
         
-        cm_rootUserp = cm_NewUser();
+    cm_rootUserp = cm_NewUser();
 }
 
 cm_user_t *cm_NewUser(void)
 {
-       cm_user_t *up;
+    cm_user_t *up;
         
-        up = malloc(sizeof(*up));
-        memset(up, 0, sizeof(*up));
-        up->refCount = 1;
-        up->vcRefs = 1;                /* from caller */
-        lock_InitializeMutex(&up->mx, "cm_user_t");
-        return up;
+    up = malloc(sizeof(*up));
+    memset(up, 0, sizeof(*up));
+    up->refCount = 1;
+    up->vcRefs = 1;            /* from caller */
+    lock_InitializeMutex(&up->mx, "cm_user_t");
+    return up;
 }
 
 /* must be called with locked userp */
 cm_ucell_t *cm_GetUCell(cm_user_t *userp, cm_cell_t *cellp)
 {
-       cm_ucell_t *ucp;
+    cm_ucell_t *ucp;
         
-       lock_AssertMutex(&userp->mx);
-        for(ucp = userp->cellInfop; ucp; ucp=ucp->nextp) {
-               if (ucp->cellp == cellp) break;
-        }
+    lock_AssertMutex(&userp->mx);
+    for (ucp = userp->cellInfop; ucp; ucp=ucp->nextp) {
+        if (ucp->cellp == cellp) 
+            break;
+    }
         
-        if (!ucp) {
-               ucp = malloc(sizeof(*ucp));
-                memset(ucp, 0, sizeof(*ucp));
-                ucp->nextp = userp->cellInfop;
-               if (userp->cellInfop)
-                       ucp->iterator = userp->cellInfop->iterator + 1;
-               else
-                       ucp->iterator = 1;
-                userp->cellInfop = ucp;
-                ucp->cellp = cellp;
-        }
+    if (!ucp) {
+        ucp = malloc(sizeof(*ucp));
+        memset(ucp, 0, sizeof(*ucp));
+        ucp->nextp = userp->cellInfop;
+        if (userp->cellInfop)
+            ucp->iterator = userp->cellInfop->iterator + 1;
+        else
+            ucp->iterator = 1;
+        userp->cellInfop = ucp;
+        ucp->cellp = cellp;
+    }
         
-        return ucp;
+    return ucp;
 }
 
 cm_ucell_t *cm_FindUCell(cm_user_t *userp, int iterator)
 {
-       cm_ucell_t *ucp;
-       cm_ucell_t *best;
-
-       best = NULL;
-       lock_AssertMutex(&userp->mx);
-       for (ucp = userp->cellInfop; ucp; ucp = ucp->nextp) {
-               if (ucp->iterator >= iterator)
-                       best = ucp;
-               else
-                       break;
-       }
-       return best;
+    cm_ucell_t *ucp;
+    cm_ucell_t *best;
+
+    best = NULL;
+    lock_AssertMutex(&userp->mx);
+    for (ucp = userp->cellInfop; ucp; ucp = ucp->nextp) {
+        if (ucp->iterator >= iterator)
+            best = ucp;
+        else
+            break;
+    }       
+    return best;
 }
 
 void cm_HoldUser(cm_user_t *up)
 {
-       lock_ObtainWrite(&cm_userLock);
-       up->refCount++;
-       lock_ReleaseWrite(&cm_userLock);
+    lock_ObtainWrite(&cm_userLock);
+    up->refCount++;
+    lock_ReleaseWrite(&cm_userLock);
 }
 
 void cm_ReleaseUser(cm_user_t *up)
 {
-       cm_ucell_t *ucp;
+    cm_ucell_t *ucp;
     cm_ucell_t *ncp;
 
-       if (up == NULL) return;
-
-       lock_ObtainWrite(&cm_userLock);
-       osi_assert(up->refCount-- > 0);
-       if (up->refCount == 0) {
-               lock_FinalizeMutex(&up->mx);
-        for(ucp = up->cellInfop; ucp; ucp = ncp) {
-                       ncp = ucp->nextp;
-                       if (ucp->ticketp) free(ucp->ticketp);
+    if (up == NULL) 
+        return;
+
+    lock_ObtainWrite(&cm_userLock);
+    osi_assert(up->refCount-- > 0);
+    if (up->refCount == 0) {
+        lock_FinalizeMutex(&up->mx);
+        for (ucp = up->cellInfop; ucp; ucp = ncp) {
+            ncp = ucp->nextp;
+            if (ucp->ticketp) 
+                free(ucp->ticketp);
             free(ucp);
         }
         free(up);
     }
-       lock_ReleaseWrite(&cm_userLock);
+    lock_ReleaseWrite(&cm_userLock);
 }
 
 /* release the count of the # of connections that use this user structure.
@@ -126,10 +129,10 @@ void cm_ReleaseUser(cm_user_t *up)
  */
 void cm_ReleaseUserVCRef(cm_user_t *userp)
 {
-       lock_ObtainMutex(&userp->mx);
-       osi_assert(userp->vcRefs-- > 0);
-       lock_ReleaseMutex(&userp->mx);
-}
+    lock_ObtainMutex(&userp->mx);
+    osi_assert(userp->vcRefs-- > 0);
+    lock_ReleaseMutex(&userp->mx);
+}       
 
 
 /*
@@ -142,46 +145,47 @@ void cm_ReleaseUserVCRef(cm_user_t *userp)
  */
 void cm_CheckTokenCache(long now)
 {
-        extern smb_vc_t *smb_allVCsp; /* global vcp list */
-       smb_vc_t   *vcp;
-       smb_user_t *usersp;
-       cm_user_t  *userp = NULL;
-       cm_ucell_t *ucellp;
-       BOOL bExpired=FALSE;
-  
-       /* 
-        * For every vcp, get the user and check his tokens 
-        */
-       lock_ObtainWrite(&smb_rctLock);
-       for(vcp=smb_allVCsp; vcp; vcp=vcp->nextp) {
-               for(usersp=vcp->usersp; usersp; usersp=usersp->nextp) {
-                               if (usersp->unp) {
-                          if ((userp=usersp->unp->userp)==0)
-                                          continue;
-                               } else
-                                       continue;
-                       lock_ObtainMutex(&userp->mx);
-                       for(ucellp=userp->cellInfop; ucellp; ucellp=ucellp->nextp) {
-                         if(ucellp->flags & CM_UCELLFLAG_RXKAD) {
-                           if(ucellp->expirationTime < now) {
-                                 /* this guy's tokens have expired */
-                                 osi_Log3(afsd_logp, "cm_CheckTokens: Tokens for user:%s have expired expiration time:0x%x ucellp:%x", ucellp->userName, ucellp->expirationTime, ucellp);
-                                 if (ucellp->ticketp) {
-                                         free(ucellp->ticketp);
-                                         ucellp->ticketp = NULL;
-                                 }
-                                 ucellp->flags &= ~CM_UCELLFLAG_RXKAD;
-                                 ucellp->gen++;
-                                 bExpired=TRUE;
-                           }
-                         } 
-                       }
-                       lock_ReleaseMutex(&userp->mx);
-                       if(bExpired) {
-                               bExpired=FALSE;
-                               cm_ResetACLCache(userp);
-                       }
-               }
-       }
-       lock_ReleaseWrite(&smb_rctLock);
+    extern smb_vc_t *smb_allVCsp; /* global vcp list */
+    smb_vc_t   *vcp;
+    smb_user_t *usersp;
+    cm_user_t  *userp = NULL;
+    cm_ucell_t *ucellp;
+    BOOL bExpired=FALSE;
+
+    /* 
+     * For every vcp, get the user and check his tokens 
+     */
+    lock_ObtainWrite(&smb_rctLock);
+    for (vcp=smb_allVCsp; vcp; vcp=vcp->nextp) {
+        for (usersp=vcp->usersp; usersp; usersp=usersp->nextp) {
+            if (usersp->unp) {
+                if ((userp=usersp->unp->userp)==0)
+                    continue;
+            } else
+                continue;
+            lock_ObtainMutex(&userp->mx);
+            for (ucellp=userp->cellInfop; ucellp; ucellp=ucellp->nextp) {
+                if (ucellp->flags & CM_UCELLFLAG_RXKAD) {
+                    if (ucellp->expirationTime < now) {
+                        /* this guy's tokens have expired */
+                        osi_Log3(afsd_logp, "cm_CheckTokens: Tokens for user:%s have expired expiration time:0x%x ucellp:%x", 
+                                 ucellp->userName, ucellp->expirationTime, ucellp);
+                        if (ucellp->ticketp) {
+                            free(ucellp->ticketp);
+                            ucellp->ticketp = NULL;
+                        }
+                        ucellp->flags &= ~CM_UCELLFLAG_RXKAD;
+                        ucellp->gen++;
+                        bExpired=TRUE;
+                    }
+                } 
+            }
+            lock_ReleaseMutex(&userp->mx);
+            if (bExpired) {
+                bExpired=FALSE;
+                cm_ResetACLCache(userp);
+            }
+        }
+    }
+    lock_ReleaseWrite(&smb_rctLock);
 }
index 1e58649..17453e1 100644 (file)
  * corresponding userp's userp->mx mutex.
  */
 typedef struct cm_ucell {
-       struct cm_ucell *nextp;         /* next cell in the list */
-        struct cm_cell *cellp;         /* the cell this applies to */
-       char *ticketp;                  /* locked by mx */
-        int ticketLen;                 /* by mx */
-        struct ktc_encryptionKey sessionKey;   /* by mx */
-        long kvno;                     /* key version in ticket */
-        long expirationTime;           /* when tix expire */
-       int gen;                        /* generation number */
-       int iterator;                   /* for use as ListTokens cookie */
-        long flags;                    /* flags */
-       char userName[MAXKTCNAMELEN];   /* user name */
+    struct cm_ucell *nextp;            /* next cell in the list */
+    struct cm_cell *cellp;             /* the cell this applies to */
+    char *ticketp;                     /* locked by mx */
+    int ticketLen;                     /* by mx */
+    struct ktc_encryptionKey sessionKey;/* by mx */
+    long kvno;                         /* key version in ticket */
+    long expirationTime;               /* when tix expire */
+    int gen;                           /* generation number */
+    int iterator;                      /* for use as ListTokens cookie */
+    long flags;                                /* flags */
+    char userName[MAXKTCNAMELEN];      /* user name */
 } cm_ucell_t;
 
 #define CM_UCELLFLAG_HASTIX    1       /* has Kerberos tickets */
 #define CM_UCELLFLAG_RXKAD     2       /* an rxkad connection */
 #define CM_UCELLFLAG_BADTIX    4       /* tickets are bad or expired */
+#define CM_UCELLFLAG_RXGK       8       /* an rxgk connection */
 
 typedef struct cm_user {
-       unsigned long refCount;                 /* ref count */
-       cm_ucell_t *cellInfop;          /* list of cell info */
-        osi_mutex_t mx;                        /* mutex */
-        int vcRefs;                    /* count of references from virtual circuits */
-        long flags;
+    unsigned long refCount;             /* ref count - cm_userLock */
+    cm_ucell_t *cellInfop;             /* list of cell info */
+    osi_mutex_t mx;                    /* mutex */
+    int vcRefs;                                /* count of references from virtual circuits */
+    long flags;
 } cm_user_t;
 
 #define CM_USERFLAG_DELETE     1       /* delete on last reference */
index ebea271..c238f22 100644 (file)
@@ -392,14 +392,7 @@ unsigned int smb_Attributes(cm_scache_t *scp)
     {
         attrs = SMB_ATTR_DIRECTORY;
 #ifdef SPECIAL_FOLDERS
-#ifdef AFS_FREELANCE_CLIENT
-        if ( cm_freelanceEnabled &&
-             scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && 
-             scp->fid.volume==AFS_FAKE_ROOT_VOL_ID &&
-             scp->fid.vnode==0x1 && scp->fid.unique==0x1) {
-            attrs |= SMB_ATTR_SYSTEM;          /* FILE_ATTRIBUTE_SYSTEM */
-        }
-#endif /* AFS_FREELANCE_CLIENT */
+        attrs |= SMB_ATTR_SYSTEM;              /* FILE_ATTRIBUTE_SYSTEM */
 #endif /* SPECIAL_FOLDERS */
     } else
         attrs = 0;
@@ -4020,6 +4013,7 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack
      */
     spacep = inp->spacep;
     smb_StripLastComponent(spacep->data, &lastComp, pathp);
+#ifndef SPECIAL_FOLDERS
     if (lastComp && stricmp(lastComp, "\\desktop.ini") == 0) {
         code = cm_NameI(rootScp, spacep->data,
                         caseFold | CM_FLAG_DIRSEARCH | CM_FLAG_FOLLOW,
@@ -4042,6 +4036,7 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack
             }
         }
     }
+#endif /* SPECIAL_FOLDERS */
 
     code = cm_NameI(rootScp, pathp, caseFold | CM_FLAG_FOLLOW, userp,
                     tidPathp, &req, &newScp);
index 50df833..f03270c 100644 (file)
@@ -75,14 +75,7 @@ unsigned long smb_ExtAttributes(cm_scache_t *scp)
     {
         attrs = SMB_ATTR_DIRECTORY;
 #ifdef SPECIAL_FOLDERS
-#ifdef AFS_FREELANCE_CLIENT
-        if ( cm_freelanceEnabled &&
-             scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && 
-             scp->fid.volume==AFS_FAKE_ROOT_VOL_ID &&
-             scp->fid.vnode==0x1 && scp->fid.unique==0x1) {
-            attrs |= SMB_ATTR_SYSTEM;          /* FILE_ATTRIBUTE_SYSTEM */
-        }
-#endif /* AFS_FREELANCE_CLIENT */
+        attrs |= SMB_ATTR_SYSTEM;              /* FILE_ATTRIBUTE_SYSTEM */
 #endif /* SPECIAL_FOLDERS */
     } else
         attrs = 0;
@@ -2590,9 +2583,10 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
         spacep = cm_GetSpace();
         smb_StripLastComponent(spacep->data, &lastComp,
                                 (char *)(&p->parmsp[3]));
+#ifndef SPECIAL_FOLDERS
         /* Make sure that lastComp is not NULL */
         if (lastComp) {
-            if (strcmp(lastComp, "\\desktop.ini") == 0) {
+            if (stricmp(lastComp, "\\desktop.ini") == 0) {
                 code = cm_NameI(cm_rootSCachep, spacep->data,
                                  CM_FLAG_CASEFOLD
                                  | CM_FLAG_DIRSEARCH
@@ -2620,6 +2614,8 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
                 }
             }
         }
+#endif /* SPECIAL_FOLDERS */
+
         cm_FreeSpace(spacep);
     }