cvs: pear /Auth/Container LDAP.php

From: Date: Wed, 01 Mar 2006 13:53:44 +0000
Subject: cvs: pear /Auth/Container LDAP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38785@lists.php.net to get a copy of this message
jw Wed Mar 1 13:53:44 2006 UTC Modified files: /pear/Auth/Container LDAP.php Log: documentation notes for ad and referrals debug message fix for referrals parameter and return value checking fixes http://cvs.php.net/viewcvs.cgi/pear/Auth/Container/LDAP.php?r1=1.27&r2=1.28&diff_format=u Index: pear/Auth/Container/LDAP.php diff -u pear/Auth/Container/LDAP.php:1.27 pear/Auth/Container/LDAP.php:1.28 --- pear/Auth/Container/LDAP.php:1.27 Wed Mar 1 06:03:08 2006 +++ pear/Auth/Container/LDAP.php Wed Mar 1 13:53:44 2006 @@ -16,7 +16,7 @@ // | Authors: Jan Wagner <wagner@netsols.de> | // +----------------------------------------------------------------------+ // -// $Id: LDAP.php,v 1.27 2006/03/01 06:03:08 aashley Exp $ +// $Id: LDAP.php,v 1.28 2006/03/01 13:53:44 jw Exp $ // require_once "Auth/Container.php"; @@ -98,7 +98,7 @@ * <?php * ... * - * $a = new Auth("LDAP", array( + * $a1 = new Auth("LDAP", array( * 'host' => 'localhost', * 'port' => '389', * 'version' => 3, @@ -119,8 +119,6 @@ * 'group' => 'admin' * )); * - * This is a full blown example with user/group checking to an Active Directory - * * $a3 = new Auth('LDAP', array( * 'host' => 'ldap.netsols.de', * 'port' => 389, @@ -162,15 +160,17 @@ * * It seems that binding anonymously to an Active Directory * is not allowed, so you have to set binddn and bindpw for - * user searching, + * user searching. + * + * LDAP Referrals need to be set to false for AD to work sometimes. * - * Example a3 shows a tested example for connection to Windows 2000 - * Active Directory + * Example a3 shows a full blown and tested example for connection to + * Windows 2000 Active Directory with group mebership checking * * @author Jan Wagner <wagner@netsols.de> * @author Adam Ashley <aashley@php.net> * @package Auth - * @version $Revision: 1.27 $ + * @version $Revision: 1.28 $ */ class Auth_Container_LDAP extends Auth_Container { @@ -246,12 +246,12 @@ // switch LDAP referrals if (is_bool($this->options['referrals'])) { - $this->_debug("Switching to LDAP referrals {$this->options['referrals']}", __LINE__); + $this->_debug("Switching LDAP referrals to " . (($this->options['referrals']) ? 'true' : 'false'), __LINE__); @ldap_set_option($this->conn_id, LDAP_OPT_REFERRALS, $this->options['referrals']); } // bind with credentials or anonymously - if ($this->options['binddn'] && $this->options['bindpw']) { + if (strlen($this->options['binddn']) && strlen($this->options['bindpw'])) { $this->_debug('Binding with credentials', __LINE__); $bind_params = array($this->conn_id, $this->options['binddn'], $this->options['bindpw']); } else { @@ -260,7 +260,7 @@ } // bind for searching - if ((@call_user_func_array('ldap_bind', $bind_params)) == false) { + if ((@call_user_func_array('ldap_bind', $bind_params)) === false) { $this->_debug(); $this->_disconnect(); return PEAR::raiseError("Auth_Container_LDAP: Could not bind to LDAP server.", 41); @@ -502,7 +502,7 @@ $this->_debug("Searching with $func_name and filter $filter in $search_basedn", __LINE__); // search - if (($result_id = @call_user_func_array($func_name, $func_params)) == false) { + if (($result_id = @call_user_func_array($func_name, $func_params)) === false) { $this->_debug('User not found', __LINE__); } elseif (@ldap_count_entries($this->conn_id, $result_id) == 1) { // did we get just one entry?

« previous php.pear.cvs (#38785) next »