lookup_info **lookup_list;
int lookup_list_count = 0;
+static int lookup_list_init_done = 0;
+
/* Table of information about all possible authentication mechamisms. All
entries are always present if any mechanism is declared, but the functions are
set to NULL for those that are not compiled into the binary. */
int moduleerrors = 0;
struct lookupmodulestr *p;
+ if (lookup_list_init_done)
+ return;
+ lookup_list_init_done = 1;
+
#if defined(LOOKUP_CDB) && LOOKUP_CDB!=2
extern lookup_module_info cdb_lookup_module_info;
addlookupmodule(NULL, &cdb_lookup_module_info);
#ifdef LOOKUP_MODULE_DIR
dd = opendir(LOOKUP_MODULE_DIR);
if (dd == NULL) {
- DEBUG(5) debug_printf("Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR);
+ DEBUG(D_lookup) debug_printf("Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR);
log_write(0, LOG_MAIN, "Couldn't open %s: not loading lookup modules\n", LOOKUP_MODULE_DIR);
}
else {
- DEBUG(9) debug_printf("Loading lookup modules from %s\n", LOOKUP_MODULE_DIR);
+ DEBUG(D_lookup) debug_printf("Loading lookup modules from %s\n", LOOKUP_MODULE_DIR);
while ((ent = readdir(dd)) != NULL) {
char *name = ent->d_name;
int len = (int)strlen(name);
continue;
}
+ /* FreeBSD nsdispatch() can trigger dlerror() errors about
+ * _nss_cache_cycle_prevention_function; we need to clear the dlerror()
+ * state before calling dlsym(), so that any error afterwards only
+ * comes from dlsym().
+ */
+ errormsg = dlerror();
+
info = (struct lookup_module_info*) dlsym(dl, "_lookup_module_info");
if ((errormsg = dlerror()) != NULL) {
fprintf(stderr, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
}
addlookupmodule(dl, info);
- DEBUG(9) debug_printf("Loaded \"%s\" (%d lookup types)\n", name, info->lookupcount);
+ DEBUG(D_lookup) debug_printf("Loaded \"%s\" (%d lookup types)\n", name, info->lookupcount);
countmodules++;
}
}
closedir(dd);
}
- DEBUG(9) debug_printf("Loaded %d lookup modules\n", countmodules);
+ DEBUG(D_lookup) debug_printf("Loaded %d lookup modules\n", countmodules);
#endif
store_free((void*)regex_islookupmod);
- DEBUG(4) debug_printf("Total %d lookups\n", lookup_list_count);
+ DEBUG(D_lookup) debug_printf("Total %d lookups\n", lookup_list_count);
lookup_list = store_malloc(sizeof(lookup_info *) * lookup_list_count);
memset(lookup_list, 0, sizeof(lookup_info *) * lookup_list_count);