Esempio n. 1
0
function getsambagroups($type)
{
    global $conf;
    // Si la liste des groupes est defini dans la config on l'utilise
    if ($type == "unix" && isset($conf['samba']['unixgroups'])) {
        return $conf['samba']['unixgroups'];
    }
    if ($type == "smb" && isset($conf['samba']['smbgroups'])) {
        return $conf['samba']['smbgroups'];
    }
    // sinon on interroge LDAP
    $ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
    $filter = "(objectClass=sambaGroupMapping)";
    $rdn = LDAP_BASE;
    $sr = ldap_search($ldapconn, $rdn, $filter);
    $info = ldap_get_entries($ldapconn, $sr);
    ldap_unbind($ldapconn);
    $ret = array();
    for ($i = 0; $i < $info['count']; $i++) {
        $entry = $info[$i];
        $cn = $entry['cn'][0];
        if ($type == "unix") {
            $ret[$cn] = $entry['gidnumber'][0];
        } elseif ($type == "smb") {
            $tmp = explode('-', $entry['sambasid'][0]);
            $ret[$cn] = "-" . array_pop($tmp);
        }
    }
    return $ret;
}
Esempio n. 2
0
 function is_what($login, $what)
 {
     $ldapconnisuid = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
     $filter = "(" . $what . "=" . $login . ")";
     $sr = ldap_search($ldapconnisuid, LDAP_BASE, $filter);
     $info = ldap_get_entries($ldapconnisuid, $sr);
     if ($info['count']) {
         ldap_unbind($ldapconnisuid);
         return $info['count'];
     } else {
         ldap_unbind($ldapconnisuid);
         return FALSE;
     }
 }
Esempio n. 3
0
session_start();
if (isset($_SESSION['login'])) {
    display("D&eacute;connexion");
}
session_unset('EVOADMIN_SESS');
session_destroy();
session_name('EVOADMIN_SESS');
session_start();
/**
 * Case with $_POST data
 * We try to verify login/password
 * and we forward to superadmin.php
 */
if (isset($_POST['login'])) {
    // connexion pour rechercher uid
    $ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
    if ($ldapconn) {
        $login = Html::clean($_POST['login']);
        $filter = "(&(uid=" . $login . ")(isAdmin=TRUE))";
        $sr = ldap_search($ldapconn, LDAP_BASE, $filter);
        $info = ldap_get_entries($ldapconn, $sr);
        if ($info['count']) {
            $bind = @ldap_bind($ldapconn, $info[0]['dn'], $_POST['password']);
            if ($bind) {
                $_SESSION['login'] = $login;
                $_SESSION['dn'] = $info[0]['dn'];
                EvoLog::log("Login success for " . $login);
                header("location: superadmin.php\n\n");
                exit(0);
            } else {
                badauth();