Windows: *ParseIoctlPath path has trailing slash
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 13 Dec 2012 18:27:21 +0000 (13:27 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 18 Dec 2012 06:27:40 +0000 (22:27 -0800)
Make it explicit that a pioctl input path that ends in a trailing
slash is consistently interpretted as a directory.

  \\afs\cell\mp\dir\  == \\afs\cell\mp\dir\.

Change-Id: Id55638157cd69297d1a072ae04f94b968ea03b30
Reviewed-on: http://gerrit.openafs.org/8755
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/smb_ioctl.c
src/WINNT/afsrdr/user/RDRIoctl.c

index 71e5e27..5597ea7 100644 (file)
@@ -744,11 +744,16 @@ smb_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
                 return code;
            }
 
-           lastComponent = cm_ClientStrRChr(p,  '\\');
-           if (lastComponent && (lastComponent - p) > 1 &&
-                cm_ClientStrLen(lastComponent) > 1) {
-               *lastComponent = '\0';
-               lastComponent++;
+           lastComponent = cm_ClientStrRChr(p,  L'\\');
+           if (lastComponent && (lastComponent - p) > 1) {
+
+                if (cm_ClientStrLen(lastComponent) == 1) {
+                    *lastComponent = '\0';
+                    lastComponent = L".";
+                } else {
+                    *lastComponent = L'\0';
+                    lastComponent++;
+                }
 
                code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
                                 userp, NULL, reqp, &iscp);
index ed7e43f..cbbdf84 100644 (file)
@@ -641,10 +641,15 @@ RDR_ParseIoctlPath(RDR_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
             return code;
        }
 
-       lastComponent = cm_ClientStrRChr(relativePath, '\\');
-       if (lastComponent && (lastComponent - relativePath) > 1 && wcslen(lastComponent) > 1) {
-           *lastComponent = '\0';
-           lastComponent++;
+       lastComponent = cm_ClientStrRChr(relativePath, L'\\');
+       if (lastComponent && (lastComponent - relativePath) > 1) {
+            if (wcslen(lastComponent) == 1) {
+                *lastComponent = L'\0';
+                lastComponent = L".";
+            } else {
+                *lastComponent = L'\0';
+                lastComponent++;
+            }
 
            code = cm_NameI(substRootp, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
                             userp, NULL, reqp, &iscp);