[vscweb-commit] r436 - in trunk/Main/People: LDAP/include Session/LDAP
Brought to you by:
cirrusrex
|
From: <wi...@bi...> - 2006-03-22 04:03:36
|
Author: wirges
Date: 2006-03-21 23:03:29 -0500 (Tue, 21 Mar 2006)
New Revision: 436
Modified:
trunk/Main/People/LDAP/include/ldap.class.php
trunk/Main/People/LDAP/include/libldap.inc
trunk/Main/People/Session/LDAP/login_proc.php
Log:
Fixed LDAP+TLS support. Also added optional
"LDAP_AUTH_*" _CONFIG vars for instances where the
authenticating ldap server is not the same as the directory server.
Modified: trunk/Main/People/LDAP/include/ldap.class.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/Main/People/LDAP/include/ldap.class.php 2006-01-26 19:37:18 UTC=
(rev 435)
+++ trunk/Main/People/LDAP/include/ldap.class.php 2006-03-22 04:03:29 UTC=
(rev 436)
@@ -107,7 +107,6 @@
$bind_dn =3D "$type=3D{$id}{$append},{$this->_authDN}";
=20
__debug_w("Bind DN: $bind_dn\n");
- =20
if (!$this->_bind($bind_dn, $password)) {
return false;
} else {
@@ -173,7 +172,7 @@
return _connect($this->_convServer, $this->_convPort);
}
function connectTLS() {
- if ($this->_connect($this->_convServer, $this->_convPort)) {
+ if ($this->_connect($this->_convServer, $this->_convPorts)) {
if (!ldap_start_tls($this->_ds)) {
$this->_error =3D "Could not initiate StartTLS connection.";
return false;
Modified: trunk/Main/People/LDAP/include/libldap.inc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/Main/People/LDAP/include/libldap.inc 2006-01-26 19:37:18 UTC (r=
ev 435)
+++ trunk/Main/People/LDAP/include/libldap.inc 2006-03-22 04:03:29 UTC (r=
ev 436)
@@ -49,7 +49,7 @@
function LDAP_QueryServer($search_string,$values=3DNULL) {
global $_CONFIG;
__DEBUG_W("LDAP_QueryServer: $search_string, $values");
- $_ENV["LDAPCONF"]=3D"/etc/ldap.conf";=20
+ $_ENV["LDAPCONF"]=3D"/etc/ldap/ldap.conf";=20
// open an LDAP connection (similiar to mysql_connect
$ds =3D ldap_connect($_CONFIG['LDAP_SERVER'],$_CONFIG['LDAP_PORT']=
);
if ($_CONFIG['LDAP_TLS_SUPPORT']) {
Modified: trunk/Main/People/Session/LDAP/login_proc.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/Main/People/Session/LDAP/login_proc.php 2006-01-26 19:37:18 UTC=
(rev 435)
+++ trunk/Main/People/Session/LDAP/login_proc.php 2006-03-22 04:03:29 UTC=
(rev 436)
@@ -71,15 +71,26 @@
$username =3D $i->username;
$password =3D $i->password;
=20
-$ldap =3D new LDAP_Connection($_CONFIG['LDAP_SERVER'],$_CONFIG['LDAP_POR=
T'],
- $_CONFIG['LDAP_PORT_TLS'],$_CONFIG['LDAP_BAS=
E_DN']);
-if (!$ldap->connectSSL()) Error("Could not Connect to {$_CONFIG['LDAP_SE=
RVER']}=20
+if (isset($_CONFIG['LDAP_AUTH_SERVER'])) {
+ $ldap_server =3D $_CONFIG['LDAP_AUTH_SERVER'];
+ $ldap_port =3D $_CONFIG['LDAP_AUTH_PORT'];
+ $ldap_port_tls =3D $_CONFIG['LDAP_AUTH_PORT_TLS'];
+ $ldap_base_dn =3D $_CONFIG['LDAP_AUTH_BASE_DN'];
+} else {
+ $ldap_server =3D $_CONFIG['LDAP_SERVER'];
+ $ldap_port =3D $_CONFIG['LDAP_PORT'];
+ $ldap_port_tls =3D $_CONFIG['LDAP_PORT_TLS'];
+ $ldap_base_dn =3D $_CONFIG['LDAP_BASE_DN'];
+}
+
+$ldap =3D new LDAP_Connection($ldap_server,$ldap_port, $ldap_port_tls, $=
ldap_base_dn);
+if (!$ldap->connectTLS()) Error("Could not Connect to {$_CONFIG['LDAP_SE=
RVER']}=20
with StartTLS", ERR_FATAL);
$auth =3D new LDAP_Authenticate($ldap);
=20
$rad =3D isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : ""; =
// also used later
$newUser =3D false;
-if ($auth->auth($username, $password, "uid")) {
+if (@$auth->auth($username, $password, "uid")) {
__DEBUG_W("We have a remote user: {$username}");
error_reporting(0);
include "$INC_PATH/People/LDAP/include/libldap.inc";
|