[geeklog-cvs] Auth_Enterprise/Enterprise/Server LDAP.php,1.1,1.2

tony at iowaoutdoors.org tony at iowaoutdoors.org
Thu Jul 22 10:29:46 EDT 2004


Update of /var/cvs/Auth_Enterprise/Enterprise/Server
In directory www:/tmp/cvs-serv26612

Modified Files:
	LDAP.php 
Log Message:
Back to a semi-working state.  The DC/DN stuff needs to be added as proper options which I will do next.

Index: LDAP.php
===================================================================
RCS file: /var/cvs/Auth_Enterprise/Enterprise/Server/LDAP.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LDAP.php	16 Jul 2004 19:12:32 -0000	1.1
--- LDAP.php	22 Jul 2004 14:29:42 -0000	1.2
***************
*** 20,29 ****
  * Bring in the base Auth_Enterprise provider
  */
! require_once 'Auth/Enterprise/Server/providers/BasePearDBProvider.php';
! 
! /**
! * The Auth_Enterprise server configuration file
! */
! require_once 'Auth/Enterprise/Server/ServerConfig.php';
  
  /**
--- 20,24 ----
  * Bring in the base Auth_Enterprise provider
  */
! require_once 'Auth/Enterprise/Server/DB.php';
  
  /**
***************
*** 38,42 ****
  * 
  */
! class Enterprise_LDAPProvider extends Enterprise_BasePearDBProvider {
      /**
      * Handle to an LDAP connection
--- 33,37 ----
  * 
  */
! class Auth_Enterprise_Server_LDAP extends Auth_Enterprise_Server_DB {
      /**
      * Handle to an LDAP connection
***************
*** 48,64 ****
      *
      * @author Ozzyie Chen <ozzyie at doit.wisc.edu>
!     * @param string $appId Application ID
      *
      */
!     public function __construct($appId)
      {
          global $gConf;
          
!         // Call constructor on parent first
!         parent::__construct($appId);
          
          // Try connecting to the LDAP server
!         $this->ldapConn = ldap_connect($gConf[AE_PROVIDER_LDAP]['ldapHost'],
!             $gConf[AE_PROVIDER_LDAP]['ldapPort']);
              
          if (!$this->ldapConn) {
--- 43,74 ----
      *
      * @author Ozzyie Chen <ozzyie at doit.wisc.edu>
!     * @param array $options Array of provider options
      *
      */
!     public function __construct($options)
      {
          global $gConf;
          
!         // Let ancenstors do their work first
!         parent::__construct($options);
!         
!         if (!isset($options['ldapHost'])) {
!             throw new AEInsufficientOptions('The LDAP provider requires a LDAP Host option.');
!         }
!         
!         if (!isset($options['ldapDC'])) {
!             throw new AEInsufficientOptions('The LDAP provider requies a DC options.');
!         }
!         
!         if (!isset($options['ldapPort'])) {
!             $options['ldapPort'] = 389;
!         }
!         
!         if (!isset($options['ldapProtocolVersion'])) {
!             $options['ldapProtocolVersion'] = 3;
!         }
          
          // Try connecting to the LDAP server
!         $this->ldapConn = ldap_connect($options['ldapHost'], $options['ldapPort']);
              
          if (!$this->ldapConn) {
***************
*** 68,72 ****
          
          // Set LDAP protocol version
!         ldap_set_option($this->ldapConn, LDAP_OPT_PROTOCOL_VERSION, $gConf[AE_PROVIDER_LDAP]['ldapProtocolVersion']);
      }
  
--- 78,82 ----
          
          // Set LDAP protocol version
!         ldap_set_option($this->ldapConn, LDAP_OPT_PROTOCOL_VERSION, $options['ldapProtocolVersion']);
      }
  
***************
*** 110,118 ****
          
          try {
!            $this->doBind("cn=$userName,ou=people,{$gConf[AE_PROVIDER_LDAP]['ldapDC']}", $password);
          } catch (AELDAPBindError $e) {
!            throw new AEInvalidUserCredentials($e->getMessage());
          } catch (Exception $e) {
!            throw $e;
          }
          
--- 120,129 ----
          
          try {
!             $bindString = "cn=$userName,ou=people," . $this->options['ldapDC'];
!             $this->doBind($bindString, $password);
          } catch (AELDAPBindError $e) {
!             throw new AEInvalidUserCredentials($e->getMessage());
          } catch (Exception $e) {
!             throw $e;
          }
          




More information about the geeklog-cvs mailing list