Fix status reporting for successful connects but bad binds. Fixes bug #11216
This commit is contained in:
parent
7c94f6f8ba
commit
bc21f904da
5 changed files with 130 additions and 7 deletions
|
|
@ -141,6 +141,19 @@ sub get {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getErrorCode ( )
|
||||
|
||||
Returns the numerical error code generated by the bind() method.
|
||||
|
||||
=cut
|
||||
|
||||
sub getErrorCode {
|
||||
my $self = shift;
|
||||
return $self->{_error};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getErrorMessage ( [ldapErrorCode] )
|
||||
|
||||
Returns the error string representing the error code generated by Net::LDAP. If no code is passed in, the most recent error stored by the class is returned
|
||||
|
|
@ -153,7 +166,7 @@ A valid ldap error code.
|
|||
|
||||
sub getErrorMessage {
|
||||
my $self = shift;
|
||||
my $errorCode = shift || $self->{_error};
|
||||
my $errorCode = shift || $self->getErrorMessage;
|
||||
return "" unless $errorCode;
|
||||
my $i18nCode = "LDAPLink_".$errorCode;
|
||||
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
|
||||
|
|
@ -242,12 +255,11 @@ The ldapLinkId of the ldapLink you're creating an object reference for.
|
|||
=cut
|
||||
|
||||
sub new {
|
||||
my ($ldapLinkId, $ldapLink);
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
$ldapLinkId = shift;
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $ldapLinkId = shift;
|
||||
return undef unless $ldapLinkId;
|
||||
$ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
|
||||
my $ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
|
||||
bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -380,10 +380,11 @@ sub www_listLDAPLinks {
|
|||
|
||||
my $ldapLink = WebGUI::LDAPLink->new($session,$data->{ldapLinkId});
|
||||
my $status = $i18n->get("LDAPLink_1078");
|
||||
if ($ldapLink->bind) {
|
||||
if ($ldapLink->bind && $ldapLink->getErrorCode == 0) {
|
||||
$status = $i18n->get("LDAPLink_1079");
|
||||
} else {
|
||||
$session->errorHandler->warn($ldapLink->getErrorMessage());
|
||||
$status .= ": ".$ldapLink->getErrorMessage();
|
||||
}
|
||||
$ldapLink->unbind;
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$status.'</td>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue