[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] CVS: squirrelmail/functions abook_ldap_server.php,1.18.2.1,1.18.2.2
From: Tomas Kuliavas <tokul () users ! sourceforge ! net>
Date: 2004-02-29 9:07:45
Message-ID: E1AxMvJ-0004nB-BE () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/squirrelmail/squirrelmail/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17848/functions
Modified Files:
Tag: SM-1_4-STABLE
abook_ldap_server.php
Log Message:
Porting non-anonymous ldap bind and bind protocol patches from head.
Closes bug 829929 and patch 525066. SM 1.2 STABLE does not contain these
patches, but if user has latest OpenLDAP, he/she can use latest stable SM too.
Index: abook_ldap_server.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/abook_ldap_server.php,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -w -r1.18.2.1 -r1.18.2.2
--- abook_ldap_server.php 24 Feb 2004 15:57:15 -0000 1.18.2.1
+++ abook_ldap_server.php 29 Feb 2004 09:07:43 -0000 1.18.2.2
@@ -20,13 +20,21 @@
* ? maxrows => Maximum # of rows in search result
* ? timeout => Timeout for LDAP operations (in seconds, default: 30)
* Might not work for all LDAP libraries or servers.
+ * ? binddn => LDAP Bind DN.
+ * ? bindpw => LDAP Bind Password.
+ * ? protocol => LDAP Bind protocol.
*
* NOTE. This class should not be used directly. Use the
* "AddressBook" class instead.
*
* $Id$
+ * @package squirrelmail
*/
+/**
+ * Undocumented class - fixme
+ * @package squirrelmail
+ */
class abook_ldap_server extends addressbook_backend {
var $btype = 'remote';
var $bname = 'ldap_server';
@@ -41,6 +49,9 @@
var $bound = false; /* True if LDAP server is bound */
var $maxrows = 250; /* Max rows in result */
var $timeout = 30; /* Timeout for LDAP operations (in seconds) */
+ var $binddn = ''; /* DN to bind to (non-anonymous bind) */
+ var $bindpw = ''; /* password to bind with (non-anonymous bind) */
+ var $protocol = ''; /* protocol used to connect to ldap server */
/* Constructor. Connects to database */
function abook_ldap_server($param) {
@@ -63,6 +74,15 @@
if(isset($param['timeout'])) {
$this->timeout = $param['timeout'];
}
+ if(isset($param['binddn'])) {
+ $this->binddn = $param['binddn'];
+ }
+ if(isset($param['bindpw'])) {
+ $this->bindpw = $param['bindpw'];
+ }
+ if(isset($param['protocol'])) {
+ $this->protocol = $param['protocol'];
+ }
if(empty($param['name'])) {
$this->sname = 'LDAP: ' . $param['host'];
}
@@ -95,11 +115,31 @@
}
}
+ if(!empty($this->protocol)) {
+ if(!@ldap_set_option($this->linkid, LDAP_OPT_PROTOCOL_VERSION, $this->protocol)) {
+ if(function_exists('ldap_error')) {
+ return $this->set_error(ldap_error($this->linkid));
+ } else {
+ return $this->set_error('ldap_set_option failed');
+ }
+ }
+ }
+
+ if(!empty($this->binddn)) {
+ if(!@ldap_bind($this->linkid, $this->binddn, $this->bindpw)) {
+ if(function_exists('ldap_error')) {
+ return $this->set_error(ldap_error($this->linkid));
+ } else {
+ return $this->set_error('authenticated ldap_bind failed');
+ }
+ }
+ } else {
if(!@ldap_bind($this->linkid)) {
if(function_exists('ldap_error')) {
return $this->set_error(ldap_error($this->linkid));
} else {
- return $this->set_error('ldap_bind failed');
+ return $this->set_error('anonymous ldap_bind failed');
+ }
}
}
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic