From: Jeffrey Altman Date: Thu, 13 Dec 2012 18:27:21 +0000 (-0500) Subject: Windows: *ParseIoctlPath path has trailing slash X-Git-Tag: upstream/1.8.0_pre1^2~1720 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1e03c535da1ace4e878ee1f6985d68259d518f12;p=packages%2Fo%2Fopenafs.git Windows: *ParseIoctlPath path has trailing slash 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 71e5e279b..5597ea71d 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -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); diff --git a/src/WINNT/afsrdr/user/RDRIoctl.c b/src/WINNT/afsrdr/user/RDRIoctl.c index ed7e43fe8..cbbdf84e8 100644 --- a/src/WINNT/afsrdr/user/RDRIoctl.c +++ b/src/WINNT/afsrdr/user/RDRIoctl.c @@ -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);