On 11/08/2013 01:26 AM, Eliezer Croitoru wrote: > > I want to try to use policyd with a logic rule of: > "allow sasl authenticated users to send only 60 emails per 3600 seconds". > I have tried to do that in the past but I am not sure if I did > something wrong. > (If there is an exact list of things I better get then I want it.) > This is the policies from mysql and the debug output: >
..snip.. > Use of uninitialized value in multiplication (*) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 177, <$read> > line 21. > Use of uninitialized value in subtraction (-) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 182, <$read> > line 21. > Use of uninitialized value in multiplication (*) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 177, <$read> > line 21. > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 253, <$read> > line 21. > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 310, <$read> > line 21. > [2013/11/07-14:02:06 - 20640] [CORE] INFO: module=Quotas, mode=update, > host=192.168.10.108, helo=[192.168.10.108], [email protected], > [email protected], reason=quota_update, policy=2, quota=4, > limit=5, track=SASLUsername:[email protected], > counter=MessageCount, quota=2.00/2 (100.0%) > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 253, <$read> > line 21. > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 253, <$read> > line 21. > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 310, <$read> > line 21. > Use of uninitialized value in addition (+) at > /usr/local/lib/policyd-2.0/cbp/modules/Quotas.pm line 310, <$read> > line 21. > [2013/11/07-14:02:06 - 20640] [CORE] INFO: module=Quotas, mode=update, > host=192.168.10.108, helo=[192.168.10.108], [email protected], > [email protected], reason=quota_update, policy=2, quota=4, > limit=5, track=SASLUsername:[email protected], > counter=MessageCount, quota=0.00/2 (0.0%) Can you try the attached patch and let me now if it solves your problem? -N
>From be3c7115acd274bb59d45ffe4719e69632cc1e35 Mon Sep 17 00:00:00 2001 From: Nigel Kukard <[email protected]> Date: Fri, 8 Nov 2013 08:20:59 +0000 Subject: [PATCH] Ensure that Counter cannot be NULL Change-Id: I5b06bf9efc2fe6c4fe811da4686c834fa1375f8e Signed-off-by: Nigel Kukard <[email protected]> --- cbp/modules/Quotas.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cbp/modules/Quotas.pm b/cbp/modules/Quotas.pm index ae2bc3d..606243d 100644 --- a/cbp/modules/Quotas.pm +++ b/cbp/modules/Quotas.pm @@ -699,6 +699,11 @@ sub getTrackingInfo my $row = hashifyLCtoMC($sth->fetchrow_hashref(), qw( QuotasLimitsID TrackKey Counter LastUpdate )); DBFreeRes($sth); + # Make sure Counter isn't 0 + if (!defined($row->{'Counter'})) { + $row->{'Counter'} = 0; + } + return $row; } -- 1.8.4.rc3
_______________________________________________ Users mailing list [email protected] http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org
