Index: src/perl/ldapweb.cgi =================================================================== --- src/perl/ldapweb.cgi (revision 4844) +++ src/perl/ldapweb.cgi (revision 4845) @@ -674,30 +674,32 @@ #if main ldap server is down, a html file containing warning message will be returned debug("connecting to LDAP in findExistingAccounts with settings $ldapurl, $timeout"); $ldap = Net::LDAP->new($ldapurl, timeout => $timeout) or handleLDAPBindFailure($ldapurl); - $ldap->start_tls( verify => 'none'); - $ldap->bind( version => 3, anonymous => 1); - my $mesg = $ldap->search ( - base => $base, - filter => $filter, - attrs => @$attref, - ); + if ($ldap) { + $ldap->start_tls( verify => 'none'); + $ldap->bind( version => 3, anonymous => 1); + my $mesg = $ldap->search ( + base => $base, + filter => $filter, + attrs => @$attref, + ); - if ($mesg->count() > 0) { - $foundAccounts = ""; - my $entry; - foreach $entry ($mesg->all_entries) { - $foundAccounts .= "
\nAccount: ";
- $foundAccounts .= $entry->dn();
- $foundAccounts .= "
\n";
- foreach my $attribute ($entry->attributes()) {
- $foundAccounts .= "$attribute: ";
- $foundAccounts .= $entry->get_value($attribute);
- $foundAccounts .= "
\n";
- }
- $foundAccounts .= "
\nAccount: "
+ $foundAccounts .= $entry->dn();
+ $foundAccounts .= "
\n";
+ foreach my $attribute ($entry->attributes()) {
+ $foundAccounts .= "$attribute: ";
+ $foundAccounts .= $entry->get_value($attribute);
+ $foundAccounts .= "
\n";
+ }
+ $foundAccounts .= "