]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
ioctl-unc-20040603
authorJeffrey Altman <jaltman@mit.edu>
Fri, 4 Jun 2004 07:02:18 +0000 (07:02 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 4 Jun 2004 07:02:18 +0000 (07:02 +0000)
 * 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
src/sys/pioctl_nt.c

index 0a179e0d26f6763b79ca26468cf63ab325368823..754a3eac5604476c97f6ed50eab32115561f8fcf 100644 (file)
@@ -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 */
index a08d3ba9d0851d693a6a430639a4a13af755692a..acffb5609d2fba51fc10bbfe94298878b5f08fe3 100644 (file)
@@ -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);
             }
         }
        }