function is_attr_binary($server_id, $attr_name)
{
    require_once realpath('schema_functions.php');
    $schema_attrs = get_schema_attributes($server_id);
    if (0 == strcasecmp(substr($attr_name, strlen($attr_name) - 7), ";binary")) {
        return true;
    }
    if (isset($schema_attrs[strtolower($attr_name)])) {
        $type = $schema_attrs[strtolower($attr_name)]->getType();
        $syntax = $schema_attrs[strtolower($attr_name)]->getSyntaxOID();
        if (0 == strcasecmp(substr($attr_name, strlen($attr_name) - 7), ";binary") || 0 == strcasecmp($type, 'Certificate') || 0 == strcasecmp($type, 'Binary') || 0 == strcasecmp($attr_name, 'networkAddress') || 0 == strcasecmp($attr_name, 'userCertificate') || 0 == strcasecmp($attr_name, 'userSMIMECertificate') || $syntax == '1.3.6.1.4.1.1466.115.121.1.10' || $syntax == '1.3.6.1.4.1.1466.115.121.1.28' || $syntax == '1.3.6.1.4.1.1466.115.121.1.5' || $syntax == '1.3.6.1.4.1.1466.115.121.1.8' || $syntax == '1.3.6.1.4.1.1466.115.121.1.9') {
            return true;
        } else {
            return false;
        }
    }
    return false;
}
Example #2
0
$friendly_attrs = process_friendly_attr_table();
$attrs = get_object_attrs($server_id, $dn);
pla_ldap_connect($server_id) or pla_error("Could not connect to LDAP server");
$system_attrs = get_entry_system_attrs($server_id, $dn);
if (!$attrs) {
    pla_error("No such dn, " . htmlspecialchars(utf8_decode($dn)));
}
$server_name = $servers[$server_id]['name'];
// build a list of attributes available for this object based on its objectClasses
$oclasses = get_object_attr($server_id, $dn, 'objectClass');
if (!is_array($oclasses)) {
    $oclasses = array($oclasses);
}
$avail_attrs = array();
$schema_oclasses = get_schema_objectclasses($server_id, true);
$schema_attrs = get_schema_attributes($server_id);
foreach ($oclasses as $oclass) {
    $avail_attrs = array_merge($schema_oclasses[strtolower($oclass)]['must_attrs'], $schema_oclasses[strtolower($oclass)]['may_attrs'], $avail_attrs);
}
$avail_attrs = array_unique($avail_attrs);
$avail_attrs = array_filter($avail_attrs, "not_an_attr");
sort($avail_attrs);
$avail_binary_attrs = array();
foreach ($avail_attrs as $i => $attr) {
    if (is_attr_binary($server_id, $attr)) {
        $avail_binary_attrs[] = $attr;
        unset($avail_attrs[$i]);
    }
}
?>
function get_schema_attribute($server_id, $attr_name)
{
    $attr_name = preg_replace("/;.*\$/U", "", $attr_name);
    $schema_attrs = get_schema_attributes($server_id);
    $attr_name = strtolower($attr_name);
    $schema_attr = isset($schema_attrs[$attr_name]) ? $schema_attrs[$attr_name] : null;
    return $schema_attr;
}