diff options
author | Zhanna Tsitkov <tsitkova@mit.edu> | 2010-07-08 13:40:11 +0000 |
---|---|---|
committer | Zhanna Tsitkov <tsitkova@mit.edu> | 2010-07-08 13:40:11 +0000 |
commit | ce59ac4b606bcb0e573fd503107cfe4718408f53 (patch) | |
tree | 54e7ac93ecf4317e2c6ab44dc8b508d96767d51a | |
parent | f20bdd512468b94cb004afe64ebfd827ec9d6eaf (diff) | |
download | krb5-plugins.tar.gz |
Changed return types of the plugin related functions per "Plugin support improvements" Project Proposal review.plugins
Introduced plugin_version and removed plugin_id config attr.
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/plugins@24177 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/include/k5-int.h | 5 | ||||
-rw-r--r-- | src/kdc/enc_challenge.c | 16 | ||||
-rw-r--r-- | src/lib/kadm5/srv/server_misc.c | 16 | ||||
-rw-r--r-- | src/plugin_core/impl/plugin_default_loader.c | 2 | ||||
-rw-r--r-- | src/plugin_core/impl/plugin_default_manager.c | 55 | ||||
-rw-r--r-- | src/plugin_core/impl/plugin_default_manager.h | 2 | ||||
-rw-r--r-- | src/plugin_core/libplugin_core.exports | 3 | ||||
-rw-r--r-- | src/plugin_core/plugin_loader.c | 18 | ||||
-rw-r--r-- | src/plugin_core/plugin_loader.h | 4 | ||||
-rw-r--r-- | src/plugin_core/plugin_manager.c | 17 | ||||
-rw-r--r-- | src/plugin_core/plugin_manager.h | 8 | ||||
-rw-r--r-- | src/plugins/pwd_qlty/plugin_pwd_qlty.h | 8 | ||||
-rw-r--r-- | src/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c | 28 | ||||
-rw-r--r-- | src/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.c | 23 | ||||
-rw-r--r-- | src/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.c | 22 |
15 files changed, 105 insertions, 122 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h index e8b3e2efc..b58eafc5d 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -1426,8 +1426,9 @@ typedef struct _kdb5_dal_handle kdb5_dal_handle; struct _kdb_log_context; /* Plugin API ---- PLUGIN HANDLE */ +#define MAX_PL_NAME_LEN 64 typedef struct _plhandle{ - int plugin_id; + char plugin_name[MAX_PL_NAME_LEN]; void *api; struct _plhandle *next; } plhandle; @@ -1454,7 +1455,7 @@ typedef struct { void (*configure)(manager_data * data, const char*); void (*start)(manager_data * data); void (*stop)(manager_data * data); - plhandle (*getService)(manager_data * data, const char*, const int pl_id); + plhandle (*getService)(manager_data * data, const char*, const char pl_id[MAX_PL_NAME_LEN]); } plugin_manager; /* Plugin API ---- PLUGIN HANDLE ----- END*/ diff --git a/src/kdc/enc_challenge.c b/src/kdc/enc_challenge.c index 950bfd158..7b84f3582 100644 --- a/src/kdc/enc_challenge.c +++ b/src/kdc/enc_challenge.c @@ -10,7 +10,7 @@ int preauth_flags(krb5_context context, krb5_preauthtype pa_type) { int flags = 0; - plhandle handle = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); flags = plugin_preauth_flags(handle, context, pa_type); return flags; @@ -30,7 +30,7 @@ process_preauth(krb5_context context, void *plugin_context, krb5_pa_data ***out_padata) { krb5_error_code ret = 0; - plhandle handle = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); + plhandle handle ;//= plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); ret = plugin_process_preauth(handle, context, plugin_context, request_context, opt, @@ -52,7 +52,7 @@ kdc_include_padata(krb5_context context, krb5_kdc_req *request, void *pa_module_context, krb5_pa_data *data) { krb5_error_code retval = 0; - plhandle handle = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); retval = plugin_kdc_include_padata(handle, context, request, client, server, @@ -69,7 +69,7 @@ kdc_verify_preauth(krb5_context context, struct _krb5_db_entry_new *client, krb5_data **e_data, krb5_authdata ***authz_data) { krb5_error_code retval = 0; - plhandle handle = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); + plhandle handle ;//= plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); retval = plugin_kdc_verify_preauth(handle, context, client, req_pkt, request, enc_tkt_reply, data, @@ -89,7 +89,7 @@ kdc_return_preauth(krb5_context context, krb5_pa_data *padata, void *pa_module_context, void **pa_request_context) { krb5_error_code retval = 0; - plhandle handle = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(context->pl_manager, "plugin_pa", 0); retval = plugin_kdc_return_preauth(handle, context, padata, client, req_pkt, request, reply, @@ -106,7 +106,7 @@ server_free_reqctx(krb5_context kcontext, void **pa_request_context) { krb5_error_code retval = 0; - plhandle handle = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); retval = plugin_server_free_reqctx(handle, kcontext, pa_module_context, pa_request_context); @@ -116,14 +116,14 @@ krb5_error_code server_init(krb5_context kcontext, void **module_context, const char **realmnames) { krb5_error_code retval = 0; - plhandle handle = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); retval = plugin_server_init(handle, kcontext, module_context, realmnames); return retval; } void server_fini(krb5_context kcontext, void *module_context) { - plhandle handle = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); + plhandle handle;// = plugin_manager_get_service(kcontext->pl_manager, "plugin_pa", 0); plugin_server_fini(handle, kcontext, module_context); return; } diff --git a/src/lib/kadm5/srv/server_misc.c b/src/lib/kadm5/srv/server_misc.c index bccb68558..a423a2d4a 100644 --- a/src/lib/kadm5/srv/server_misc.c +++ b/src/lib/kadm5/srv/server_misc.c @@ -44,10 +44,6 @@ adb_policy_close(kadm5_server_handle_t handle) /* some of this is stolen from gatekeeper ... */ /* passwd_check - returns KADM5_OK if password passes the validation.*/ -#define PWD_QLTY_KRB 0 -#define PWD_QLTY_X 1 -#define PWD_QLTY_DYN 33 - kadm5_ret_t passwd_check(kadm5_server_handle_t srv_handle, char *password, int use_policy, kadm5_policy_ent_t pol, @@ -59,20 +55,20 @@ passwd_check(kadm5_server_handle_t srv_handle, if (srv_handle != NULL && srv_handle->context != NULL && srv_handle->context->pl_manager != NULL ){ - plugin_handle = plugin_manager_get_service(srv_handle->context->pl_manager, - "plugin_pwd_qlty", PWD_QLTY_KRB); + ret = plugin_manager_get_service(srv_handle->context->pl_manager, + "plugin_pwd_qlty", PWD_QLTY_KRB, &plugin_handle); ret = plugin_pwd_qlty_check(plugin_handle, srv_handle, password, use_policy, pol, principal); - plugin_handle = plugin_manager_get_service(srv_handle->context->pl_manager, - "plugin_pwd_qlty", PWD_QLTY_X); + ret = plugin_manager_get_service(srv_handle->context->pl_manager, + "plugin_pwd_qlty", PWD_QLTY_X, &plugin_handle); ret = plugin_pwd_qlty_check(plugin_handle, srv_handle, password, use_policy, pol, principal); - plugin_handle = plugin_manager_get_service(srv_handle->context->pl_manager, - "plugin_pwd_qlty", PWD_QLTY_DYN); + ret = plugin_manager_get_service(srv_handle->context->pl_manager, + "plugin_pwd_qlty", PWD_QLTY_DYN, &plugin_handle); ret = plugin_pwd_qlty_check(plugin_handle, srv_handle, password, use_policy, pol, principal); diff --git a/src/plugin_core/impl/plugin_default_loader.c b/src/plugin_core/impl/plugin_default_loader.c index 721fb2a40..ffb014bc5 100644 --- a/src/plugin_core/impl/plugin_default_loader.c +++ b/src/plugin_core/impl/plugin_default_loader.c @@ -17,8 +17,6 @@ static plugin_loader* _default_loader_instance = NULL; static plugin_descr plugin_default_loader_table[] = { {"plugin_pwd_qlty_X", plugin_pwd_qlty_X_create}, {"plugin_pwd_qlty_krb", plugin_pwd_qlty_krb_create}, - {"plugin_encrypted_challenge_pa", plugin_encrypted_challenge_pa_create}, - {"plugin_ldap_audit", NULL}, {NULL,NULL} }; diff --git a/src/plugin_core/impl/plugin_default_manager.c b/src/plugin_core/impl/plugin_default_manager.c index b43b5cc60..d4f8d0a11 100644 --- a/src/plugin_core/impl/plugin_default_manager.c +++ b/src/plugin_core/impl/plugin_default_manager.c @@ -122,7 +122,7 @@ _search_registry (registry_data* data, const char* api_name) } static plhandle -_create_api(const char* plugin_name, const char* plugin_id, +_create_api(const char* plugin_name, const char* loader_name, const char* loader_type, const char* loader_path /*, config_node* properties*/) { @@ -131,8 +131,7 @@ _create_api(const char* plugin_name, const char* plugin_id, #ifdef DEBUG_PLUGINS printf("plugins: _create_api\n"); #endif - p_handle = create_api(f_handle, plugin_name); - p_handle.plugin_id = atoi(plugin_id); + plugin_loader_create_api(f_handle, plugin_name, &p_handle); return(p_handle); } @@ -181,7 +180,7 @@ _register_api(registry_data* data, const char* api_name, next = (plhandle*) malloc(sizeof(plhandle)); memset(next, 0, sizeof(plhandle)); next->api = handle.api; - next->plugin_id = handle.plugin_id; + strncpy(next->plugin_name, handle.plugin_name, strlen(handle.plugin_name)); if(entry->first == NULL) { entry->first = next; entry->last = next; @@ -207,7 +206,6 @@ _configure_plugin_yaml(manager_data* mdata, config_node* plugin_node) const char* loader_path = NULL; const char* plugin_name = NULL; const char* plugin_type = NULL; - const char* plugin_id = NULL; plhandle handle; int ret = API_REGISTER_FAILED; @@ -227,8 +225,6 @@ _configure_plugin_yaml(manager_data* mdata, config_node* plugin_node) loader_path = q->node_value.str_value; } else if(strcmp(q->node_name, "plugin_name") == 0) { plugin_name = q->node_value.str_value; - } else if(strcmp(q->node_name, "plugin_id") == 0) { - plugin_id = q->node_value.str_value; } } @@ -244,11 +240,10 @@ _configure_plugin_yaml(manager_data* mdata, config_node* plugin_node) printf("plugin_name=%s\n", plugin_name); printf("plugin_type=%s\n", plugin_type); printf("plugin_path=%s\n", plugin_path); - printf("plugin_id=%s\n", plugin_id); printf("**End**\n"); #endif - handle = _create_api(plugin_name, plugin_id, + handle = _create_api(plugin_name, loader_name, loader_type, loader_path /*, properties*/); if(handle.api != NULL) { ret = _register_api(mdata->registry,plugin_api, plugin_type, handle); @@ -302,26 +297,18 @@ _configure_krb5(manager_data* data, const char* path) { manager_data* mdata = (manager_data*) data; krb5_error_code retval; - char *plugin; void *iter; int i = 0; profile_filespec_t *files = NULL; profile_t profile; const char *hierarchy[4]; - char **loader_name, **loader_type, **loader_path, **plugin_name, **plugin_type; - char** plugin_id; + char **loader_name, **loader_type, **loader_path, **plugin_name, **plugin_type, **plugin_version; char** plugin_api; char *f_path = NULL; plhandle handle; char **pl_list, *pl_l; retval = krb5_get_default_config_files(&files); -#if 0 - if (files) - free_filespecs(files); - if (retval) - ctx->profile = 0; -#endif if (retval == ENOENT) return; // KRB5_CONFIG_CANTOPEN; @@ -344,16 +331,6 @@ _configure_krb5(manager_data* data, const char* path) return; } -#if 0 - while (iter && pl_list[i]) { - if ((retval = krb5_plugin_iterator(profile, &iter, &plugin))) { - com_err("krb5_PLUGIN_iterator", retval, 0); - krb5_plugin_iterator_free(profile, &iter); - return; - } - if (plugin) { -#endif - i=0; while ((pl_l = pl_list[i++])){ @@ -362,7 +339,6 @@ _configure_krb5(manager_data* data, const char* path) #endif hierarchy[0] = "plugins"; hierarchy[1] = pl_l; - //hierarchy[1] = plugin; /* plugin_name */ hierarchy[2] = "plugin_api"; @@ -379,10 +355,10 @@ _configure_krb5(manager_data* data, const char* path) hierarchy[3] = 0; retval = profile_get_values(profile, hierarchy, &plugin_type); - /* plugin_id */ - hierarchy[2] = "plugin_id"; + /* plugin_version */ + hierarchy[2] = "plugin_version"; hierarchy[3] = 0; - retval = profile_get_values(profile, hierarchy, &plugin_id); + retval = profile_get_values(profile, hierarchy, &plugin_version); /* loader_name */ hierarchy[2] = "plugin_loader_name"; @@ -405,18 +381,17 @@ _configure_krb5(manager_data* data, const char* path) #ifdef DEBUG_PLUGINS - printf("ZH plugins: >>>\n"); + printf("plugins: >>>\n"); printf("api=%s\n", *plugin_api); printf("loader=%s\n", *loader_name); printf("loader_type=%s\n", *loader_type); if (f_path) printf("loader_path=%s\n", f_path); printf("plugin_name=%s\n", *plugin_name); printf("plugin_type=%s\n",*plugin_type); - printf("plugin_id=%s\n", *plugin_id); printf("<<< plugins\n"); #endif - handle = _create_api(*plugin_name, *plugin_id, + handle = _create_api(*plugin_name, *loader_name, *loader_type, f_path /*, properties*/); if(handle.api != NULL) { retval = _register_api(mdata->registry,*plugin_api, *plugin_type, handle); @@ -456,7 +431,7 @@ _stop(manager_data* data) } static plhandle -_getService(manager_data* data, const char* service_name, int plugin_id) +_getService(manager_data* data, const char* service_name, const char* plugin_name) { plhandle *handle; manager_data* mdata = (manager_data*) data; @@ -465,12 +440,12 @@ _getService(manager_data* data, const char* service_name, int plugin_id) memset(&handle, 0, sizeof handle); if(entry) { for(handle = entry->first; handle != NULL; handle = handle->next) { - if (handle->plugin_id == plugin_id) + if (!strncmp(handle->plugin_name, plugin_name, strlen(plugin_name))) break; } if (handle == NULL) { #ifdef DEBUG_PLUGINS - printf("service %s:%d is not registered \n", service_name, plugin_id); + printf("service %s:%s is not registered \n", service_name, plugin_name); #endif } @@ -493,7 +468,7 @@ _init_data() return data; } -plugin_manager* +krb5_error_code plugin_default_manager_get_instance(plugin_manager** plugin_mngr_instance) { plugin_manager* instance = NULL; @@ -519,5 +494,5 @@ plugin_default_manager_get_instance(plugin_manager** plugin_mngr_instance) instance->getService = _getService; *plugin_mngr_instance = instance; } - return (*plugin_mngr_instance); + return 0; } diff --git a/src/plugin_core/impl/plugin_default_manager.h b/src/plugin_core/impl/plugin_default_manager.h index 1df5c9ba4..f58b5773e 100644 --- a/src/plugin_core/impl/plugin_default_manager.h +++ b/src/plugin_core/impl/plugin_default_manager.h @@ -8,6 +8,6 @@ #include <plugin_manager.h> -plugin_manager* plugin_default_manager_get_instance(plugin_manager** plugin_mngr_instance); +krb5_error_code plugin_default_manager_get_instance(plugin_manager** plugin_mngr_instance); #endif /* PLUGIN_DEFAULT_MANAGER_H_ */ diff --git a/src/plugin_core/libplugin_core.exports b/src/plugin_core/libplugin_core.exports index a39a298d6..8c40d6a89 100644 --- a/src/plugin_core/libplugin_core.exports +++ b/src/plugin_core/libplugin_core.exports @@ -1,9 +1,8 @@ -get_loader_content plugin_manager_configure plugin_manager_get_service plugin_manager_start plugin_manager_stop -create_api +plugin_loader_create_api krb5_plugin_iterator_create krb5_plugin_iterator krb5_plugin_iterator_free diff --git a/src/plugin_core/plugin_loader.c b/src/plugin_core/plugin_loader.c index 3c0e2a0be..31ddb63bf 100644 --- a/src/plugin_core/plugin_loader.c +++ b/src/plugin_core/plugin_loader.c @@ -6,22 +6,12 @@ #include <string.h> #include "plugin_loader.h" -void -get_loader_content (loader_handle handle, const char* container[]) +krb5_error_code +plugin_loader_create_api (loader_handle handle, const char* plugin_name, plhandle *pl_handle) { plugin_loader* loader = (plugin_loader*) handle.api; if (loader != NULL) { - return loader->get_loader_content(container); + *pl_handle = loader->create_api(plugin_name); } - return; -} - -plhandle -create_api (loader_handle handle, const char* plugin_name) -{ - plugin_loader* loader = (plugin_loader*) handle.api; - if (loader != NULL) { - return loader->create_api(plugin_name); - } - return; + return 0; } diff --git a/src/plugin_core/plugin_loader.h b/src/plugin_core/plugin_loader.h index 867d84e6a..30afa52ab 100644 --- a/src/plugin_core/plugin_loader.h +++ b/src/plugin_core/plugin_loader.h @@ -27,8 +27,6 @@ typedef struct { plhandle (*create_api)(const char*); } plugin_loader; -/* Utility functions */ -void get_loader_content(loader_handle handle, const char* container[]); -plhandle create_api(loader_handle handle, const char* plugin_name); +krb5_error_code plugin_loader_create_api(loader_handle handle, const char* plugin_name, plhandle *); #endif /* PLUGIN_LOADER_H_ */ diff --git a/src/plugin_core/plugin_manager.c b/src/plugin_core/plugin_manager.c index 1e8480b04..7f2304408 100644 --- a/src/plugin_core/plugin_manager.c +++ b/src/plugin_core/plugin_manager.c @@ -5,7 +5,7 @@ #include "plugin_manager.h" #include <k5-int.h> -int +krb5_error_code plugin_manager_configure(plugin_manager* instance,const char* path) { if (instance != NULL) { @@ -14,22 +14,26 @@ plugin_manager_configure(plugin_manager* instance,const char* path) return 0; } -void plugin_manager_start(plugin_manager* instance) +krb5_error_code +plugin_manager_start(plugin_manager* instance) { if (instance != NULL) { instance->start(instance->data); } + return 0; } -void plugin_manager_stop(plugin_manager* instance) +krb5_error_code +plugin_manager_stop(plugin_manager* instance) { if (instance != NULL) { instance->stop(instance->data); } + return 0; } -plhandle -plugin_manager_get_service(plugin_manager* instance, const char* service_name, const int pl_id) +krb5_error_code +plugin_manager_get_service(plugin_manager* instance, const char* service_name, const char *pl_id, plhandle *pl_handle) { plhandle handle; if (instance != NULL) { @@ -37,5 +41,6 @@ plugin_manager_get_service(plugin_manager* instance, const char* service_name, c } else { handle.api = NULL; } - return handle; + *pl_handle = handle; + return 0; } diff --git a/src/plugin_core/plugin_manager.h b/src/plugin_core/plugin_manager.h index c386586e0..7be53cc07 100644 --- a/src/plugin_core/plugin_manager.h +++ b/src/plugin_core/plugin_manager.h @@ -8,9 +8,9 @@ #include <k5-int.h> -plhandle plugin_manager_get_service(plugin_manager* instance,const char*, const int); -int plugin_manager_configure(plugin_manager* instance,const char*); -void plugin_manager_start(plugin_manager* instance); -void plugin_manager_stop(plugin_manager* instance); +krb5_error_code plugin_manager_get_service(plugin_manager* instance,const char*, const char*, plhandle* ); +krb5_error_code plugin_manager_configure(plugin_manager* instance,const char*); +krb5_error_code plugin_manager_start(plugin_manager* instance); +krb5_error_code plugin_manager_stop(plugin_manager* instance); #endif /* PLUGIN_MANAGER_H_ */ diff --git a/src/plugins/pwd_qlty/plugin_pwd_qlty.h b/src/plugins/pwd_qlty/plugin_pwd_qlty.h index 4921be816..d27d89f84 100644 --- a/src/plugins/pwd_qlty/plugin_pwd_qlty.h +++ b/src/plugins/pwd_qlty/plugin_pwd_qlty.h @@ -11,9 +11,17 @@ #include <admin.h> #include <server_internal.h> +#define PWD_QLTY_KRB "plugin_pwd_qlty_krb" +#define PWD_QLTY_KRB_LEN 19 +#define PWD_QLTY_X "plugin_pwd_qlty_X" +#define PWD_QLTY_X_LEN 17 +#define PWD_QLTY_DYN "plugin_pwd_qlty_DYN" +#define PWD_QLTY_DYN_LEN 19 + /* PWD_QLTY API */ typedef struct { int version; + char plugin_id[MAX_PL_NAME_LEN]; kadm5_ret_t (*pwd_qlty_init)(kadm5_server_handle_t); void (*pwd_qlty_cleanup)(); kadm5_ret_t (*pwd_qlty_check)(kadm5_server_handle_t, char*, diff --git a/src/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c b/src/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c index 4f443ee6c..102340d91 100644 --- a/src/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c +++ b/src/plugins/pwd_qlty/plugin_pwd_qlty_DYN/plugin_pwd_qlty_DYN_impl.c @@ -16,9 +16,9 @@ _plugin_pwd_qlty_check(kadm5_server_handle_t srv_handle, { -//#ifdef DEBUG_PLUGINS - printf("Plugin pwd qlty DYNAMIC >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); -// #endif +#ifdef DEBUG_PLUGINS + printf("Plugin pwd qlty DYNAMIC >>\n"); +#endif return 0; } @@ -38,15 +38,19 @@ _plugin_pwd_qlty_clean() plhandle plugin_pwd_qlty_DYN_create() { - plhandle handle; - plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); + plhandle handle; + plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); - memset(api, 0, sizeof(plugin_pwd_qlty)); - api->version = 1; - api->pwd_qlty_init = _plugin_pwd_qlty_init; - api->pwd_qlty_check = _plugin_pwd_qlty_check; - api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; - handle.api = api; + memset(&handle, 0, sizeof(handle)); + strncpy(handle.plugin_name, PWD_QLTY_DYN, PWD_QLTY_DYN_LEN); - return handle; + memset(api, 0, sizeof(plugin_pwd_qlty)); + api->version = 1; + strncpy(api->plugin_id, PWD_QLTY_DYN, PWD_QLTY_DYN_LEN); + api->pwd_qlty_init = _plugin_pwd_qlty_init; + api->pwd_qlty_check = _plugin_pwd_qlty_check; + api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; + handle.api = api; + + return handle; } diff --git a/src/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.c b/src/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.c index eaf0871e2..2f72e4bf4 100644 --- a/src/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.c +++ b/src/plugins/pwd_qlty/plugin_pwd_qlty_X/plugin_pwd_qlty_X_impl.c @@ -157,15 +157,20 @@ _plugin_pwd_qlty_clean() plhandle plugin_pwd_qlty_X_create() { - plhandle handle; - plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); + plhandle handle; + plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); - memset(api, 0, sizeof(plugin_pwd_qlty)); - api->version = 1; - api->pwd_qlty_init = _plugin_pwd_qlty_init; - api->pwd_qlty_check = _plugin_pwd_qlty_check; - api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; - handle.api = api; + memset(&handle, 0, sizeof(handle)); + strncpy(handle.plugin_name, PWD_QLTY_X, PWD_QLTY_X_LEN); - return handle; + memset(api, 0, sizeof(plugin_pwd_qlty)); + api->version = 1; + strncpy(api->plugin_id, PWD_QLTY_X, PWD_QLTY_X_LEN); + api->pwd_qlty_init = _plugin_pwd_qlty_init; + api->pwd_qlty_check = _plugin_pwd_qlty_check; + api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; + handle.api = api; + + return handle; } + diff --git a/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.c b/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.c index 83f7a4152..48c5a452b 100644 --- a/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.c +++ b/src/plugins/pwd_qlty/plugin_pwd_qlty_krb/plugin_pwd_qlty_krb_impl.c @@ -157,15 +157,19 @@ _plugin_pwd_qlty_clean() plhandle plugin_pwd_qlty_krb_create() { - plhandle handle; - plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); + plhandle handle; + plugin_pwd_qlty* api = malloc(sizeof(plugin_pwd_qlty)); - memset(api, 0, sizeof(plugin_pwd_qlty)); - api->version = 1; - api->pwd_qlty_init = _plugin_pwd_qlty_init; - api->pwd_qlty_check = _plugin_pwd_qlty_check; - api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; - handle.api = api; + memset(&handle, 0, sizeof(handle)); + strncpy(handle.plugin_name, PWD_QLTY_KRB, PWD_QLTY_KRB_LEN); - return handle; + memset(api, 0, sizeof(plugin_pwd_qlty)); + api->version = 1; + strncpy(api->plugin_id, PWD_QLTY_KRB, PWD_QLTY_KRB_LEN); + api->pwd_qlty_init = _plugin_pwd_qlty_init; + api->pwd_qlty_check = _plugin_pwd_qlty_check; + api->pwd_qlty_cleanup = _plugin_pwd_qlty_clean; + handle.api = api; + + return handle; } |