Allow an object class to be provided in an attribute description list,

treated as a request for all required and allowed attributes of the class.
This allows:
	ldapsearch (objectClass=*) inetOrgPerson
	(requests return of all attributes of inetOrgPerson)
and
	ldapsearch (objectClass=*) extensibleObject
	(requests return of all attributes, e.g., "+" "*")
This commit is contained in:
Kurt Zeilenga 2001-12-06 01:02:11 +00:00
parent 2b925e2102
commit 3787c4c7d7
3 changed files with 37 additions and 5 deletions

View File

@ -275,17 +275,48 @@ int ad_inlist(
{
int i;
for( i=0; attrs[i] != NULL; i++ ) {
ObjectClass *oc;
AttributeDescription *ad = NULL;
const char *text;
int rc;
rc = slap_str2ad( attrs[i], &ad, &text );
if( rc == LDAP_SUCCESS ) {
rc = is_ad_subtype( desc, ad );
if( rc ) return 1;
continue;
}
if( rc != LDAP_SUCCESS ) continue;
/*
* EXTENSION: see if requested description is an object class
* if so, return attributes which the class requires/allows
*/
oc = oc_find( attrs[i] );
if( oc != NULL ) {
if ( oc == slap_schema.si_oc_extensibleObject ) {
/* extensibleObject allows the return of anything */
return 1;
}
rc = is_ad_subtype( desc, ad );
if( rc ) return 1;
if( oc->soc_required ) {
/* allow return of required attributes */
int i;
for ( i = 0; oc->soc_required[i] != NULL; i++ ) {
rc = is_at_subtype( desc->ad_type,
oc->soc_allowed[i] );
if( rc ) return 1;
}
}
if( oc->soc_allowed ) {
/* allow return of allowed attributes */
int i;
for ( i = 0; oc->soc_allowed[i] != NULL; i++ ) {
rc = is_at_subtype( desc->ad_type,
oc->soc_allowed[i] );
if( rc ) return 1;
}
}
}
}
return 0;

View File

@ -20,6 +20,7 @@
static char *supportedFeatures[] = {
"1.3.6.1.4.1.4203.1.5.1", /* All Operational Attributes ("+") */
"1.3.6.1.4.1.4203.1.5.2", /* OCs in Attributes List */
NULL
};

View File

@ -35,7 +35,7 @@ fi
echo "Using ldapsearch to retrieve all the entries..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -b "" -s base -h localhost:$PORT '+' > $SEARCHOUT 2>&1
$LDAPSEARCH -b "" -s base -h localhost:$PORT 'extensibleObject' > $SEARCHOUT 2>&1
RC=$?
if test $RC = 1 ; then
echo "Waiting 5 seconds for slapd to start..."