Attached patch that should resolve the issue when policyd is called in a
state other than RCPT.
Index: cbpolicyd
===================================================================
--- cbpolicyd	(revision 251)
+++ cbpolicyd	(working copy)
@@ -395,8 +395,7 @@
 
 	# Data mangling...
 	$request->{'sender'} = lc($request->{'sender'});
-	$request->{'recipient'} = lc($request->{'recipient'});
-	$request->{'recipient'} = lc($request->{'recipient'});
+	$request->{'recipient'} = lc($request->{'recipient'}) if (defined($request->{'recipient'}));
 	$request->{'sasl_username'} = lc($request->{'sasl_username'}) if (defined($request->{'sasl_username'}));
 
 	# Internal data
Index: cbp/protocols/Postfix.pm
===================================================================
--- cbp/protocols/Postfix.pm	(revision 251)
+++ cbp/protocols/Postfix.pm	(working copy)
@@ -212,27 +212,34 @@
 	
 
 	# Check params
+	if (!defined($request->{'protocol_state'})) {
+		$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'protocol_state' must be defined") if ($log);
+		return "required parameter 'protocol_state' was not found";
+	}
+
 	if (!defined($request->{'client_address'}) || !($request->{'client_address'} =~ /^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/) ) {
 		$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'client_address' cannot be ".
-			defined($request->{'client_address'}) ? "'".$request->{'client_address'}."'" : "undef") if ($log);
+				defined($request->{'client_address'}) ? "'".$request->{'client_address'}."'" : "undef") if ($log);
 		return "required parameter 'client_address' was not found or invalid format";
 	}
 
 	if (!defined($request->{'sender'}) || !($request->{'sender'} =~ /^(?:[EMAIL PROTECTED]|)$/) ) {
 		$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'sender' cannot be ".
-			defined($request->{'sender'}) ? "'".$request->{'sender'}."'" : "undef") if ($log);
+				defined($request->{'sender'}) ? "'".$request->{'sender'}."'" : "undef") if ($log);
 		return "required parameter 'sender' was not found or invalid format";
 	}
 
-	if (!defined($request->{'recipient'}) || !($request->{'recipient'} =~ /[EMAIL PROTECTED]/) ) {
-		$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'recipient' cannot be ".
-			defined($request->{'recipient'}) ? "'".$request->{'recipient'}."'" : "undef") if ($log);
-		return "required parameter 'recipient' was not found or invalid format";
+	if ($request->{'protocol_state'} eq "RCPT") {
+		if (!defined($request->{'recipient'}) || !($request->{'recipient'} =~ /[EMAIL PROTECTED]/) ) {
+			$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'recipient' cannot be ".
+					defined($request->{'recipient'}) ? "'".$request->{'recipient'}."'" : "undef") if ($log);
+			return "required parameter 'recipient' was not found or invalid format";
+		}
 	}
 
 	if (!defined($request->{'instance'}) || $request->{'instance'} eq "") {
 		$server->log(LOG_ERR,"[PROTOCOLS/Postfix] Error, parameter 'instance' cannot be ".
-			defined($request->{'instance'}) ? "'".$request->{'instance'}."'" : "undef") if ($log);
+				defined($request->{'instance'}) ? "'".$request->{'instance'}."'" : "undef") if ($log);
 		return "required parameter 'instance' was not found or invalid format";
 	}
 }

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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
policyd-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/policyd-users

Reply via email to