E
Elmar
Hi i wrote a script for our exim mailserver which ask a MS AD Server
if he has an account with that mailaddress. It work good but sometimes
i see some errors in the eximlog like:
"Can't continue after import errors
at /usr/lib/perl5/vendor_perl/5.8.5/Net/LDAP/Bind.pm line 8"
Is ther somthin wrong with my code?
Here is the sample where the error happens.
All variables where set.
##############
unless ( $ldapBind = Net::LDAP->new( $ldapserver1, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver2, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver3, timeout => 3 ) ) {
# if no LDAP Server is reachable return true and exit
Exim::log_write("#ERROR!! No LDAP server available");
return "true";
}
}
}
$ldapBind->bind( dn => $LDAP_MTA_DN, password => $LDAP_MTA_PASS );
######### Step 1 #########
$RCPT = "$RCPT_Local" . "\@" . "$RCPT_Domain";
$searchPattern = "proxyAddresses=smtp:" . "$RCPT";
@args = (
base => $searchDN,
filter => "(&(objectclass=user)($searchPattern))",
control => [$page],
);
while (1) {
$ldapRCPT = $ldapBind->search(@args);
$ldapRCPT->code and last;
my ($resp) = $ldapRCPT->control(LDAP_CONTROL_PAGED) or last;
$cookie = $resp->cookie or last;
$page->cookie($cookie);
}
if ($cookie) {
$page->cookie($cookie);
$page->size(0);
$ldapBind->search(@args);
}
# close connection
$ldapBind->unbind();
if ( $ldapRCPT->code ) {
Exim::log_write("!! ERROR!! Promblem with LDAP search");
return "true";
}
if ( $ldapRCPT->count > " 0 " ) {
return = "true";
}
else {
return = "false";
}
Thanks Elmar
if he has an account with that mailaddress. It work good but sometimes
i see some errors in the eximlog like:
"Can't continue after import errors
at /usr/lib/perl5/vendor_perl/5.8.5/Net/LDAP/Bind.pm line 8"
Is ther somthin wrong with my code?
Here is the sample where the error happens.
All variables where set.
##############
unless ( $ldapBind = Net::LDAP->new( $ldapserver1, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver2, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver3, timeout => 3 ) ) {
# if no LDAP Server is reachable return true and exit
Exim::log_write("#ERROR!! No LDAP server available");
return "true";
}
}
}
$ldapBind->bind( dn => $LDAP_MTA_DN, password => $LDAP_MTA_PASS );
######### Step 1 #########
$RCPT = "$RCPT_Local" . "\@" . "$RCPT_Domain";
$searchPattern = "proxyAddresses=smtp:" . "$RCPT";
@args = (
base => $searchDN,
filter => "(&(objectclass=user)($searchPattern))",
control => [$page],
);
while (1) {
$ldapRCPT = $ldapBind->search(@args);
$ldapRCPT->code and last;
my ($resp) = $ldapRCPT->control(LDAP_CONTROL_PAGED) or last;
$cookie = $resp->cookie or last;
$page->cookie($cookie);
}
if ($cookie) {
$page->cookie($cookie);
$page->size(0);
$ldapBind->search(@args);
}
# close connection
$ldapBind->unbind();
if ( $ldapRCPT->code ) {
Exim::log_write("!! ERROR!! Promblem with LDAP search");
return "true";
}
if ( $ldapRCPT->count > " 0 " ) {
return = "true";
}
else {
return = "false";
}
Thanks Elmar