summaryrefslogtreecommitdiffstats
path: root/src/windows
diff options
context:
space:
mode:
authorJeffrey Altman <jaltman@secure-endpoints.com>2007-09-25 03:53:53 +0000
committerJeffrey Altman <jaltman@secure-endpoints.com>2007-09-25 03:53:53 +0000
commit2f129a4c83f5577404e55670d510a9907794f3f2 (patch)
tree4bddafe697108595bdad5a9aa02d1373c3ef6285 /src/windows
parentffcdd324f1c2793619ad1cda5f4ac2db43883b72 (diff)
downloadkrb5-2f129a4c83f5577404e55670d510a9907794f3f2.tar.gz
krb5-2f129a4c83f5577404e55670d510a9907794f3f2.tar.xz
krb5-2f129a4c83f5577404e55670d510a9907794f3f2.zip
NIM: BUG: KMM: miscellaneous fixes
kmm_reg.c: Allocate enough memory to hold the entire PluginList multi-string plus an extra NUL if the registry value was not properly terminated. kmm_registrar.c: Do not record an error loading a module if there was no configuration for it. kmmmain.c: Avoid a race condition by sending the thread quit message instead of posting it. Do so outside of the critical section to avoid a deadlock. ticket: new component: windows git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19976 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/identity/kmm/kmm_reg.c2
-rw-r--r--src/windows/identity/kmm/kmm_registrar.c22
-rw-r--r--src/windows/identity/kmm/kmmmain.c6
3 files changed, 17 insertions, 13 deletions
diff --git a/src/windows/identity/kmm/kmm_reg.c b/src/windows/identity/kmm/kmm_reg.c
index 564e662c6..e1adaa0c3 100644
--- a/src/windows/identity/kmm/kmm_reg.c
+++ b/src/windows/identity/kmm/kmm_reg.c
@@ -202,7 +202,7 @@ kmm_register_plugin(kmm_plugin_reg * plugin, khm_int32 config_flags)
if(rv != KHM_ERROR_TOO_LONG) {
if (rv == KHM_ERROR_NOT_FOUND) {
- scb = cb = cch * sizeof(wchar_t);
+ scb = cb = (cch + 1) * sizeof(wchar_t);
pl = PMALLOC(cb);
multi_string_init(pl, cb);
rv = KHM_ERROR_SUCCESS;
diff --git a/src/windows/identity/kmm/kmm_registrar.c b/src/windows/identity/kmm/kmm_registrar.c
index 259f868b9..da7ab570b 100644
--- a/src/windows/identity/kmm/kmm_registrar.c
+++ b/src/windows/identity/kmm/kmm_registrar.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
+ * Copyright (c) 2007 Secure Endpoints Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -551,9 +552,10 @@ void kmmint_exit_plugin(kmm_plugin_i * p) {
}
/* The plugin is in an error state. We need to keep the plugin
- record in tact so that the failure information is kept
- around. */
- if (p->state < KMM_PLUGIN_STATE_NONE) {
+ record intact so that the failure information is kept around.
+ Also, we shouldn't release the plugin if it appears that
+ kmmint_init_plugin() was never called for it. */
+ if (p->state < KMM_PLUGIN_STATE_HOLD) {
release_plugin = FALSE;
}
@@ -602,6 +604,13 @@ void kmmint_init_module(kmm_module_i * m) {
kmm_hold_module(kmm_handle_from_module(m));
+ /* If the module is not in the pre-init state, we can't
+ initialize it. */
+ if(m->state != KMM_MODULE_STATE_PREINIT) {
+ _report_mr1(KHERR_INFO, MSG_IM_NOT_PREINIT, _int32(m->state));
+ goto _exit;
+ }
+
if(KHM_FAILED(kmm_get_modules_config(0, &csp_mods))) {
_report_mr0(KHERR_ERROR, MSG_IM_GET_CONFIG);
_location(L"kmm_get_modules_config()");
@@ -613,13 +622,6 @@ void kmmint_init_module(kmm_module_i * m) {
khc_read_int32(csp_mods, L"ModuleMaxFailureCount", &max_fail_count);
khc_read_int64(csp_mods, L"ModuleFailureCountResetTime", &fail_reset_time);
- /* If the module is not in the pre-init state, we can't
- initialize it. */
- if(m->state != KMM_MODULE_STATE_PREINIT) {
- _report_mr1(KHERR_INFO, MSG_IM_NOT_PREINIT, _int32(m->state));
- goto _exit;
- }
-
if(KHM_FAILED(kmm_get_module_config(m->name, 0, &csp_mod))) {
_report_mr0(KHERR_ERROR, MSG_IM_NOT_REGISTERED);
diff --git a/src/windows/identity/kmm/kmmmain.c b/src/windows/identity/kmm/kmmmain.c
index e54dd6de2..49384ccdb 100644
--- a/src/windows/identity/kmm/kmmmain.c
+++ b/src/windows/identity/kmm/kmmmain.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 Massachusetts Institute of Technology
+ * Copyright (c) 2007 Secure Endpoints Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -117,9 +118,10 @@ KHMEXP void KHMAPI kmm_exit(void)
LeaveCriticalSection(&cs_kmm);
WaitForSingleObject(evt_exit, INFINITE);
- EnterCriticalSection(&cs_kmm);
- kmq_post_thread_quit_message(tid_registrar, 0, NULL);
+ kmq_send_thread_quit_message(tid_registrar, 0);
+
+ EnterCriticalSection(&cs_kmm);
hash_del_hashtable(hash_plugins);
hash_del_hashtable(hash_modules);