Exemplo n.º 1
0
function FormatLdapValue(&$name, &$value)
{
    $known_binary_fields = array("ciscoecsbuumlocationobjectid", "msexchmailboxsecuritydescriptor", "msexchrecordedname", "sidhistory", "userparameters", "logonhours", "replicationsignature");
    if (preg_match("/(" . implode("|", $known_binary_fields) . ")/i", $name)) {
        return "[Binary Data]";
    }
    if (preg_match("/guid\$/i", $name)) {
        return formatGUID($value[0]);
    }
    if (preg_match("/sid\$/i", $name)) {
        return ConvertBinarySidToSddl($value[0]);
    }
    if (count($value) > 1) {
        return "<ul><li>" . implode("</li><li>", $value) . "</li></ul>";
    }
    return $value[0];
}
function GetUserPrimaryGroupName(&$ldap, &$user, &$ldap_connection)
{
    $user_sddl = ConvertBinarySidToSddl($user[0]["objectsid"][0]);
    $sddl_array = explode("-", $user_sddl);
    array_pop($sddl_array);
    $domain_sddl = implode("-", $sddl_array);
    $primary_group_rid = $user[0]["primarygroupid"][0];
    $sddl = $domain_sddl . "-" . $primary_group_rid;
    $group_name = GetGroupNameFromSddl($ldap, $sddl);
    return $group_name;
}