steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr kolabfilter.php, 1.11, 1.12

cvs at intevation.de cvs at intevation.de
Thu Dec 16 14:26:08 CET 2004


Author: steffen

Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv9187/kolab-resource-handlers/kolab-resource-handlers/resmgr

Modified Files:
	kolabfilter.php 
Log Message:
Fix for issue576 (including postfix patch)

Index: kolabfilter.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/kolabfilter.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- kolabfilter.php	13 Dec 2004 23:28:32 -0000	1.11
+++ kolabfilter.php	16 Dec 2004 13:26:06 -0000	1.12
@@ -46,7 +46,7 @@
 // Check that mail from our domains have trustable
 // From: header and that mail from the outside
 // does not impersonate any user from our domain
-function verify_sender( $sender, $from ) {
+function verify_sender( $sender, $from, $client_addr ) {
   global $params;
 
   $adrs = imap_rfc822_parse_adrlist($from, $params['email_domain']);
@@ -64,7 +64,8 @@
       if( $params['verify_subdomains'] ) {	
 	//myLog( "Checking if ".substr($senderdom, -strlen($domain)-1)." == .$domain", RM_LOG_DEBUG );
 	//myLog( "Checking if ".substr($fromdom, -strlen($domain)-1)." == .$domain", RM_LOG_DEBUG );
-	if( ($senderdom == $domain ||
+	if( $client_addr != '127.0.0.1' && 
+	    ($senderdom == $domain ||
 	     $fromdom   == $domain ||
 	     substr($senderdom, -strlen($domain)-1) == ".$domain" ||
 	     substr($fromdom, -strlen($domain)-1) == ".$domain" ) &&
@@ -83,7 +84,7 @@
   return true;
 }
 
-$options = getopt("s:r:");
+$options = getopt("s:r:c:");
 
 if (!array_key_exists('r', $options) || !array_key_exists('s', $options)) {
     fwrite(STDOUT, "Usage is $argv[0] -s sender at domain -r recip at domain\n");
@@ -92,8 +93,9 @@
 
 $sender = strtolower($options['s']);
 $recipient = strtolower($options['r']);
+$client_address = $options['c'];
 
-myLog("Kolabfilter starting up, sender=$sender, recipient=$recipient", RM_LOG_DEBUG);
+myLog("Kolabfilter starting up, sender=$sender, recipient=$recipient, client_address=$client_address", RM_LOG_DEBUG);
 
 $ical = false;
 $add_headers = array();
@@ -106,7 +108,7 @@
     $headers_done = true;
   } else if( $params['verify_from_header'] && eregi( '^From:(.*)', $line, $regs ) ) {
     $from = $regs[1];
-    if( !verify_sender( $sender, $from) ) {
+    if( !verify_sender( $sender, $from, $client_address) ) {
       myLog("Invalid From: header. $from does not match envelope $sender\n", RM_LOG_DEBUG);
       fwrite(STDOUT,"Invalid From: header. $from does not match envelope $sender\n");
       exit(EX_UNAVAILABLE);





More information about the commits mailing list