]> git.sur5r.net Git - openldap/commitdiff
Fix computed TRUE/FALSE filters
authorHoward Chu <hyc@openldap.org>
Tue, 29 Apr 2003 05:58:28 +0000 (05:58 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 29 Apr 2003 05:58:28 +0000 (05:58 +0000)
servers/slapd/filter.c

index 34fa6b9f69f32555a41c949841cc8b27af428891..38f99a7f610931d401b6663eae6f126e62ee2b51 100644 (file)
@@ -212,6 +212,10 @@ get_filter(
                if ( err != LDAP_SUCCESS ) {
                        break;
                }
+               if ( f.f_and == NULL ) {
+                       f.f_choice = SLAPD_FILTER_COMPUTED;
+                       f.f_result = LDAP_COMPARE_TRUE;
+               }
                /* no assert - list could be empty */
                break;
 
@@ -226,6 +230,10 @@ get_filter(
                if ( err != LDAP_SUCCESS ) {
                        break;
                }
+               if ( f.f_or == NULL ) {
+                       f.f_choice = SLAPD_FILTER_COMPUTED;
+                       f.f_result = LDAP_COMPARE_FALSE;
+               }
                /* no assert - list could be empty */
                break;
 
@@ -243,6 +251,21 @@ get_filter(
                }
 
                assert( f.f_not != NULL );
+               if ( f.f_not->f_choice == SLAPD_FILTER_COMPUTED ) {
+                       if ( f.f_not->f_result == LDAP_COMPARE_TRUE ) {
+                               op->o_tmpfree( f.f_not, op->o_tmpmemctx );
+                               f.f_not = NULL;
+                               f.f_choice = SLAPD_FILTER_COMPUTED;
+                               f.f_result = LDAP_COMPARE_FALSE;
+                       } else if ( f.f_not->f_result == LDAP_COMPARE_FALSE ) {
+                               op->o_tmpfree( f.f_not, op->o_tmpmemctx );
+                               f.f_not = NULL;
+                               f.f_choice = SLAPD_FILTER_COMPUTED;
+                               f.f_result = LDAP_COMPARE_TRUE;
+                       }
+                       /* Leave UNDEFINED alone */
+               }
+                               
                break;
 
        case LDAP_FILTER_EXT: