From 8b706dc727af762b54121ae33107a8448a5c4016 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Tue, 31 Oct 2006 17:21:38 +0000 Subject: [PATCH] fixed ldap auth module bug --- docs/changelog/7.x.x.txt | 3 ++- lib/WebGUI/Auth/LDAP.pm | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9a9927397..6490735dc 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -26,7 +26,8 @@ - fix: metadata (WebGUI Help). Removed mention of the RawHeadTags macro from the Metadata help. - WebGUI::Session::Stow now warns if set() is called when cache is disabled - + - Fixed a bug in the LDAP auth module where LDAP links could not connect to + the LDAP server (Martin Kamerbeek / Procolix) 7.1.2 - Fixed a bug where logging in/out would cause a blank page display. diff --git a/lib/WebGUI/Auth/LDAP.pm b/lib/WebGUI/Auth/LDAP.pm index 543fb43f6..2a8dea1a4 100644 --- a/lib/WebGUI/Auth/LDAP.pm +++ b/lib/WebGUI/Auth/LDAP.pm @@ -82,7 +82,7 @@ sub _isValidLDAPUser { else { # or... use a releative distinguished name instead $connectDN = $search->entry(0)->get_value($connection->{ldapUserRDN}); } - + # Remember the users DN so we can use it later. $self->setConnectDN($connectDN); $ldap->unbind; @@ -111,7 +111,7 @@ sub _isValidLDAPUser { } else { # Unable to bind with proxy user credentials or anonymously for our search $error = $i18n->get(2,'AuthLDAP'); - $self->session->errorHandler->error("Couldn't bind to LDAP server: ".$connection->{ldapURL}); + $self->session->errorHandler->error("Couldn't bind to LDAP server: ".$connection->{ldapUrl}); } } else { # Could not create our LDAP object @@ -264,7 +264,7 @@ sub createAccountSave { my $connection = $self->getLDAPConnection; #Get connectDN from settings - my $uri = URI->new($connection->{ldapURL}); + my $uri = URI->new($connection->{ldapUrl}); my $ldap = Net::LDAP->new($uri->host, (port=>$uri->port)); my $auth; if($connection->{connectDn}) { @@ -298,7 +298,7 @@ sub createAccountSave { my $properties; $properties->{connectDN} = $connectDN; - $properties->{ldapUrl} = $connection->{ldapURL}; + $properties->{ldapUrl} = $connection->{ldapUrl}; return $self->SUPER::createAccountSave($username,$properties,$password,$profile); } @@ -354,7 +354,7 @@ sub editUserForm { my $self = shift; my $userData = $self->getParams; my $connection = $self->getLDAPConnection; - my $ldapUrl = $self->session->form->process('authLDAP_ldapUrl') || $userData->{ldapUrl} || $connection->{ldapURL}; + my $ldapUrl = $self->session->form->process('authLDAP_ldapUrl') || $userData->{ldapUrl} || $connection->{ldapUrl}; my $connectDN = $self->session->form->process('authLDAP_connectDN') || $userData->{connectDN}; my $ldapConnection = $self->session->form->process('authLDAP_ldapConnection') || $userData->{ldapConnection}; my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink"); @@ -497,7 +497,7 @@ sub login { if ($autoRegistration && !$hasAuthenticated) { # See if they are in LDAP and if so that they can bind with the password given. if($self->_isValidLDAPUser()) { - + # Create a WebGUI Account if ($self->validUsername($username)) { $self->SUPER::createAccountSave($username, {