diff --git a/include/security/openpam.h b/include/security/openpam.h index dd29794..36dfbea 100644 --- a/include/security/openpam.h +++ b/include/security/openpam.h @@ -258,9 +258,6 @@ struct pam_module { char *path; pam_func_t func[PAM_NUM_PRIMITIVES]; void *dlh; - int refcount; - pam_module_t *prev; - pam_module_t *next; }; /* diff --git a/lib/openpam_load.c b/lib/openpam_load.c index 0cafc51..b6374f5 100644 --- a/lib/openpam_load.c +++ b/lib/openpam_load.c @@ -60,11 +60,8 @@ const char *_pam_sm_func_name[PAM_NUM_PRIMITIVES] = { "pam_sm_chauthtok" }; -static pam_module_t *modules; - /* - * Locate a matching dynamic or static module. Keep a list of previously - * found modules to speed up the process. + * Locate a matching dynamic or static module. */ pam_module_t * @@ -72,12 +69,6 @@ openpam_load_module(const char *path) { pam_module_t *module; - /* check cache first */ - for (module = modules; module != NULL; module = module->next) - if (strcmp(module->path, path) == 0) - goto found; - - /* nope; try to load */ module = openpam_dynamic(path); openpam_log(PAM_LOG_DEBUG, "%s dynamic %s", (module == NULL) ? "no" : "using", path); @@ -94,14 +85,6 @@ openpam_load_module(const char *path) openpam_log(PAM_LOG_ERROR, "no %s found", path); return (NULL); } - openpam_log(PAM_LOG_DEBUG, "adding %s to cache", module->path); - module->next = modules; - if (module->next != NULL) - module->next->prev = module; - module->prev = NULL; - modules = module; - found: - ++module->refcount; return (module); } @@ -116,25 +99,10 @@ openpam_release_module(pam_module_t *module) { if (module == NULL) return; - --module->refcount; - if (module->refcount > 0) - /* still in use */ - return; - if (module->refcount < 0) { - openpam_log(PAM_LOG_ERROR, "module %s has negative refcount", - module->path); - module->refcount = 0; - } if (module->dlh == NULL) /* static module */ return; dlclose(module->dlh); - if (module->prev != NULL) - module->prev->next = module->next; - if (module->next != NULL) - module->next->prev = module->prev; - if (module == modules) - modules = module->next; openpam_log(PAM_LOG_DEBUG, "releasing %s", module->path); FREE(module->path); FREE(module);