]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-afs-all-20041213
authorJeffrey Altman <jaltman@mit.edu>
Mon, 13 Dec 2004 23:43:17 +0000 (23:43 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 13 Dec 2004 23:43:17 +0000 (23:43 +0000)
In addition to establishing a connection with \\AFS; use \\AFS\all to
ensure that we can access ioctl calls even if other methods fail.

src/sys/pioctl_nt.c

index aa93298df4990aa9b98ec8d00824f723aebb830e..0e409b8b656a84048817aaff3248a87c892ef244 100644 (file)
@@ -199,6 +199,8 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                    FILE_FLAG_WRITE_THROUGH, NULL);
     fflush(stdout);
     if (fh == INVALID_HANDLE_VALUE) {
+        int  gonext = 0;
+
         gle = GetLastError();
         if (gle && ioctlDebug ) {
             char buf[4096];
@@ -246,18 +248,22 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                     fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
                              szPath,szUser,res);
                 }
+                gonext = 1;
+            }
 
-                sprintf(szPath, "\\\\%s\\all", szClient);
-                res = WNetAddConnection2(&nr,NULL,szUser,0);
-                if (res) {
-                    if ( ioctlDebug ) {
-                        fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
-                                 szPath,szUser,res);
-                    }
-                    goto next_attempt;
+            sprintf(szPath, "\\\\%s\\all", szClient);
+            res = WNetAddConnection2(&nr,NULL,szUser,0);
+            if (res) {
+                if ( ioctlDebug ) {
+                    fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
+                             szPath,szUser,res);
                 }
+                gonext = 1;
             }
 
+            if (gonext)
+                goto next_attempt;
+
             fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
                              FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                              FILE_FLAG_WRITE_THROUGH, NULL);
@@ -301,16 +307,16 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                     fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
                              szPath,szUser,res);
                 }
+            }
 
-                sprintf(szPath, "\\\\%s\\all", szClient);
-                res = WNetAddConnection2(&nr,NULL,szUser,0);
-                if (res) {
-                    if ( ioctlDebug ) {
-                        fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
-                                 szPath,szUser,res);
-                    }
-                    return -1;
+            sprintf(szPath, "\\\\%s\\all", szClient);
+            res = WNetAddConnection2(&nr,NULL,szUser,0);
+            if (res) {
+                if ( ioctlDebug ) {
+                    fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
+                             szPath,szUser,res);
                 }
+                return -1;
             }
 
             fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,