]> git.sur5r.net Git - openldap/commitdiff
Allow an object class to be provided in an attribute description list,
authorKurt Zeilenga <kurt@openldap.org>
Thu, 6 Dec 2001 01:02:11 +0000 (01:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 6 Dec 2001 01:02:11 +0000 (01:02 +0000)
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., "+" "*")

servers/slapd/ad.c
servers/slapd/root_dse.c
tests/scripts/test000-rootdse

index f570c0b6d69fc0b3e33ce86e74b3346632eb715f..730ab947631118fd478fc1813f040eee99b0834b 100644 (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;
-
-               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;
index cacce964e3430ce16a82c53f11dae9517c390115..3d975ec4771404a7d560e1455f3b38920d103e97 100644 (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
 };
 
index 54d075e7322dc7f5a1a4eb981db6188c47bc8985..a69fa8092dd3e38763819eed12f7ccd4f8d57720 100755 (executable)
@@ -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..."