Lines Matching refs:this

46           $this->success = false;
49 $this->cando['addUser'] = true;
50 $this->cando['delUser'] = true;
51 $this->cando['modLogin'] = true;
52 $this->cando['modGroups'] = true;
54 $this->cando['getUsers'] = true;
55 $this->cando['getGroups'] = true;
56 $this->cando['getUserCount'] = true;
57 $this->cando['logout'] = true;
61 $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
62 $this->success = false;
67 $this->cando['modPass'] = $this->getConf('modPass');
84 if(!$this->_openLDAP()) return false;
87 if($this->users === null) $this->_loadUserData();
88 if(!isset($this->users[$user])) return false;
91 if($this->getConf('binddn') && $this->getConf('bindpw')) {
93 …if(!@ldap_bind($this->con, $this->getConf('binddn'), conf_decodeString($this->getConf('bindpw'))))…
94 …$this->_debug('LDAP bind as superuser: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __…
97 $this->bound = 2;
98 } else if($this->getConf('binddn') &&
99 $this->getConf('usertree') &&
100 $this->getConf('userfilter')
103 $dn = $this->_makeFilter(
104 $this->getConf('binddn'),
105 array('user'=> $user, 'server'=> $this->getConf('server'))
108 } else if(strpos($this->getConf('usertree'), '%{user}')) {
110 $dn = $this->_makeFilter(
111 $this->getConf('usertree'),
112 array('user'=> $user, 'server'=> $this->getConf('server'))
117 if(!@ldap_bind($this->con)) {
119 …$this->_debug('LDAP anonymous bind: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FIL…
127 if(!@ldap_bind($this->con, $dn, $pass)) {
128 $this->_debug("LDAP: bind with $dn failed", -1, __LINE__, __FILE__);
129 …$this->_debug('LDAP user dn bind: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE_…
132 $this->bound = 1;
136 $info = $this->_getUserData($user, true);
144 if(!@ldap_bind($this->con, $dn, $pass)) {
145 $this->_debug("LDAP: bind with $dn failed", -1, __LINE__, __FILE__);
146 … $this->_debug('LDAP user bind: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
149 $this->bound = 1;
170 return $this->_getUserData($user);
180 if(!$this->_openLDAP()) return false;
183 if($this->getConf('binddn') && $this->getConf('bindpw') && $this->bound < 2) {
185 …if(!@ldap_bind($this->con, $this->getConf('binddn'), conf_decodeString($this->getConf('bindpw'))))…
186 …$this->_debug('LDAP bind as superuser: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __…
189 $this->bound = 2;
190 } elseif($this->bound == 0 && !$inbind) {
197 $this->checkPass($loginuser, $loginpass);
203 $info['server'] = $this->getConf('server');
206 $base = $this->_makeFilter($this->getConf('usertree'), $info);
207 if($this->getConf('userfilter')) {
208 $filter = $this->_makeFilter($this->getConf('userfilter'), $info);
213 $sr = $this->_ldapsearch($this->con, $base, $filter, $this->getConf('userscope'));
214 $result = @ldap_get_entries($this->con, $sr);
215 …$this->_debug('LDAP user search: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__…
216 … $this->_debug('LDAP search at: '.htmlspecialchars($base.' '.$filter), 0, __LINE__, __FILE__);
238 if(is_array($this->getConf('mapping'))) {
239 foreach($this->getConf('mapping') as $localkey => $key) {
260 if($this->getConf('grouptree') || $this->getConf('groupfilter')) {
261 $base = $this->_makeFilter($this->getConf('grouptree'), $user_result);
262 $filter = $this->_makeFilter($this->getConf('groupfilter'), $user_result);
263 …$sr = $this->_ldapsearch($this->con, $base, $filter, $this->getConf('groupscope'), array($this
264 …$this->_debug('LDAP group search: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE_…
265 … $this->_debug('LDAP search at: '.htmlspecialchars($base.' '.$filter), 0, __LINE__, __FILE__);
269 …$this->_debug('LDAP group search: '.htmlspecialchars(ldap_error($this->con)), 0,__LINE__,__FILE__);
272 $result = ldap_get_entries($this->con, $sr);
276 if(!empty($grp[$this->getConf('groupkey')])) {
277 $group = $grp[$this->getConf('groupkey')];
281 … $this->_debug('groupkey did not return a detailed result', 0, __LINE__, __FILE__);
285 … $this->_debug('LDAP usergroup: '.htmlspecialchars($group), 0, __LINE__, __FILE__);
291 if($this->users === null) $this->_loadUserData();
292 if(is_array($this->users[$user]['grps'])) {
293 foreach($this->users[$user]['grps'] as $group) {
352 if($this->users === null) $this->_loadUserData();
353 if(isset($this->users[$user])) {
358 $info = $this->_getUserData($user);
377 $userline = $this->_createUserLine($user, $pass, $name, $mail, $grps);
380 msg($this->getLang('writefail'), -1);
384 $this->users[$user] = compact('pass','name','mail','grps');
400 if(($userinfo = $this->getUserData($user)) === false) {
401 msg($this->getLang('usernotexists'), -1);
407 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
424 …$userline = $this->_createUserLine($newuser, $userinfo['pass'], $userinfo['name'], $userinfo['mail…
433 $this->users[$newuser] = $userinfo;
448 if($this->users === null) $this->_loadUserData();
453 if(!empty($this->users[$user]['protected'])) {
454 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
457 if(isset($this->users[$user])) $deleted[] = preg_quote($user, '/');
464 msg($this->getLang('writefail'), -1);
469 $count = count($this->users);
470 $this->_loadUserData();
471 $count -= count($this->users);
483 if($this->users === null) $this->_loadUserData();
485 if(!count($filter)) return count($this->users);
488 $this->_constructPattern($filter);
490 foreach($this->users as $user => $info) {
491 $count += $this->_filter($user, $info);
507 if($this->users === null) $this->_loadUserData();
509 ksort($this->users);
514 $this->_constructPattern($filter);
516 foreach($this->users as $user => $info) {
517 if($this->_filter($user, $info)) {
550 $value = $this->_filterEscape($value);
586 $this->users = $this->_readUserFile($config_cascade['plainauth.users']['default']);
590 $protected = $this->_readUserFile($config_cascade['plainauth.users']['protected']);
594 $this->users = array_merge($this->users, $protected);
616 $row = $this->_splitUserData($line);
633 if ($this->_pregsplit_safe){
665 foreach($this->_pattern as $item => $pattern) {
683 $this->_pattern = array();
685 … $this->_pattern[$item] = '/'.str_replace('/', '\/', $pattern).'/i'; // allow regex characters
713 if($this->con) return true; // connection already established
715 if($this->getConf('debug')) {
719 $this->bound = 0;
721 $port = $this->getConf('port');
723 $servers = explode(',', $this->getConf('server'));
726 $this->con = @ldap_connect($server, $port);
727 if(!$this->con) {
740 if($this->getConf('version')) {
742 $this->con, LDAP_OPT_PROTOCOL_VERSION,
743 $this->getConf('version')
746 msg('Setting LDAP Protocol version '.$this->getConf('version').' failed', -1);
747 …$this->_debug('LDAP version set: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__…
750 if($this->getConf('starttls')) {
751 if(!@ldap_start_tls($this->con)) {
753 … $this->_debug('LDAP TLS set: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
757 if($this->getConf('referrals') > -1) {
759 $this->con, LDAP_OPT_REFERRALS,
760 $this->getConf('referrals')
764 …$this->_debug('LDAP referal set: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__…
771 if($this->getConf('deref')) {
772 if(!@ldap_set_option($this->con, LDAP_OPT_DEREF, $this->getConf('deref'))) {
773 msg('Setting LDAP Deref mode '.$this->getConf('deref').' failed', -1);
774 … $this->_debug('LDAP deref set: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
779 ldap_set_option($this->con, LDAP_OPT_NETWORK_TIMEOUT, 1);
782 if($this->getConf('binddn') && $this->getConf('bindpw')) {
783 …$bound = @ldap_bind($this->con, $this->getConf('binddn'), conf_decodeString($this->getConf('bindpw…
784 $this->bound = 2;
786 $bound = @ldap_bind($this->con);
795 $this->_debug(ldap_error($this->con), 0, __LINE__, __FILE__);
799 $this->cando['getUsers'] = true;
847 if(!$this->getConf('debug')) return;