pull up r18496 from trunk
authorTom Yu <tlyu@mit.edu>
Wed, 23 Aug 2006 18:38:30 +0000 (18:38 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 23 Aug 2006 18:38:30 +0000 (18:38 +0000)
 r18496@cathode-dark-space:  jaltman | 2006-08-22 22:17:12 -0400
 ticket: 4172

  * Fix auto-registration of plug-in modules
      if there is no plug-in list specified

ticket: 4172

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18508 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/kmm/kmm_reg.c

index dcc75d13e74dcc2c657ce4d128324ed2f22829f8..60159df37c9e8a06b926f34acfae87968c72fde7 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  * Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2006 Secure Endpoints Inc.\r
  *\r
  * Permission is hereby granted, free of charge, to any person\r
  * obtaining a copy of this software and associated documentation\r
@@ -198,8 +199,20 @@ kmm_register_plugin(kmm_plugin_reg * plugin, khm_int32 config_flags)
         size_t scb = 0;\r
 \r
         rv = khc_read_multi_string(csp_module, L"PluginList", NULL, &cb);\r
-        if(rv != KHM_ERROR_TOO_LONG)\r
-            goto _exit;\r
+        if(rv != KHM_ERROR_TOO_LONG) {\r
+            if (rv == KHM_ERROR_NOT_FOUND) {\r
+\r
+                scb = cb = cch * sizeof(wchar_t);\r
+                pl = PMALLOC(cb);\r
+                multi_string_init(pl, cb);\r
+                rv = KHM_ERROR_SUCCESS;\r
+\r
+                goto add_plugin_to_list;\r
+\r
+            } else {\r
+                goto _exit;\r
+            }\r
+        }\r
 \r
         cb += cch * sizeof(wchar_t);\r
         scb = cb;\r
@@ -213,6 +226,8 @@ kmm_register_plugin(kmm_plugin_reg * plugin, khm_int32 config_flags)
             goto _exit;\r
         }\r
 \r
+    add_plugin_to_list:\r
+\r
         if(!multi_string_find(pl, plugin->name, 0)) {\r
             multi_string_append(pl, &scb, plugin->name);\r
             rv = khc_write_multi_string(csp_module, L"PluginList", pl);\r