More logs in greylister... need tests.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 15 Sep 2008 16:23:12 +0000 (18:23 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 15 Sep 2008 16:23:12 +0000 (18:23 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
postlicyd/filter.c
postlicyd/greylist.c
postlicyd/main-postlicyd.c

index aadc58c..7b0dee3 100644 (file)
@@ -49,7 +49,7 @@ filter_type_t filter_register(const char *type, filter_constructor_t constructor
     filter_token tok = filter_tokenize(type, m_strlen(type));
     CHECK_FILTER(tok);
 
-    syslog(LOG_INFO, "filter type %s registered", type);
+    syslog(LOG_DEBUG, "filter type %s registered", type);
 
     runners[tok] = runner;
     constructors[tok] = constructor;
@@ -64,7 +64,7 @@ filter_result_t filter_hook_register(filter_type_t filter,
     CHECK_FILTER(filter);
     CHECK_HOOK(tok);
 
-    syslog(LOG_INFO, "hook %s registered for filter type %s", name,
+    syslog(LOG_DEBUG, "hook %s registered for filter type %s", name,
            ftokens[filter]);
 
     hooks[filter][tok] = true;
index 108b02b..b5dcb7b 100644 (file)
@@ -78,8 +78,8 @@ static bool greylist_initialize(greylist_config_t *config,
         if (!tcbdbopen(config->awl_db, path, BDBOWRITER | BDBOCREAT)) {
             tcbdbdel(config->awl_db);
             config->awl_db = NULL;
+            return false;
         }
-        return false;
     }
 
     snprintf(path, sizeof(path), "%s/%sgreylist.db", directory, prefix);
@@ -216,6 +216,7 @@ static bool try_greylist(const greylist_config_t *config,
 
             /* OK.
              */
+            syslog(LOG_INFO, "client whitelisted");
             return true;
         }
     }
@@ -259,11 +260,13 @@ static bool try_greylist(const greylist_config_t *config,
 
         /* OK
          */
+        syslog(LOG_INFO, "client whitelisted");
         return true;
     }
 
     /* DUNNO
      */
+    syslog(LOG_INFO, "client greylisted");
     return false;
 }
 
index ad61029..a4241ff 100644 (file)
@@ -277,6 +277,10 @@ int main(int argc, char *argv[])
         || start_listener(port) < 0) {
         return EXIT_FAILURE;
     }
-    return server_loop(query_starter, (delete_client_t)query_delete,
-                       policy_run, NULL);
+    {
+        int res = server_loop(query_starter, (delete_client_t)query_delete,
+                              policy_run, config);
+        config_delete(&config);
+        return res;
+    }
 }