Windows: afslogon NPLogonNotify exit on KTC_NOCM
[openafs.git] / src / WINNT / afsd / afslogon.c
index c34db83..7f01851 100644 (file)
@@ -224,8 +224,17 @@ DWORD APIENTRY NPGetCaps(DWORD index)
 {
     switch (index) {
     case WNNC_NET_TYPE:
-        /* Don't have our own type; use somebody else's. */
-        return WNNC_NET_OPENAFS;
+        /*
+         * The purpose of this response is to let the system
+         * know which file system the network provider is associated with
+         * Microsoft issues these values starting from 1 with the exception
+         * of WNNC_CRED_MANAGER which is 0xFFFF.  The provider type is
+         * stored in the hiword.  Pick a value that is unused.
+         */
+        return 0x1FFF0000;
+
+    case WNNC_SPEC_VERSION:
+        return WNNC_SPEC_VERSION51;
 
     case WNNC_START:
         /* Say we are already started, even though we might wait after we receive NPLogonNotify */
@@ -940,9 +949,9 @@ DWORD APIENTRY NPLogonNotify(
             DebugEvent0("Unable to obtain Root Cell");
             code = KTC_NOCELL;
             reason = "unknown cell";
-            code=0;
         } else {
             DebugEvent("Default cell is %s", cell);
+            code = 0;
         }
 
         /* We get the user's home directory path, if applicable, though we can't lookup the
@@ -967,7 +976,8 @@ DWORD APIENTRY NPLogonNotify(
             Sleep(10);
         }
 
-       while (IsServiceRunning()) {
+        while (IsServiceRunning() && code != KTC_NOCM && code != KTC_NOCMRPC && code != KTC_NOCELL) {
+
             DebugEvent("while(autostart) LogonOption[%x], Service AutoStart[%d]",
                        opt.LogonOption,afsWillAutoStart);