ldap problem

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
 
A

anno4000

Elmar said:
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 that all it says? That message usually follows another one
that specifies the "import error".

Line 8 of .../Net/LDAP/Bind.pm is in my version (line broken):

use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS
LDAP_DECODING_ERROR LDAP_SUCCESS);

So you'd would have to find out what goes wrong in these particular
calls. Normally one would expect this statement either to work
or not. Occasional failure is strange, but who knows how exim
calls your Perl.

Is ther somthin wrong with my code?

[snip]

That's too much code to check manually.

Anno
 
E

Elmar

use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS
LDAP_DECODING_ERROR LDAP_SUCCESS);

What does this mean? Will it give me a more detailed error message?
Should i replace my "use Net::LDAP" with that?

Elmar
 
A

anno4000

Elmar said:
What does this mean? Will it give me a more detailed error message?
Should i replace my "use Net::LDAP" with that?

It is (probably) the line that caused the error. It belongs to the
source code of Net::LDAP and I only quoted it to show what's happening
when the error occurs. It is *not* meant to be used by you in your
code.

To be sure, you'd have to look up the source line (8, IIRC) in
..../Net/LDAP/Bind.pm on the machine where this is happening.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top