Commit 746a52896c8544ea13f2fbcfe262281814b6b4a7

Authored by Kevin Fourie
1 parent e78a1d0f

KTC-89

"Unregistered Users from Active Directory Authenticated Sources can log onto KT without needing to enter a password."
Changed the way this was fixed on advice from Neil Blakey-Milner. The original fix would break other Auth providers like OpenID and CAS.
Thanks Neil!

Reviewed By: Conrad



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6585 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/authentication/authenticationutil.inc.php
@@ -76,14 +76,6 @@ class KTAuthenticationUtil { @@ -76,14 +76,6 @@ class KTAuthenticationUtil {
76 $oProvider = KTAuthenticationUtil::getAuthenticationProviderForSource($oSource); 76 $oProvider = KTAuthenticationUtil::getAuthenticationProviderForSource($oSource);
77 $res = $oProvider->autoSignup($sUsername, $sPassword, $aExtra, $oSource); 77 $res = $oProvider->autoSignup($sUsername, $sPassword, $aExtra, $oSource);
78 if ($res) { 78 if ($res) {
79 - $oUser = User::getByUsername($sUsername);  
80 - // TODO: The check for this lower down....checkPassword  
81 - if(empty($sPassword) || is_null($oUser) || PEAR::isError($oUser)){  
82 - return false;  
83 - }  
84 - if(!KTAuthenticationUtil::checkPassword($oUser, $sPassword)){  
85 - return false;  
86 - }  
87 return $res; 79 return $res;
88 } 80 }
89 } 81 }
plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php
@@ -639,6 +639,11 @@ class KTLDAPBaseAuthenticator extends Authenticator { @@ -639,6 +639,11 @@ class KTLDAPBaseAuthenticator extends Authenticator {
639 } 639 }
640 640
641 function checkSignupPassword($sUsername, $sPassword) { 641 function checkSignupPassword($sUsername, $sPassword) {
  642 +
  643 + if(empty($sPassword) || empty($sUsername)) {
  644 + return false;
  645 + }
  646 +
642 $aUsers = $this->findUser($sUsername); 647 $aUsers = $this->findUser($sUsername);
643 if (empty($aUsers)) { 648 if (empty($aUsers)) {
644 return false; 649 return false;