steffen: server/perl-kolab/Kolab-LDAP LDAP.pm,1.19,1.20
cvs at intevation.de
cvs at intevation.de
Sat Sep 4 14:17:14 CEST 2004
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab-LDAP
In directory doto:/tmp/cvs-serv3189/Kolab-LDAP
Modified Files:
LDAP.pm
Log Message:
handle issue 374
Index: LDAP.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-LDAP/LDAP.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- LDAP.pm 31 Aug 2004 14:37:55 -0000 1.19
+++ LDAP.pm 4 Sep 2004 12:17:12 -0000 1.20
@@ -107,17 +107,19 @@
$ip,
port => $pt,
version => 3,
- timeout => 5,
+ timeout => 20,
async => $as,
- verify => 'none'
+ verify => 'none',
+ onerror => 'undef'
);
} else {
$ldap = Net::LDAP->new(
$ip,
port => $pt,
version => 3,
- timeout => 5,
+ timeout => 20,
async => $as,
+ onerror => 'undef'
);
}
if (!$ldap) {
@@ -318,14 +320,21 @@
my $masterldap = Net::LDAP->new(
$uri,
version => 3,
- timeout => 5,
- verify => 'none');
- my $mesg = $masterldap->bind(
- $Kolab::config{'bind_dn'},
- password => $Kolab::config{'bind_pw'});
- if ($mesg->code) {
- Kolab::log('L', "Unable to bind to `$uri', LDAP Error = `"
- .$mesg->error."'", KOLAB_ERROR);
+ timeout => 20,
+ verify => 'none',
+ onerror => 'undef' );
+ if( defined( $masterldap ) ) {
+ my $mesg = $masterldap->bind(
+ $Kolab::config{'bind_dn'},
+ password => $Kolab::config{'bind_pw'});
+ if ($mesg->code) {
+ Kolab::log('L', "Unable to bind to `$uri', LDAP Error = `"
+ .$mesg->error."'", KOLAB_ERROR);
+ undef( $masterldap );
+ }
+ } else {
+ Kolab::log('L', "Unable to connect to `$uri'"
+ , KOLAB_ERROR);
}
return $masterldap;
}
@@ -353,6 +362,11 @@
} else {
$masterldap = createMasterLDAP;
}
+ if( !defined( $masterldap ) ) {
+ # Problem here, could not connect to master!
+ Kolab::log('L', "Unable to remove DN `$dn', master LDAP server not available", KOLAB_WARN);
+ return 0;
+ }
if( ref($del) eq 'ARRAY' && scalar(@$del) == 1 ) {
# Ok we are the last one...
Kolab::log('L', "Removing DN `$dn'");
@@ -393,7 +407,7 @@
# system("rm -rf \"$fbdir\"" );
# }
delete $uid_db{$guid};
- return;
+ return 1;
}
sub sync
More information about the commits
mailing list