enablekfw-regkey-20040227
authorJeffrey Altman <jaltman@mit.edu>
Fri, 27 Feb 2004 18:35:22 +0000 (18:35 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 27 Feb 2004 18:35:22 +0000 (18:35 +0000)
* Add new Registry Key:

{HKLM,HKCU}\\SOFTWARE\\OpenAFS\\Client
DWORD  EnableKFW

Default value if missing is 0x01

src/WINNT/client_creds/afskfw.c

index 92a902b..3ced3f8 100644 (file)
@@ -457,9 +457,33 @@ KFW_cleanup(void)
         FreeLibrary(hCCAPI);
 }
 
+char OpenAFSConfigKeyName[] = "SOFTWARE\\OpenAFS\\Client";
+
 int 
 KFW_is_available(void)
 {
+    HKEY parmKey;
+       DWORD code, len;
+    DWORD enableKFW = 1;
+
+    code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, OpenAFSConfigKeyName,
+                         0, KEY_QUERY_VALUE, &parmKey);
+    if (code != ERROR_SUCCESS)
+        code = RegOpenKeyEx(HKEY_CURRENT_USER, OpenAFSConfigKeyName,
+                             0, KEY_QUERY_VALUE, &parmKey);
+       if (code == ERROR_SUCCESS) {
+        len = sizeof(enableKFW);
+        code = RegQueryValueEx(parmKey, "EnableKFW", NULL, NULL,
+                                (BYTE *) &enableKFW, &len);
+        if (code != ERROR_SUCCESS) {
+            enableKFW = 1;
+        }
+        RegCloseKey (parmKey);
+       }
+
+    if ( !enableKFW )
+        return FALSE;
+
     KFW_initialize();
     if ( hKrb5 && hComErr && hService && 
 #ifdef USE_MS2MIT