$u->private_mobile = ''; $u->company = ''; $u->streetaddress = ''; $u->roomnumber = ''; $u->title = ''; $u->memberof = ''; $u->thumbnailphoto = ''; $u->hlmttufimemployeestatus = ''; //$u->lastlogontimestamp = ''; $u->countrycode = ''; //$u->altsecurityidentities = ''; if (!$ad->search($p->uname, $u)) { $t->errors[ERROR][] = 'L005 ' . $l->txt_err_authentication; // show_login_page($t, $o); } $ad->disconnect(); unset($ad); // seadista kasutaja objekt $w->memberof = ''; $e = explode(';', $u->memberof); $delim = ''; while (list($k, $v) = each($e)) { $j = explode(',', $v); if (count($j) > 1) { while (list($kk, $vv) = each($j)) { if (strstr($vv, 'CN=')) { $w->memberof .= $delim . substr($vv, 3); $delim = ';'; } } }
public static function prefsIsValid($prefs_, &$log = array()) { $config_ldap = $prefs_->get('UserDB', 'ldap'); $LDAP2 = new LDAP($config_ldap); $ret = $LDAP2->connect($log); if ($ret === false) { return false; } $ret = $LDAP2->branch_exists($config_ldap['userbranch']); if ($ret == false) { $log['LDAP user branch'] = false; $LDAP2->disconnect(); return false; } else { $log['LDAP user branch'] = true; } return true; }
public static function prefsIsValid($prefs_, &$log = array()) { $config_AD = $prefs_->get('UserDB', 'activedirectory'); $minimum_keys = array('hosts', 'domain', 'login', 'password', 'domain'); foreach ($minimum_keys as $m_key) { if (!isset($config_AD[$m_key])) { $log['config_AD has key ' . $m_key] = false; return false; } // else { // $log['config_AD has key '.$m_key] = true; // } } $ldap_suffix = domain2suffix($config_AD['domain']); if (!$ldap_suffix) { $log['domain2suffix for \'' . $config_AD['domain'] . '\''] = false; return false; } $log['domain2suffix for \'' . $config_AD['domain'] . '\''] = true; if (!UserDB_ldap::isValidDN($ldap_suffix)) { $log['isValidDN for \'' . $ldap_suffix . '\''] = false; return false; } $log['isValidDN for \'' . $ldap_suffix . '\''] = true; $config_ldap = self::makeLDAPconfig($config_AD); $LDAP2 = new LDAP($config_ldap); $ret = $LDAP2->connect($log); if ($ret === false) { // $log['LDAP connect to \''.$config_ldap['host'].'\''] = false; return false; } // $log['Connect to AD'] = true; $LDAP2->disconnect(); return true; }
public static function prefsIsValid($prefs_, &$log = array()) { $config_ldap = $prefs_->get('UserDB', 'ldap'); $LDAP2 = new LDAP($config_ldap); $ret = $LDAP2->connect($log); $LDAP2->disconnect(); if ($ret === false) { return false; } if (is_null(LDAP::join_filters(array($config_ldap['filter']), '|'))) { $log['LDAP user filter'] = false; return false; } $log['LDAP user filter'] = true; if (!array_keys_exists_not_empty(array('login', 'displayname'), $config_ldap['match'])) { $log['LDAP users match'] = false; return false; } $log['LDAP users match'] = true; return true; }