Yo,

> > If you restart cbpolicyd and send one test message, does it trigger the
> > same result?
> 
> Well, now I put all other mails in the queue on hold and sent two
> testmails, one before restarting cbpolicyd and one after restarting the
> daemon.
> 
> The first mail got deferred:
> 
> > [2008/07/15-21:28:13 - 16354] [CORE] INFO: module=Quotas, mode=update, 
> > host=192.168.98.31, helo=automatix.seier.at, [EMAIL PROTECTED], [EMAIL 
> > PROTECTED], reason=quota_update, policy=6, quota=3, limit=4, 
> > track=Recipient:@qwws.net, counter=MessageCount, quota=6/25 (22.1%)
> > [2008/07/15-21:28:13 - 16354] [CORE] INFO: module=Quotas, action=none, 
> > host=192.168.98.31, helo=automatix.seier.at, [EMAIL PROTECTED], [EMAIL 
> > PROTECTED], reason=no_quota
> 
> > Jul 15 21:28:13 automatix postfix/smtp[18861]: 1187B12ECEB: to=<[EMAIL 
> > PROTECTED]>, relay=192.168.98.31[192.168.98.31]:2025, delay=20, 
> > delays=20/0/0/0.11, dsn=4.5.3, status=deferred (host 
> > 192.168.98.31[192.168.98.31] said: 452 4.5.3 <[EMAIL PROTECTED]>: Recipient 
> > address rejected: No more transactions for this domain allowed (in reply to 
> > RCPT TO command))
> 
> and the second one was immediately delivered:
> 
> > [2008/07/15-21:30:01 - 18884] [CORE] INFO: module=Quotas, mode=update, 
> > host=192.168.98.31, helo=automatix.seier.at, [EMAIL PROTECTED], [EMAIL 
> > PROTECTED], reason=quota_update, policy=6, quota=3, limit=4, 
> > track=Recipient:@qwws.net, counter=MessageCount, quota=6/25 (23.4%)
> > [2008/07/15-21:30:01 - 18884] [CORE] INFO: module=Quotas, action=none, 
> > host=192.168.98.31, helo=automatix.seier.at, [EMAIL PROTECTED], [EMAIL 
> > PROTECTED], reason=no_quota
> 
> > Jul 15 21:30:17 automatix postfix/smtp[18888]: C0C0112ECEB: to=<[EMAIL 
> > PROTECTED]>, relay=192.168.98.31[192.168.98.31]:2025, delay=19, 
> > delays=18/0/0/1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as DAE238530)
> 
> and the QuotasTracking table contains the following:
> 
> > mysql> select * from quotas_tracking where TrackKey like '%qwws.net%';
> > +----------------+-------------------------+------------+---------+
> > | QuotasLimitsID | TrackKey                | LastUpdate | Counter |
> > +----------------+-------------------------+------------+---------+
> > |              4 | Recipient:@qwws.net     | 1216150216 |  6.7615 |
> > |              1 | Recipient:[EMAIL PROTECTED] | 1215800105 |  2.0000 |
> > |              2 | Recipient:[EMAIL PROTECTED] | 1215800105 |  0.0000 |
> > +----------------+-------------------------+------------+---------+
> 
> any ideas? concurrency/multithreading/caching issues?
> well, the mailserver is under moderate load - about 6k messages in the
> queue...

My previous patch was b0rked ... this one introduces the fix for all
protocols, not just Postfix and will hopefully work.

-N
Index: cbpolicyd
===================================================================
--- cbpolicyd	(revision 261)
+++ cbpolicyd	(working copy)
@@ -381,6 +381,9 @@
 
 	# Set protocol handler
 	$server->{'_protocol_handler'} = $found;
+
+	# If we have a init function, call it before processing...
+	$server->{'_protocol_handler'}->{'protocol_init'}($self) if (defined($server->{'_protocol_handler'}->{'protocol_init'}));
 	
 	# Process buffer
 	my $request = $server->{'_protocol_handler'}->{'protocol_parse'}($self,$buf);
Index: cbp/protocols/Bizanga.pm
===================================================================
--- cbp/protocols/Bizanga.pm	(revision 261)
+++ cbp/protocols/Bizanga.pm	(working copy)
@@ -37,6 +37,7 @@
 	name 			=> "Bizanga Protocol Support Module",
 	init		 	=> \&init,
 	priority	 	=> 50,
+	protocol_init	=> \&protocol_init,
 	protocol_check	=> \&protocol_check,
 	protocol_parse	=> \&protocol_parse,
 	protocol_response	=> \&protocol_response,
@@ -68,6 +69,13 @@
 }
 
 
+# Initialize per request data...
+sub protocol_init {
+	$response = undef;
+	$response_data = undef;
+}
+
+
 # Check the buffer to see if this protocol is what we want
 sub protocol_check {
 	my ($server,$buffer) = @_;
Index: cbp/protocols/Postfix.pm
===================================================================
--- cbp/protocols/Postfix.pm	(revision 261)
+++ cbp/protocols/Postfix.pm	(working copy)
@@ -33,6 +33,7 @@
 	name 			=> "Postfix SMTP Access Delegation Protocol Suppot Module",
 	init		 	=> \&init,
 	priority	 	=> 50,
+	protocol_init	=> \&protocol_init,
 	protocol_check	=> \&protocol_check,
 	protocol_parse	=> \&protocol_parse,
 	protocol_response	=> \&protocol_response,
@@ -64,6 +65,13 @@
 }
 
 
+# Initialize per request data...
+sub protocol_init {
+	$response = undef;
+	$response_data = undef;
+}
+
+
 # Check the buffer to see if this protocol is what we want
 sub protocol_check {
 	my ($server,$buffer) = @_;

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
policyd-users mailing list
policyd-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/policyd-users

Reply via email to