Hi,
hier die ganze Funktion.
Gruss
Rainer
sub localmailaddress {
my $h=shift;
my $retcode;
my $retmsg;
$h = $1 if $h=~/\@(.*)/;
### loggen
mlog($fh,"\$h = $h - \$1 = $1");
###
# do LDAP lookup
$current_email = "$1$h";
### Username
$current_user = $` if $1=~/\@/;
###
$ldapflt = $LDAPFilter;
$ldapflt =~ s/EMAILADDRESS/$current_email/g;
### EMAILNAME durch Username ersetzen
$ldapflt =~ s/EMAILNAME/$current_user/g;
###
print DEBUG "doing LDAP lookup with $ldapflt in $LDAPRoot\n" if $DEBUG;
@ldaplist = split(/\|/,$LDAPHost);
$ldaplist = [EMAIL PROTECTED];
$ldap = Net::LDAP->new( $ldaplist );
if(! $ldap) {
mlog($fh,"Couldn't contact LDAP server at $LDAPHost -- check ignored");
# seterror($fh,"451 Could not check recipient, try later\r\n",1);
return 1;
}
# bind to a directory anonymous or with dn and password
if ($LDAPLogin) {
$mesg = $ldap->bind($LDAPLogin,
password => $LDAPPassword
);
} else {
# mlog($fh,"LDAP anonymous bind");
$mesg = $ldap->bind;
}
$retcode = $mesg->code;
if ($retcode) {
# $retmsg=$mesg->error_text();
# mlog($fh,"LDAP bind error: $retcode - Login Problem?");
mlog($fh,"LDAP bind error: $retcode -- check ignored");
# seterror($fh,"451 Could not check recipient, try later\r\n",1);
return 1;
}
# perform a search
$mesg = $ldap->search( base => $LDAPRoot,
filter => $ldapflt,
attrs => ['cn']
);
$retcode = $mesg->code;
# mlog($fh,"LDAP search: $retcode");
if($retcode > 0) {
mlog($fh,"LDAP search error: $retcode -- check ignored");
#seterror($fh,"451 Could not check recipient, try later\r\n",1);
return 1;
}
$entry_count = $mesg->count;
$retmsg = $mesg->entry(1);
# mlog($fh,"LDAP Results: $entry_count : $retmsg");
###
mlog($fh,"LDAP Results: $entry_count : $retmsg : $ldapflt");
###
print DEBUG "got $entry_count result(s) from LDAP lookup\n" if $DEBUG;
$mesg = $ldap->unbind; # take down session
return $entry_count
}
Fritz Borgstedt schrieb:
> Questions and Answers for users of ASSP Anti-Spam SMTP Proxy
> <[email protected]> schreibt:
>> I have to say I'm no programmer but this works for me and may be
>> useful
>> for others.
>> So I hope this can be integrated somehow in the assp code.
>
> please send the complete part to me (sub localmailaddress)
>
> fb
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Assp-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/assp-user
>
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Assp-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-user