Line 29... |
Line 29... |
29 |
if (isset($_POST['ldap_server'])) $ldap_server = $_POST['ldap_server']; else erreur('Erreur de variable ldap_server');
|
29 |
if (isset($_POST['ldap_server'])) $ldap_server = $_POST['ldap_server']; else erreur('Erreur de variable ldap_server');
|
30 |
if (isset($_POST['ldap_base_dn'])) $ldap_base_dn = $_POST['ldap_base_dn']; else erreur('Erreur de variable ldap_base_dn');
|
30 |
if (isset($_POST['ldap_base_dn'])) $ldap_base_dn = $_POST['ldap_base_dn']; else erreur('Erreur de variable ldap_base_dn');
|
31 |
if (isset($_POST['ldap_filter'])) $ldap_filter = $_POST['ldap_filter']; else erreur('Erreur de variable ldap_filter');
|
31 |
if (isset($_POST['ldap_filter'])) $ldap_filter = $_POST['ldap_filter']; else erreur('Erreur de variable ldap_filter');
|
32 |
if (isset($_POST['ldap_base_filter'])) $ldap_base_filter = $_POST['ldap_base_filter']; else erreur('Erreur de variable ldap_base_filter');
|
32 |
if (isset($_POST['ldap_base_filter'])) $ldap_base_filter = $_POST['ldap_base_filter']; else erreur('Erreur de variable ldap_base_filter');
|
33 |
if (isset($_POST['ldap_user'])) $ldap_user = $_POST['ldap_user']; else erreur('Erreur de variable ldap_user');
|
33 |
if (isset($_POST['ldap_user'])) $ldap_user = $_POST['ldap_user']; else erreur('Erreur de variable ldap_user');
|
34 |
if (isset($_POST['ldap_password'])) $ldap_password = $_POST['ldap_password']; else erreur('Erreur de variable ldap_password');
|
34 |
if (isset($_POST['ldap_password'])) $ldap_password = $_POST['ldap_password']; else erreur('Erreur de variable ldap_password');
|
- |
|
35 |
|
- |
|
36 |
// Validation
|
- |
|
37 |
if ((!preg_match('/^([0-9]{1,3}.){3}.([0-9]{1,3})$/', $ldap_server)) && (preg_match('/^[a-zA-Z0-9-_.]+$/', $ldap_server))) {
|
- |
|
38 |
$ldap_server = gethostbyname($ldap_server);
|
- |
|
39 |
}
|
- |
|
40 |
if (!preg_match('/^([0-9]{1,3}.){3}.([0-9]{1,3})$/', $ldap_server)) {
|
- |
|
41 |
exit('Invalid LDAP server IP.');
|
- |
|
42 |
}
|
35 |
} //test $auth_enable
|
43 |
} //test $auth_enable
|
36 |
|
44 |
|
37 |
/****************************************************************
|
45 |
/****************************************************************
|
38 |
* TEST DES FICHIERS DE CONFIGURATION *
|
46 |
* TEST DES FICHIERS DE CONFIGURATION *
|
39 |
*****************************************************************/
|
47 |
*****************************************************************/
|
Line 124... |
Line 132... |
124 |
/********************************************************
|
132 |
/********************************************************
|
125 |
* Redémarage des service *
|
133 |
* Redémarage des service *
|
126 |
*********************************************************/
|
134 |
*********************************************************/
|
127 |
|
135 |
|
128 |
if ($auth_enable == "1") {
|
136 |
if ($auth_enable == "1") {
|
129 |
if (!preg_match('/^[A-Za-z0-9_\-\.]+$/', $ldap_server)) {
|
- |
|
130 |
exit('Invalid LDAP server.');
|
- |
|
131 |
}
|
- |
|
132 |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE)));
|
137 |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE)));
|
133 |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ".ALCASAR_CONF_FILE);
|
138 |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ".ALCASAR_CONF_FILE);
|
134 |
}
|
139 |
}
|
135 |
else {
|
140 |
else {
|
136 |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=on', 'LDAP=off', file_get_contents(ALCASAR_CONF_FILE)));
|
141 |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=on', 'LDAP=off', file_get_contents(ALCASAR_CONF_FILE)));
|