Line 12... |
Line 12... |
12 |
|
12 |
|
13 |
public function __construct($instanceName=null) {
|
13 |
public function __construct($instanceName=null) {
|
14 |
if ($instanceName!== null)
|
14 |
if ($instanceName!== null)
|
15 |
$this->instanceName = $instanceName;
|
15 |
$this->instanceName = $instanceName;
|
16 |
// LDAP setting
|
16 |
// LDAP setting
|
17 |
$this->_items['protocol'] = 'ldap';
|
17 |
$this->_items['protocol'] = 'ldap';
|
18 |
$this->_items['host'] = 'test';
|
18 |
$this->_items['host'] = 'test';
|
19 |
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
|
19 |
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
|
20 |
$this->_items['port'] = '389';//not use yet (689 = ldaps)
|
20 |
$this->_items['port'] = '389';//not use yet (689 = ldaps)
|
21 |
$this->_items['identity'] = '';
|
21 |
$this->_items['identity'] = '';
|
22 |
$this->_items['password'] = '';
|
22 |
$this->_items['password'] = '';
|
23 |
$this->_items['basedn'] = 'dc=example,dc=com';
|
23 |
$this->_items['basedn'] = 'dc=example,dc=com';
|
24 |
$this->_items['uid'] = 'uid';
|
24 |
$this->_items['uid'] = 'uid';
|
25 |
$this->_items['filter'] = "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
|
25 |
$this->_items['filter'] = "($this->_items['uid']=%{User-Name})";
|
26 |
$this->_items['base_filter'] = '';
|
26 |
$this->_items['base_filter'] = '';
|
27 |
$this->_items['ldap_connections_number'] = '5';
|
27 |
$this->_items['ldap_connections_number'] = '5';
|
28 |
$this->_items['timeout'] = '4';
|
28 |
$this->_items['timeout'] = '4';
|
29 |
$this->_items['timelimit'] = '3';
|
29 |
$this->_items['timelimit'] = '3';
|
30 |
$this->_items['net_timeout'] = '1';
|
30 |
$this->_items['net_timeout'] = '1';
|
31 |
// TLS setting related items
|
31 |
// TLS setting related items
|
32 |
$this->_tls['start_tls'] = 'no'; // if no all tls config are comments
|
32 |
$this->_tls['start_tls'] = 'no'; // if no all tls config are comments
|
33 |
$this->_tls['cacertfile'] = '#';
|
33 |
$this->_tls['cacertfile'] = '#';
|
34 |
$this->_tls['cacertdir'] = '#';
|
34 |
$this->_tls['cacertdir'] = '#';
|
35 |
$this->_tls['certfile'] = '#';
|
35 |
$this->_tls['certfile'] = '#';
|
36 |
$this->_tls['keyfile'] = '#';
|
36 |
$this->_tls['keyfile'] = '#';
|
37 |
$this->_tls['randfile'] = '#';
|
37 |
$this->_tls['randfile'] = '#';
|
38 |
$this->_tls['require_cert'] = '#';
|
38 |
$this->_tls['require_cert'] = '#';
|
39 |
// others ldap setting (optional)
|
39 |
// others ldap setting (optional)
|
40 |
$this->_items['default_profile'] = '#';
|
40 |
$this->_items['default_profile'] = '#';
|
41 |
$this->_items['profile_attribute'] = '#';
|
41 |
$this->_items['profile_attribute'] = '#';
|
42 |
$this->_items['access_attr'] = '#';
|
42 |
$this->_items['access_attr'] = '#';
|
43 |
// Mapping of RADIUS dictionary attributes to LDAP
|
43 |
// Mapping of RADIUS dictionary attributes to LDAP
|
44 |
// directory attributes.
|
44 |
// directory attributes.
|
45 |
$this->_items['dictionary_mapping'] = '${confdir}/ldap.attrmap';
|
45 |
$this->_items['dictionary_mapping'] = '${confdir}/ldap.attrmap';
|
46 |
// for ldap like NOVEL
|
46 |
// for ldap like NOVEL
|
47 |
$this->_items['password_attribute'] = '#';
|
47 |
$this->_items['password_attribute'] = '#';
|
48 |
$this->_items['edir_account_policy_check'] = 'no';
|
48 |
$this->_items['edir_account_policy_check'] = 'no';
|
49 |
// Group membership checking. Disabled by default.
|
49 |
// Group membership checking. Disabled by default.
|
50 |
$this->_items['groupname_attribute'] = '#';
|
50 |
$this->_items['groupname_attribute'] = '#';
|
51 |
$this->_items['groupmembership_filter'] = '#';
|
51 |
$this->_items['groupmembership_filter'] = '#';
|
52 |
$this->_items['groupmembership_attribute'] = '#';
|
52 |
$this->_items['groupmembership_attribute'] = '#';
|
53 |
$this->_items['compare_check_items'] = '#';
|
53 |
$this->_items['compare_check_items'] = '#';
|
54 |
$this->_items['do_xlat'] = '#';
|
54 |
$this->_items['do_xlat'] = '#';
|
55 |
$this->_items['access_attr_used_for_allow'] = '#';
|
55 |
$this->_items['access_attr_used_for_allow'] = '#';
|
56 |
// auth option
|
56 |
// auth option
|
57 |
$this->_items['set_auth_type'] = '#';
|
57 |
$this->_items['set_auth_type'] = '#';
|
58 |
// debug option
|
58 |
// debug option
|
59 |
$this->_items['ldap_debug'] = '#';
|
59 |
$this->_items['ldap_debug'] = '#';
|
60 |
}
|
60 |
}
|
61 |
|
61 |
|
62 |
public function __get($attr){ // to get an $item
|
62 |
public function __get($attr){ // to get an $item
|
63 |
if ($attr==='tls'){
|
63 |
if ($attr==='tls'){
|
64 |
return $this->_tls;
|
64 |
return $this->_tls;
|
Line 92... |
Line 92... |
92 |
}
|
92 |
}
|
93 |
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
|
93 |
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
|
94 |
break;
|
94 |
break;
|
95 |
case "uid":
|
95 |
case "uid":
|
96 |
$this->_items['uid'] = $value;
|
96 |
$this->_items['uid'] = $value;
|
97 |
$this->_items['filter'] = "(".$this->_items['uid']."=%{Stripped-User-Name:-%{User-Name}})";
|
97 |
$this->_items['filter'] = "(".$this->_items['uid']."=%{User-Name})";
|
98 |
break;
|
98 |
break;
|
99 |
case "filter":
|
99 |
case "filter":
|
100 |
// extract uid
|
100 |
// extract uid
|
101 |
if (preg_match('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`',$value)){
|
101 |
if (preg_match('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{User-Name\}\)`',$value)){
|
102 |
$this->_items['uid'] = preg_replace('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`','$1',$value);
|
102 |
$this->_items['uid'] = preg_replace('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{User-Name\}\)`','$1',$value);
|
103 |
} else {
|
103 |
} else {
|
104 |
$this->_items['uid'] = 'uid';
|
104 |
$this->_items['uid'] = 'uid';
|
105 |
}
|
105 |
}
|
106 |
$this->_items['filter'] = "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
|
106 |
$this->_items['filter'] = "($this->_items['uid']=%{User-Name})";
|
107 |
break;
|
107 |
break;
|
108 |
default:
|
108 |
default:
|
109 |
$this->_items[$attr] = $value;
|
109 |
$this->_items[$attr] = $value;
|
110 |
}
|
110 |
}
|
111 |
} elseif (array_key_exists($attr, $this->_tls)){
|
111 |
} elseif (array_key_exists($attr, $this->_tls)){
|