]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add warning when user acl is REQUIRED but still contains users
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 8 Jan 2015 09:49:54 +0000 (10:49 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 8 Jan 2015 09:49:54 +0000 (10:49 +0100)
src/acl/UserData.cc

index eab9560cad707c16318a85b0b95c1786d1c11b7c..95d497865e27577ac084c2a1b807ca0b7fb5a5c0 100644 (file)
@@ -13,6 +13,7 @@
 #include "acl/UserData.h"
 #include "ConfigParser.h"
 #include "Debug.h"
+#include "globals.h"
 #include "util.h"
 
 #include <algorithm>
@@ -78,6 +79,7 @@ void
 ACLUserData::parse()
 {
     debugs(28, 2, "parsing user list");
+    bool emitInvalidConfigWarning = true;
 
     char *t = NULL;
     if ((t = ConfigParser::strtokFile())) {
@@ -101,7 +103,10 @@ ACLUserData::parse()
                 Tolower(t);
 
             if (!flags.required) { // don't add new users if acl is REQUIRED
-                //TODO: emit one DBG_PARSE_NOTE warning about incorrect config
+                if (emitInvalidConfigWarning) {
+                    emitInvalidConfigWarning = false;
+                    debugs(28, DBG_PARSE_NOTE(2), "detected attempt to add usernames to an acl of type REQUIRED");
+                }
                 userDataNames.insert(SBuf(t));
             }
         }
@@ -119,7 +124,10 @@ ACLUserData::parse()
             Tolower(t);
 
         if (!flags.required) { // don't add new users if acl is REQUIRED
-            //TODO: emit one DBG_PARSE_NOTE warning about incorrect config
+            if (emitInvalidConfigWarning) {
+                emitInvalidConfigWarning = false;
+                debugs(28, DBG_PARSE_NOTE(2), "detected attempt to add usernames to an acl of type REQUIRED");
+            }
             userDataNames.insert(SBuf(t));
         }
     }