]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
reputation: don't give error if config is missing/commented out
authorVictor Julien <victor@inliniac.net>
Tue, 20 Nov 2012 14:40:15 +0000 (15:40 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 20 Nov 2012 14:40:15 +0000 (15:40 +0100)
src/reputation.c

index 5941ae8274410846a45e3538467f60487c096744..02e41b14a0176cb9ee1a3136ea9da705d74c6527 100644 (file)
@@ -419,20 +419,25 @@ int SRepInit(DetectEngineCtx *de_ctx) {
         init = 1;
     }
 
-    if (init) {
-        if (ConfGet("reputation-categories-file", &filename) != 1) {
-            SCLogError(SC_ERR_NO_REPUTATION, "\"reputation-categories-file\" not set");
-            return -1;
-        }
+    /* if both settings are missing, we assume the user doesn't want ip rep */
+    (void)ConfGet("reputation-categories-file", &filename);
+    files = ConfGetNode("reputation-files");
+    if (filename == NULL && files == NULL) {
+        SCLogInfo("IP reputation disabled");
+        return 0;
     }
 
-    files = ConfGetNode("reputation-files");
     if (files == NULL) {
         SCLogError(SC_ERR_NO_REPUTATION, "\"reputation-files\" not set");
         return -1;
     }
 
     if (init) {
+        if (filename == NULL) {
+            SCLogError(SC_ERR_NO_REPUTATION, "\"reputation-categories-file\" not set");
+            return -1;
+        }
+
         /* init even if we have reputation files, so that when we
          * have a live reload, we have inited the cats */
         if (SRepLoadCatFile(filename) < 0) {