getMustAttrNames( $schema_oclasses ) );
$all_attrs = array_merge( $all_attrs,
$oclass->getMustAttrNames( $schema_oclasses ),
$oclass->getMayAttrNames( $schema_oclasses ) );
}
}
$required_attrs = array_unique( $required_attrs );
$all_attrs = array_unique( $all_attrs );
remove_aliases( $required_attrs, $server_id );
remove_aliases( $all_attrs, $server_id );
sort( $required_attrs );
sort( $all_attrs );
// if for some reason "ObjectClass" ends up in the list of
// $all_attrs or $required_attrs, remove it! This is a fix
// for bug 927487
foreach( $all_attrs as $i => $attr_name )
if( 0 == strcasecmp( $attr_name, 'objectClass' ) ) {
unset( $all_attrs[$i] );
$all_attrs = array_values( $all_attrs );
break;
}
foreach( $required_attrs as $i => $attr_name )
if( 0 == strcasecmp( $attr_name, 'objectClass' ) ) {
unset( $required_attrs[$i] );
$required_attrs = array_values( $required_attrs );
break;
}
// remove binary attributes and add them to the binary_attrs array
$binary_attrs = array();
foreach( $all_attrs as $i => $attr_name ) {
if( is_attr_binary( $server_id, $attr_name ) ) {
unset( $all_attrs[ $i ] );
$binary_attrs[] = $attr_name;
}
}
// If we trim any attrs out above, then we will have a gap in the index
// sequence and will get an "undefined index" error below. This prevents
// that from happening.
$all_attrs = array_values( $all_attrs );
// add the required attribute based on the RDN provided by the user
// (ie, if the user specifies "cn=Bob" for their RDN, make sure "cn" is
// in the list of required attributes.
$rdn_attr = trim( substr( $rdn, 0, strpos( $rdn, '=' ) ) );
$rdn_value = trim( substr( $rdn, strpos( $rdn, '=' ) + 1 ) );
$rdn_value = @pla_explode_dn( $rdn );
$rdn_value = @explode( '=', $rdn_value[0], 2 );
$rdn_value = @$rdn_value[1];
if( in_array( $rdn_attr, $all_attrs ) && ! in_array( $rdn_attr, $required_attrs ) )
$required_attrs[] = $rdn_attr;
?>