]> git.sur5r.net Git - openldap/commitdiff
honor '!' (objectClass negation) when checking attribute presence in list
authorPierangelo Masarati <ando@openldap.org>
Tue, 16 Dec 2003 01:10:33 +0000 (01:10 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 16 Dec 2003 01:10:33 +0000 (01:10 +0000)
servers/slapd/ad.c

index 51399c39345306ff4ac2c68cd082ad2d311a8437..8543c9b2a4fb2041b32254e133a06ba48fa4f368 100644 (file)
@@ -555,6 +555,42 @@ int ad_inlist(
                        attrs->an_oc = oc;
                }
                if( oc != NULL ) {
+                       if ( attrs->an_oc_exclude ) {
+                               int gotit = 0;
+
+                               if ( oc == slap_schema.si_oc_extensibleObject ) {
+                                       /* extensibleObject allows the return of anything */
+                                       return 0;
+                               }
+
+                               if( oc->soc_required ) {
+                                       /* allow return of required attributes */
+                                       int i;
+                               
+                                       for ( i = 0; oc->soc_required[i] != NULL; i++ ) {
+                                               for (a = desc->ad_type; a; a=a->sat_sup) {
+                                                       if ( a == oc->soc_required[i] ) {
+                                                               return 0;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if( oc->soc_allowed ) {
+                                       /* allow return of allowed attributes */
+                                       int i;
+                                       for ( i = 0; oc->soc_allowed[i] != NULL; i++ ) {
+                                               for (a = desc->ad_type; a; a=a->sat_sup) {
+                                                       if ( a == oc->soc_allowed[i] ) {
+                                                               return 0;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               return 1;
+                       }
+                       
                        if ( oc == slap_schema.si_oc_extensibleObject ) {
                                /* extensibleObject allows the return of anything */
                                return 1;
@@ -563,6 +599,7 @@ int ad_inlist(
                        if( oc->soc_required ) {
                                /* allow return of required attributes */
                                int i;
+                               
                                for ( i = 0; oc->soc_required[i] != NULL; i++ ) {
                                        for (a = desc->ad_type; a; a=a->sat_sup) {
                                                if ( a == oc->soc_required[i] ) {