Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
require_once("lib/alcasar/freeradius/siteconfig.php");
|
- |
|
3 |
require_once("lib/alcasar/freeradius/ldapconfig.php");
|
- |
|
4 |
|
- |
|
5 |
/* written by steweb57 */
|
2 |
/* written by steweb57 & Rexy */
|
6 |
/****************************************************************
|
3 |
/****************************************************************
|
7 |
* CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION *
|
4 |
* CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION *
|
8 |
*****************************************************************/
|
5 |
*****************************************************************/
|
9 |
|
6 |
|
10 |
define ("ALCASAR_RADIUS_SITE", "/etc/raddb/sites-available/alcasar");
|
7 |
define ("ALCASAR_RADIUS_SITE", "/etc/raddb/sites-enabled/alcasar");
|
11 |
define ("ALCASAR_RADIUS_MODULE_LDAP", "/etc/raddb/modules/ldap");
|
8 |
define ("ALCASAR_RADIUS_MODULE_LDAP", "/etc/raddb/mods-available/ldap");
|
12 |
|
9 |
|
13 |
/****************************************************************
|
10 |
/****************************************************************
|
14 |
* Choice of language *
|
11 |
* Choice of language *
|
15 |
*****************************************************************/
|
12 |
*****************************************************************/
|
16 |
|
13 |
|
Line 136... |
Line 133... |
136 |
//par défaut : filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
|
133 |
//par défaut : filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
|
137 |
$ldap_base_filter = ""; //
|
134 |
$ldap_base_filter = ""; //
|
138 |
//par défaut : # base_filter = "(objectclass=radiusprofile)"
|
135 |
//par défaut : # base_filter = "(objectclass=radiusprofile)"
|
139 |
|
136 |
|
140 |
/********************************************************
|
137 |
/********************************************************
|
141 |
* Fichier ALCASAR_RADIUS_SITE *
|
- |
|
142 |
*********************************************************/
|
- |
|
143 |
$site = new siteConfig();
|
138 |
*Lecture Fichier de conf *
|
144 |
$site->load(ALCASAR_RADIUS_SITE);
|
- |
|
145 |
$ldap_on = $site->authorize->ldap;
|
- |
|
146 |
|
- |
|
147 |
/********************************************************
|
- |
|
148 |
* Fichier ALCASAR_RADIUS_MODULE_LDAP *
|
- |
|
149 |
*********************************************************/
|
139 |
*********************************************************/
|
150 |
//Lecture du fichier /etc/raddb/modules/ldap
|
140 |
//Lecture du fichier /usr/local/etc/alcasar.conf
|
151 |
$ldap = new ldapConfig();
|
- |
|
152 |
$ldap->load(ALCASAR_RADIUS_MODULE_LDAP);
|
- |
|
153 |
$ldap_server = $ldap->host; // others options only in alcasar 3.x ($ldap->server)
|
141 |
//$ldap_server = $ldap->host; // others options only in alcasar 3.x ($ldap->server)
|
154 |
$ldap_identity = $ldap->identity;
|
142 |
//$ldap_identity = $ldap->identity;
|
155 |
$ldap_password = $ldap->password;
|
143 |
//$ldap_password = $ldap->password;
|
156 |
$ldap_basedn = $ldap->basedn;
|
144 |
//$ldap_basedn = $ldap->basedn;
|
157 |
$ldap_filter = $ldap->uid; // others options only in alcasar 3.x ($ldap->filter)
|
145 |
//$ldap_filter = $ldap->uid; // others options only in alcasar 3.x ($ldap->filter)
|
158 |
$ldap_base_filter = $ldap->base_filter;
|
146 |
//$ldap_base_filter = $ldap->base_filter;
|
159 |
|
147 |
|
160 |
function ldap_test($f_ldap_server, $f_ldap_identity, $f_ldap_password, $f_ldap_basedn, $f_ldap_filter, $f_ldap_port = "389"){
|
148 |
function ldap_test($f_ldap_server, $f_ldap_identity, $f_ldap_password, $f_ldap_basedn, $f_ldap_filter, $f_ldap_port = "389"){
|
161 |
// Test du serveur
|
149 |
// Test du serveur
|
162 |
if (!$sock = @fsockopen($f_ldap_server, $f_ldap_port, $num, $error, 2)) {
|
150 |
if (!$sock = @fsockopen($f_ldap_server, $f_ldap_port, $num, $error, 2)) {
|
163 |
// no network connection
|
151 |
// no network connection
|