20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
30 if (file_exists(
$file =
$GLOBALS['xoops']->path('class/auth/auth_provisionning.php'))) {
34 if (!class_exists(
'XoopsAuthProvisionning')) {
35 trigger_error(
'Required class XoopsAuthProvisionning was not found at line ' . __FILE__ .
' at line ' . __LINE__, E_USER_WARNING);
53 "\xc2\x82" =>
"\xe2\x80\x9a" ,
56 "\xc2\x83" =>
"\xc6\x92" ,
59 "\xc2\x84" =>
"\xe2\x80\x9e" ,
62 "\xc2\x85" =>
"\xe2\x80\xa6" ,
65 "\xc2\x86" =>
"\xe2\x80\xa0" ,
68 "\xc2\x87" =>
"\xe2\x80\xa1" ,
71 "\xc2\x88" =>
"\xcb\x86" ,
74 "\xc2\x89" =>
"\xe2\x80\xb0" ,
77 "\xc2\x8a" =>
"\xc5\xa0" ,
80 "\xc2\x8b" =>
"\xe2\x80\xb9" ,
83 "\xc2\x8c" =>
"\xc5\x92" ,
86 "\xc2\x8e" =>
"\xc5\xbd" ,
89 "\xc2\x91" =>
"\xe2\x80\x98" ,
92 "\xc2\x92" =>
"\xe2\x80\x99" ,
95 "\xc2\x93" =>
"\xe2\x80\x9c" ,
98 "\xc2\x94" =>
"\xe2\x80\x9d" ,
101 "\xc2\x95" =>
"\xe2\x80\xa2" ,
104 "\xc2\x96" =>
"\xe2\x80\x93" ,
107 "\xc2\x97" =>
"\xe2\x80\x94" ,
110 "\xc2\x98" =>
"\xcb\x9c" ,
113 "\xc2\x99" =>
"\xe2\x84\xa2" ,
116 "\xc2\x9a" =>
"\xc5\xa1" ,
119 "\xc2\x9b" =>
"\xe2\x80\xba" ,
122 "\xc2\x9c" =>
"\xc5\x93" ,
125 "\xc2\x9e" =>
"\xc5\xbe" ,
128 "\xc2\x9f" =>
"\xc5\xb8");
157 foreach (
$config as $key => $val) {
170 return strtr(utf8_encode($str), $this->cp1252_map);
185 $authenticated =
false;
186 if (!extension_loaded(
'ldap')) {
188 return $authenticated;
190 $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port);
192 ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version);
193 if ($this->ldap_use_TLS) {
194 if (!ldap_start_tls($this->_ds)) {
205 $authenticated = ldap_bind($this->_ds, $userDN, stripslashes($pwd));
206 if ($authenticated) {
210 $this->
setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) .
'(' . $userDN .
')');
215 @ldap_close($this->_ds);
216 return $authenticated;
227 if (!$this->ldap_loginname_asdn) {
229 if (!ldap_bind($this->_ds, $this->ldap_manager_dn, stripslashes($this->ldap_manager_pass))) {
230 $this->
setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) .
'(' . $this->ldap_manager_dn .
')');
234 $sr = ldap_search($this->_ds, $this->ldap_base_dn,
$filter);
235 $info = ldap_get_entries($this->_ds, $sr);
236 if ($info[
'count'] > 0) {
237 $userDN = $info[0][
'dn'];
255 if ($this->ldap_filter_person !=
'') {
256 $filter = str_replace(
'@@loginname@@',
$uname, $this->ldap_filter_person);
274 $sr = ldap_read($this->_ds, $userdn,
'(objectclass=*)');
275 $entries = ldap_get_entries($this->_ds, $sr);
276 if ($entries[
'count'] > 0) {