From d82c26b8138b3776cf710018403b6c1b60049bce Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 8 Jan 2015 10:49:54 +0100 Subject: [PATCH] Add warning when user acl is REQUIRED but still contains users --- src/acl/UserData.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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)); } } -- 2.47.3