Don't segfault if a preauth plugin module fails to load
authorKevin Coffman <kwc@citi.umich.edu>
Tue, 10 Oct 2006 20:52:34 +0000 (20:52 +0000)
committerKevin Coffman <kwc@citi.umich.edu>
Tue, 10 Oct 2006 20:52:34 +0000 (20:52 +0000)
Move the zeroing of the errinfo struct before the call to
krb5int_open_plugin_dirs() to prevent segfault in the case
where a plugin fails to load.  (For example if there are
unresolved symbols.)

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18671 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/kdc_preauth.c

index 936c9b6f31a8ff64e8782d562754a138369915d3..93bedf9c07993b8e5c38077b1c0831684480cc85 100644 (file)
@@ -305,6 +305,8 @@ load_preauth_plugins(krb5_context context)
     void *pa_sys_context;
     init_proc server_init_proc;
 
+    memset(&err, 0, sizeof(err));
+
     /* Attempt to load all of the preauth plugins we can find. */
     PLUGIN_DIR_INIT(&preauth_plugins);
     if (PLUGIN_DIR_OPEN(&preauth_plugins) == 0) {
@@ -315,7 +317,6 @@ load_preauth_plugins(krb5_context context)
     }
 
     /* Get the method tables provided by the loaded plugins. */
-    memset(&err, 0, sizeof(err));
     preauth_plugins_ftables = NULL;
     if (krb5int_get_plugin_dir_data(&preauth_plugins, "preauthentication0",
                                    &preauth_plugins_ftables, &err) != 0) {