Taint enforce: directory open backstops, single-key search filename
[exim.git] / src / src / drtables.c
index 578ddf3708e787d632dcbc28fa798e0d7abffd8b..f1053bbdae1cdacd775756d70ee25f3cd1054437 100644 (file)
@@ -718,7 +718,7 @@ addlookupmodule(NULL, &whoson_lookup_module_info);
 #endif
 
 #ifdef LOOKUP_MODULE_DIR
-if (!(dd = opendir(LOOKUP_MODULE_DIR)))
+if (!(dd = exim_opendir(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);
@@ -753,9 +753,10 @@ else
 
       if (!(dl = dlopen(CS big_buffer, RTLD_NOW)))
        {
-       fprintf(stderr, "Error loading %s: %s\n", name, dlerror());
+       errormsg = dlerror();
+       fprintf(stderr, "Error loading %s: %s\n", name, errormsg);
+       log_write(0, LOG_MAIN|LOG_PANIC, "Error loading lookup module %s: %s\n", name, errormsg);
        moduleerrors++;
-       log_write(0, LOG_MAIN|LOG_PANIC, "Error loading lookup module %s: %s\n", name, dlerror());
        continue;
        }
 
@@ -770,17 +771,17 @@ else
       if ((errormsg = dlerror()))
        {
        fprintf(stderr, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
+       log_write(0, LOG_MAIN|LOG_PANIC, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
        dlclose(dl);
        moduleerrors++;
-       log_write(0, LOG_MAIN|LOG_PANIC, "%s does not appear to be a lookup module (%s)\n", name, errormsg);
        continue;
        }
       if (info->magic != LOOKUP_MODULE_INFO_MAGIC)
        {
        fprintf(stderr, "Lookup module %s is not compatible with this version of Exim\n", name);
+       log_write(0, LOG_MAIN|LOG_PANIC, "Lookup module %s is not compatible with this version of Exim\n", name);
        dlclose(dl);
        moduleerrors++;
-       log_write(0, LOG_MAIN|LOG_PANIC, "Lookup module %s is not compatible with this version of Exim\n", name);
        continue;
        }