From 414fe9588a3532fcb648be3b9a7fbc04baa5e14b Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 4 Jun 2004 07:02:18 +0000 Subject: [PATCH] ioctl-unc-20040603 * pioctl.c: handle another UNC case in GetIoctlHandle ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== * cm_ioctl.c: avoid running off the end of a string --- src/WINNT/afsd/cm_ioctl.c | 4 ++-- src/sys/pioctl_nt.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 0a179e0..754a3ea 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -167,7 +167,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, if ( !_strnicmp("all", p, 3) ) p += 4; - for (i = 0; *p != '\\'; i++,p++ ) { + for (i = 0; *p && *p != '\\'; i++,p++ ) { shareName[i] = *p; } p++; /* skip past trailing slash */ @@ -195,7 +195,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, p += 4; shareName[0] = '/'; - for (i = 1; *p != '\\'; i++,p++ ) { + for (i = 1; *p && *p != '\\'; i++,p++ ) { shareName[i] = *p; } p++; /* skip past trailing slash */ diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index a08d3ba..acffb56 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -112,6 +112,20 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) tbuffer[0] = *(drivep - 1); tbuffer[1] = ':'; strcpy(tbuffer + 2, SMB_IOCTL_FILENAME); + } else if (fileNamep[0] == fileNamep[1] && + fileNamep[0] == '\\') + { + int count = 0, i = 0; + + while (count < 4 && fileNamep[i]) { + tbuffer[i] = fileNamep[i]; + if ( tbuffer[i++] == '\\' ) + count++; + } + if (tbuffer[i] == 0) + tbuffer[i++] = '\\'; + tbuffer[i] = 0; + strcat(tbuffer, SMB_IOCTL_FILENAME); } else { char curdir[256]=""; @@ -120,6 +134,20 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) tbuffer[0] = curdir[0]; tbuffer[1] = ':'; strcpy(tbuffer + 2, SMB_IOCTL_FILENAME); + } else if (curdir[0] == curdir[1] && + curdir[0] == '\\') + { + int count = 0, i = 0; + + while (count < 4 && curdir[i]) { + tbuffer[i] = curdir[i]; + if ( tbuffer[i++] == '\\' ) + count++; + } + if (tbuffer[i] == 0) + tbuffer[i++] = '\\'; + tbuffer[i] = 0; + strcat(tbuffer, SMB_IOCTL_FILENAME); } } } -- 1.9.4