Commit 3a0599e20f9ca155dfc4049fd4f5f8b4cf185bae

Authored by Megan Watson
1 parent 4be98d5b

KTS-3090

"Get an error when trying to view all groups on your active directory server."
Fixed. Added error checking.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8179 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php
... ... @@ -504,11 +504,15 @@ class KTLDAPBaseAuthenticationProvider extends KTAuthenticationProvider {
504 504 $fields = array();
505 505 $fields[] = new KTStringWidget(_kt("Group's name"), _kt("The group's name, or part thereof, to find the group that you wish to add"), 'name', '', $this->oPage, true);
506 506  
507   - $oAuthenticator = $this->getAuthenticator($oSource);
508 507 $name = KTUtil::arrayGet($_REQUEST, 'name');
509 508 if (!empty($name)) {
510 509 $oAuthenticator = $this->getAuthenticator($oSource);
511 510 $aSearchResults = $oAuthenticator->searchGroups($name);
  511 +
  512 + if(PEAR::isError($aSearchResults)){
  513 + $this->addErrorMessage($aSearchResults->getMessage());
  514 + $aSearchResults = array();
  515 + }
512 516 }
513 517  
514 518 $aTemplateData = array(
... ... @@ -973,6 +977,11 @@ class KTLDAPBaseAuthenticator extends Authenticator {
973 977 }
974 978 $sFilter = sprintf('(&(objectClass=group)(cn=*%s*))', $sSearch);
975 979 $oResults = $this->oLdap->search($rootDn, $sFilter, $aParams);
  980 +
  981 + if(PEAR::isError($oResults)){
  982 + return $oResults;
  983 + }
  984 +
976 985 $aRet = array();
977 986 foreach($oResults->entries() as $oEntry) {
978 987 $aAttr = $oEntry->attributes();
... ...