windows-pioctl-follow-mountpoints-registry-20080108
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 9 Jan 2008 06:03:10 +0000 (06:03 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 9 Jan 2008 06:03:10 +0000 (06:03 +0000)
LICENSE MIT

Add a registry value "PioctlFollowMountPoint" to permit the use of the
old pioctl path evaluation behavior that always followed mountpoints
and symlinks.

src/WINNT/afsd/afsd_init.c
src/WINNT/afsd/cm_ioctl.c

index e795bb3..f0be854 100644 (file)
@@ -44,6 +44,7 @@ extern afs_int32 cryptall;
 extern int cm_enableServerLocks;
 extern int cm_followBackupPath;
 extern int cm_deleteReadOnly;
+extern afs_uint32 cm_pioctlFollowMountPoint;
 #ifdef USE_BPLUS
 extern afs_int32 cm_BPlusTrees;
 #endif
@@ -1149,6 +1150,14 @@ int afsd_InitCM(char **reasonP)
     } 
     afsi_log("CM FollowBackupPath is %u", cm_followBackupPath);
 
+    dummyLen = sizeof(DWORD);
+    code = RegQueryValueEx(parmKey, "PioctlFollowMountPoint", NULL, NULL,
+                           (BYTE *) &dwValue, &dummyLen);
+    if (code == ERROR_SUCCESS) {
+        cm_pioctlFollowMountPoint = (afs_uint32) dwValue;
+    } 
+    afsi_log("CM PioctlFollowMountPoint is %u", cm_pioctlFollowMountPoint);
+
     RegCloseKey (parmKey);
 
     cacheBlocks = ((afs_uint64)cacheSize * 1024) / blockSize;
index 6644574..02c3ee3 100644 (file)
@@ -53,6 +53,8 @@ extern char cm_NetbiosName[];
 
 extern void afsi_log(char *pattern, ...);
 
+afs_uint32 cm_pioctlFollowMountPoint = 0;
+
 void cm_InitIoctl(void)
 {
     lock_InitializeMutex(&cm_Afsdsbmt_Lock, "AFSDSBMT.INI Access Lock");
@@ -203,7 +205,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
 #endif
     char * relativePath;
     char * lastComponent = NULL;
-    afs_uint32 follow = 0;
+    afs_uint32 follow = (cm_pioctlFollowMountPoint ? CM_FLAG_FOLLOW : CM_FLAG_NOMOUNTCHASE);
 
     relativePath = ioctlp->inDatap;
     /* setup the next data value for the caller to use */
@@ -229,7 +231,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
        and it returns the correct (full) path.  therefore, there is
        no drive letter, and the path is absolute. */
     code = cm_NameI(cm_data.rootSCachep, relativePath,
-                     CM_FLAG_CASEFOLD | follow,
+                     CM_FLAG_CASEFOLD,
                      userp, "", reqp, scpp);
 
     if (code) {
@@ -282,7 +284,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
                code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
                                 userp, NULL, reqp, &iscp);
                if (code == 0)
-                   code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | CM_FLAG_NOMOUNTCHASE,
+                   code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | follow,
                                    userp, NULL, reqp, scpp);
                if (iscp)
                    cm_ReleaseSCache(iscp);
@@ -329,7 +331,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
                code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
                                 userp, NULL, reqp, &iscp);
                if (code == 0)
-                   code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | CM_FLAG_NOMOUNTCHASE,
+                   code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | follow,
                                    userp, NULL, reqp, scpp);
                if (iscp)
                    cm_ReleaseSCache(iscp);
@@ -361,7 +363,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
            code = cm_NameI(substRootp, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
                             userp, NULL, reqp, &iscp);
            if (code == 0)
-               code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | CM_FLAG_NOMOUNTCHASE,
+               code = cm_NameI(iscp, lastComponent, CM_FLAG_CASEFOLD | follow,
                                 userp, NULL, reqp, scpp);
            if (iscp)
                cm_ReleaseSCache(iscp);