]> git.sur5r.net Git - openldap/commitdiff
fix ITS#3785: do our best to deal with invalid filters...
authorPierangelo Masarati <ando@openldap.org>
Thu, 16 Jun 2005 19:27:03 +0000 (19:27 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 16 Jun 2005 19:27:03 +0000 (19:27 +0000)
servers/slapd/back-ldap/search.c
servers/slapd/overlays/rwmmap.c

index 19bddf422ccb4528de93ce5742557e7c31a11429..84b0902f9af51f5f783bc044d40a9ce4fd79f0e1 100644 (file)
@@ -64,6 +64,7 @@ ldap_back_munge_filter(
                static struct berval
                        bv_true = BER_BVC( "(?=true)" ),
                        bv_false = BER_BVC( "(?=false)" ),
+                       bv_undefined = BER_BVC( "(?=undefined)" ),
                        bv_t = BER_BVC( "(&)" ),
                        bv_f = BER_BVC( "(|)" ),
                        bv_T = BER_BVC( "(objectClass=*)" ),
@@ -91,13 +92,18 @@ ldap_back_munge_filter(
                                newbv = &bv_F;
                        }
 
+               } else if ( strncmp( ptr, bv_undefined.bv_val, bv_undefined.bv_len ) == 0 )
+               {
+                       oldbv = &bv_undefined;
+                       newbv = &bv_F;
+
                } else {
                        gotit = 0;
                        goto done;
                }
 
                oldfilter = *filter;
-               if ( !( li->flags & LDAP_BACK_F_SUPPORT_T_F ) ) {
+               if ( newbv->bv_len > oldbv->bv_len ) {
                        filter->bv_len += newbv->bv_len - oldbv->bv_len;
                        if ( filter->bv_val == op->ors_filterstr.bv_val ) {
                                filter->bv_val = op->o_tmpalloc( filter->bv_len + 1,
index bfa40a1de139ac0224b044084bdeca59e9560bf1..c201744ae08c9afa1d690193f666d6879b86b67d 100644 (file)
@@ -450,15 +450,9 @@ rwm_int_filter_map_rewrite(
                        vtmp,
                        tmp;
        static struct berval
-#if 0
-                       ber_bvfalse = BER_BVC( "(?=false)" ),
-#endif
                        /* better than nothing... */
                        ber_bvfalse = BER_BVC( "(!(objectClass=*))" ),
                        ber_bvtf_false = BER_BVC( "(|)" ),
-#if 0
-                       ber_bvtrue = BER_BVC( "(?=true)" ),
-#endif
                        /* better than nothing... */
                        ber_bvtrue = BER_BVC( "(objectClass=*)" ),
                        ber_bvtf_true = BER_BVC( "(&)" ),
@@ -678,9 +672,12 @@ rwm_int_filter_map_rewrite(
                case LDAP_COMPARE_FALSE:
                        if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
                                tmp = ber_bvtf_false;
-                       } else {
-                               tmp = ber_bvfalse;
+                               break;
                        }
+                       /* fallthru */
+
+               case SLAPD_COMPARE_UNDEFINED:
+                       tmp = ber_bvfalse;
                        break;
 
                case LDAP_COMPARE_TRUE:
@@ -691,10 +688,6 @@ rwm_int_filter_map_rewrite(
                        }
                        break;
                        
-               case SLAPD_COMPARE_UNDEFINED:
-                       tmp = ber_bvundefined;
-                       break;
-                       
                default:
                        tmp = ber_bverror;
                        break;