Fix an infinite loop in getting LDAP error messages. Fixes bug #11296
This commit is contained in:
parent
c845849da0
commit
7261ecd29d
4 changed files with 15 additions and 13 deletions
|
|
@ -2,6 +2,7 @@
|
|||
- fixed #11289: Gallery with pending version tag causes search engine indexer to puke.
|
||||
- fixed #11292: Search function limited to onje search?
|
||||
- fixed #11286: Workflow Instance deleted when reaching an Activity that fails to load
|
||||
- fixed #11296: listLDAPLinks op permissions problems
|
||||
|
||||
7.8.7
|
||||
- fixed #11278: Wrong test for Template::Toolkit in testEnvironment.pl
|
||||
|
|
|
|||
|
|
@ -107,9 +107,10 @@ sub connectToLDAP {
|
|||
$self->{_uri} = $uri;
|
||||
my $ldap = Net::LDAP->new($uri->host,
|
||||
port => $uri->port, #Port will default to 389 or 636
|
||||
scheme => $uri->scheme
|
||||
scheme => $uri->scheme,
|
||||
timeout => 15,
|
||||
);
|
||||
|
||||
|
||||
unless($ldap) {
|
||||
$self->{_error} = 103;
|
||||
return undef;
|
||||
|
|
@ -167,7 +168,7 @@ A valid ldap error code.
|
|||
|
||||
sub getErrorMessage {
|
||||
my $self = shift;
|
||||
my $errorCode = shift || $self->getErrorMessage;
|
||||
my $errorCode = shift || $self->getErrorCode;
|
||||
return "" unless $errorCode;
|
||||
my $i18nCode = "LDAPLink_".$errorCode;
|
||||
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
|
||||
|
|
@ -231,9 +232,7 @@ Disconnect cleanly from the current databaseLink.
|
|||
=cut
|
||||
|
||||
sub unbind {
|
||||
my ($self, $value);
|
||||
$self = shift;
|
||||
$value = shift;
|
||||
my $self = shift;
|
||||
if (defined $self->{_connection}) {
|
||||
$self->{_connection}->unbind;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,13 +380,14 @@ sub www_listLDAPLinks {
|
|||
|
||||
my $ldapLink = WebGUI::LDAPLink->new($session,$data->{ldapLinkId});
|
||||
my $status = $i18n->get("LDAPLink_1078");
|
||||
if ($ldapLink->bind && $ldapLink->getErrorCode == 0) {
|
||||
$status = $i18n->get("LDAPLink_1079");
|
||||
} else {
|
||||
$session->errorHandler->warn($ldapLink->getErrorMessage());
|
||||
if ($ldapLink->bind && $ldapLink->getErrorCode == 0) {
|
||||
$status = $i18n->get("LDAPLink_1079");
|
||||
$ldapLink->unbind;
|
||||
}
|
||||
else {
|
||||
$session->errorHandler->warn($ldapLink->getErrorMessage());
|
||||
$status .= ": ".$ldapLink->getErrorMessage();
|
||||
}
|
||||
$ldapLink->unbind;
|
||||
}
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$status.'</td>';
|
||||
$row[$i] .= '</tr>';
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 8; # Increment this number for each test you create
|
||||
plan tests => 9; # Increment this number for each test you create
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
|
@ -79,4 +79,5 @@ plan tests => 8; # Increment this number for each test you create
|
|||
isa_ok $connection, 'Net::LDAP', 'returned by bind';
|
||||
is $ldap->{_error}, 104, 'auth error due to bad identifier';
|
||||
is $ldap->getErrorCode, 104, 'getErrorCode returns the stored error code';
|
||||
ok $ldap->getErrorMessage, 'getErrorMessage returns an error message';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue