From 1e03c535da1ace4e878ee1f6985d68259d518f12 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 13 Dec 2012 13:27:21 -0500 Subject: [PATCH] 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 --- src/WINNT/afsd/smb_ioctl.c | 15 ++++++++++----- src/WINNT/afsrdr/user/RDRIoctl.c | 13 +++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) 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); -- 2.39.5