DEVEL15-windows-pioctl-follow-mountpoints-registry-20080108
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 9 Jan 2008 06:05:00 +0000 (06:05 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 9 Jan 2008 06:05:00 +0000 (06:05 +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.

(cherry picked from commit 845fb28de656d9886dd44cbf335833985ffc7d3b)

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

index db29c5c..c61878d 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
@@ -1151,6 +1152,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 7d8cfd4..baf4045 100644 (file)
@@ -62,6 +62,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");
@@ -221,7 +223,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 */
@@ -247,7 +249,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) {
@@ -300,7 +302,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);
@@ -347,7 +349,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);
@@ -379,7 +381,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);