steffen: server/kolab/kolab kolab_smtpdpolicy,1.13,1.14
cvs at intevation.de
cvs at intevation.de
Mon Nov 15 12:18:20 CET 2004
Author: steffen
Update of /kolabrepository/server/kolab/kolab
In directory doto:/tmp/cvs-serv24466
Modified Files:
kolab_smtpdpolicy
Log Message:
Fix for Issue525 (delegate problem)
Index: kolab_smtpdpolicy
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/kolab_smtpdpolicy,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- kolab_smtpdpolicy 12 Aug 2004 10:55:39 -0000 1.13
+++ kolab_smtpdpolicy 15 Nov 2004 11:18:18 -0000 1.14
@@ -113,8 +113,8 @@
sub contains {
my $needle = lc(shift);
- my @haystack = shift;
- map { return 1 if $needle eq lc($_) } @haystack;
+ my $haystack = shift;
+ map { return 1 if $needle eq lc($_) } @$haystack;
return 0;
}
@@ -133,7 +133,7 @@
mylog($syslog_priority, "Checking sender=\"$sender\", recipient=\"$recip\", username=\"$username\", domains=".join(',', at conf_domain)." permithosts=".join(',', at conf_permithosts).", conf_allowunauth=$conf_allowunauth") if $verbose;
- #### This should probably be simplifed to
+ #### This should probably be simplifed to
#### reject sender <anything>@domain.tld if the user is
#### not authenticated
@@ -149,19 +149,30 @@
}
}
+ # Translate uid to mail:
+ my $mesg = $ldap->search( base=> $conf_basedn,
+ scope=> 'sub',
+ filter=> "(&(objectClass=kolabinetorgperson)(|(mail=$username)(uid=$username)))");
+ if( !$mesg->code && $mesg->count() > 0 ) {
+ mylog($syslog_priority, "LDAP search returned ".$mesg->count()." objects") if $verbose;
+ my $ldapobject = $mesg->entry(0);
+ $username = lc($ldapobject->get_value('mail'));
+ mylog($syslog_priority, "Translated username to $username") if $verbose;
+ }
# Check for allowed sender
CHECKSENDER:
- my $mesg = $ldap->search( base=> $conf_basedn,
+ $mesg = $ldap->search( base=> $conf_basedn,
scope=> 'sub',
filter=> "(&(objectClass=kolabinetorgperson)(|(mail=$sender)(alias=$sender)))");
if( !$mesg->code ) {
mylog($syslog_priority, "LDAP search returned ".$mesg->count()." objects") if $verbose;
foreach $ldapobject ($mesg->entries) {
mylog($syslog_priority, "Got object ".$ldapobject->get_value('uid') ) if $verbose;
+ mylog($syslog_priority, "Got delegates ".join(", ", @{$ldapobject->get_value('kolabdelegate', asref => 1 )})) if $verbose;
if( $username && ( lc($username) eq lc($ldapobject->get_value('uid')) ||
lc($username) eq lc($ldapobject->get_value('mail')) ||
- contains( $username, @{$ldapobject->get_value('kolabdelegate', asref => 1 )})) ) {
+ contains( $username, $ldapobject->get_value('kolabdelegate', asref => 1 ))) ) {
# All OK, user is sending as herself or as kolabdelegate
mylog($syslog_priority, "$username using valid from address $sender") if $verbose;
goto CHECKDISTLIST;
@@ -176,7 +187,7 @@
$sender =~ /(.*)@(.*)/;
my $domain = $2;
mylog($syslog_priority, "sender=$sender, domain=$domain") if $verbose;
- if( !contains( $domain, @conf_domain ) ) {
+ if( !contains( $domain, \@conf_domain ) ) {
# Ok
mylog($syslog_priority, "sending from other domains OK") if $verbose;
goto CHECKDISTLIST;
@@ -192,7 +203,7 @@
$recip =~ /(.*)@(.*)/;
my $cn = $1;
my $domain = $2;
- if( contains($domain, at conf_domain ) ) {
+ if( contains($domain,\@conf_domain ) ) {
$mesg = $ldap->search( base=> "cn=$cn,cn=internal,".$conf_basedn,
scope=> 'exact', filter=> "(objectClass=kolabgroupofnames)");
if( !$mesg->code && $mesg->count() > 0 ) {
More information about the commits
mailing list