From: Francesco Chemolli Date: Thu, 8 Jan 2015 09:49:54 +0000 (+0100) Subject: Add warning when user acl is REQUIRED but still contains users X-Git-Tag: merge-candidate-3-v1~345^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d82c26b8138b3776cf710018403b6c1b60049bce;p=thirdparty%2Fsquid.git Add warning when user acl is REQUIRED but still contains users --- diff --git a/src/acl/UserData.cc b/src/acl/UserData.cc index eab9560cad..95d497865e 100644 --- a/src/acl/UserData.cc +++ b/src/acl/UserData.cc @@ -13,6 +13,7 @@ #include "acl/UserData.h" #include "ConfigParser.h" #include "Debug.h" +#include "globals.h" #include "util.h" #include @@ -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)); } }