steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr kolabfilter.php.in, 1.12, 1.13
cvs at kolab.org
cvs at kolab.org
Wed Mar 28 04:00:20 CEST 2007
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv23421/kolab-resource-handlers/resmgr
Modified Files:
kolabfilter.php.in
Log Message:
handle From rewriting slightly different when sender is not authenticated (issue954)
Index: kolabfilter.php.in
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/kolabfilter.php.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- kolabfilter.php.in 1 Nov 2006 09:20:45 -0000 1.12
+++ kolabfilter.php.in 28 Mar 2007 02:00:18 -0000 1.13
@@ -165,14 +165,23 @@
/** Returns the format string used to rewrite
the From header for untrusted messages */
-function get_untrusted_subject_insert()
+function get_untrusted_subject_insert($sasluser,$sender)
{
global $params;
- if( array_key_exists('untrusted_subject_insert', $params) ) {
- return $param['untrusted_subject_insert'];
+ if( $sasluser ) {
+ if( array_key_exists('untrusted_subject_insert', $params) ) {
+ $fmt = $param['untrusted_subject_insert'];
+ } else {
+ $fmt = "(UNTRUSTED, sender is <%s>)";
+ }
} else {
- return "(UNTRUSTED, sender is <%s>)";
+ if( array_key_exists('unauthenticated_subject_insert', $params) ) {
+ $fmt = $param['unauthenticated_subject_insert'];
+ } else {
+ $fmt = "(UNTRUSTED, sender <%s> is not authenticated)";
+ }
}
+ return sprintf($fmt,$sender);
}
/** Check that the From header is not trying
@@ -193,9 +202,7 @@
if( $client_addr == '127.0.0.1' ) return true;
$kolabhosts = split(',', $params['kolabhosts'] );
$kolabhosts = array_map( "gethostbyname", $kolabhosts );
- foreach( $kolabhosts as $ip ) {
- if( $client_addr == $ip ) return true;
- }
+ if( array_search( $client_addr, $kolabhosts ) !== false ) return true;
if( is_array($params['email_domain']) ) {
$domains = $params['email_domain'];
@@ -211,7 +218,7 @@
} else {
$allowed_addrs = false;
}
- $untrusted = sprintf(get_untrusted_subject_insert(), $sender);
+ $untrusted = get_untrusted_subject_insert($sasluser,$sender);
$adrs = imap_rfc822_parse_adrlist($fromhdr, $params['email_domain'][0]);
foreach ($adrs as $adr) {
$from = $adr->mailbox.'@'.$adr->host;
More information about the commits
mailing list