Subversion Repositories ALCASAR

Rev

Rev 2705 | Rev 2714 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 2705 Rev 2710
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: ldap.php 2705 2019-03-05 22:30:50Z tom.houdayer $
2
# $Id: ldap.php 2710 2019-03-05 23:37:17Z tom.houdayer $
3
 
3
 
4
/* written by steweb57, Rexy & Tom HOUDAYER */
4
/* written by steweb57, Rexy & Tom HOUDAYER */
5
/****************************************************************
5
/****************************************************************
6
*			GLOBAL FILE PATHS			*
6
*			GLOBAL FILE PATHS			*
7
*****************************************************************/
7
*****************************************************************/
Line 138... Line 138...
138
 
138
 
139
	// Set LDAP SSL options
139
	// Set LDAP SSL options
140
	if ($f_ldap_ssl) {
140
	if ($f_ldap_ssl) {
141
		if ($f_ldap_cert_required) {
141
		if ($f_ldap_cert_required) {
142
			if ($f_ldap_cert) {
142
			if ($f_ldap_cert) {
143
				// ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, $f_ldap_cert);
143
				ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, $f_ldap_cert);
144
			}
144
			}
145
			ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_DEMAND);
145
			ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_DEMAND);
146
 
146
 
147
		} else {
147
		} else {
148
			// ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
148
			ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
149
		}
149
		}
150
	}
150
	}
151
 
151
 
152
	// if ok, Test LDAP connection
152
	// if ok, Test LDAP connection
153
	$ldapconn = @ldap_connect((($f_ldap_ssl)?'ldaps':'ldap').'://'.$f_ldap_server);
153
	$ldapconn = @ldap_connect((($f_ldap_ssl)?'ldaps':'ldap').'://'.$f_ldap_server);
Line 155... Line 155...
155
		// LDAP connection failed
155
		// LDAP connection failed
156
		return -1;
156
		return -1;
157
	}
157
	}
158
 
158
 
159
	ldap_set_option($ldapconn, LDAP_OPT_TIMELIMIT, 2);
159
	ldap_set_option($ldapconn, LDAP_OPT_TIMELIMIT, 2);
160
	// ldap_get_option($ldapconn, LDAP_OPT_X_KEEPALIVE_INTERVAL, $tmp); var_dump($tmp); ////////// TODO : opti keep-alive
-
 
161
 
160
 
162
	// if ok, test a ldap-bind with the user used by ALCASAR
161
	// if ok, test a ldap-bind with the user used by ALCASAR
163
	$ldapbind = @ldap_bind($ldapconn, $f_ldap_identity, $f_ldap_password);
162
	$ldapbind = @ldap_bind($ldapconn, $f_ldap_identity, $f_ldap_password);
164
	if (!$ldapbind) {
163
	if (!$ldapbind) {
165
		// Test LDAP Version 3
164
		// Test LDAP Version 3