From: Kurt Zeilenga Date: Thu, 6 Dec 2001 01:02:11 +0000 (+0000) Subject: Allow an object class to be provided in an attribute description list, X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~756 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3787c4c7d796f9344d01186d42674653fca71e75;p=openldap 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., "+" "*") --- diff --git a/servers/slapd/ad.c b/servers/slapd/ad.c index f570c0b6d6..730ab94763 100644 --- a/servers/slapd/ad.c +++ b/servers/slapd/ad.c @@ -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; - - rc = is_ad_subtype( desc, ad ); + /* + * 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; + } - 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; diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index cacce964e3..3d975ec477 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -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 }; diff --git a/tests/scripts/test000-rootdse b/tests/scripts/test000-rootdse index 54d075e732..a69fa8092d 100755 --- a/tests/scripts/test000-rootdse +++ b/tests/scripts/test000-rootdse @@ -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..."