From c7c8b70c1cc03abbcc7ceb4ee38d9ff18f793ff1 Mon Sep 17 00:00:00 2001 From: Nigel Kukard <nkukard@lbsd.net> Date: Tue, 22 Oct 2013 17:10:54 +0000 Subject: [PATCH] Reject adding a user to the default pool class --- opentrafficshaper/plugins/configmanager.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/opentrafficshaper/plugins/configmanager.pm b/opentrafficshaper/plugins/configmanager.pm index 9456a46..d8b5066 100644 --- a/opentrafficshaper/plugins/configmanager.pm +++ b/opentrafficshaper/plugins/configmanager.pm @@ -1227,24 +1227,30 @@ sub _process_limit_change $limitChange->{'IP'} = $limit->{'IP'}; # Check group is OK if (!defined($limitChange->{'GroupID'} = checkGroupID($limit->{'GroupID'}))) { - $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '".$limit->{'Username'}."' as the GroupID is invalid."); + $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '%s' as the GroupID is invalid.",$limit->{'Username'}); return; } # Check interface group ID is OK if (!defined($limitChange->{'InterfaceGroupID'} = checkInterfaceGroupID($limit->{'InterfaceGroupID'}))) { - $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '".$limit->{'Username'}."' as the InterfaceGroupID is invalid."); + $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '%s' as the InterfaceGroupID is invalid.",$limit->{'Username'}); return; } # Check match priority is OK if (!defined($limitChange->{'MatchPriorityID'} = checkMatchPriorityID($limit->{'MatchPriorityID'}))) { - $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '".$limit->{'Username'}."' as the MatchPriorityID is invalid."); + $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '%s' as the MatchPriorityID is invalid.",$limit->{'Username'}); return; } # Check class is OK if (!defined($limitChange->{'ClassID'} = checkClassID($limit->{'ClassID'}))) { - $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '".$limit->{'Username'}."' as the ClassID is invalid."); + $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process limit change for '%s' as the ClassID is invalid.",$limit->{'Username'}); return; } + # Make sure things are not attached to the default pool + if (defined($config->{'default_pool'}) && $limitChange->{'ClassID'} eq $config->{'default_pool'}) { + $logger->log(LOG_WARN,"[CONFIGMANAGER] Cannot process limit for '%s' as the ClassID is the 'default_pool' ClassID.",$limit->{'Username'}); + return; + } + $limitChange->{'TrafficLimitTx'} = $limit->{'TrafficLimitTx'}; $limitChange->{'TrafficLimitRx'} = $limit->{'TrafficLimitRx'}; # Take base limits if we don't have any burst values set @@ -1273,7 +1279,7 @@ sub _process_limit_change # Check status is OK if (!($limitChange->{'Status'} = checkStatus($limit->{'Status'}))) { - $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process user change for '".$limit->{'Username'}."' as the Status is invalid."); + $logger->log(LOG_NOTICE,"[CONFIGMANAGER] Cannot process user change for '%s' as the Status is invalid.",$limit->{'Username'}); return; } -- GitLab