]> 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:19:11 +0000 (19:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 16 Jun 2005 19:19:11 +0000 (19:19 +0000)
servers/slapd/back-meta/map.c

index 62533e339fce054531d0467a6c0a4becffd38ced..87ca4b903175cdae6c7750b8098848d40bea291b 100644 (file)
@@ -483,43 +483,40 @@ ldap_back_int_filter_map_rewrite(
                ber_memfree( vtmp.bv_val );
                break;
 
-       case SLAPD_FILTER_COMPUTED:
+       case SLAPD_FILTER_COMPUTED: {
+               struct berval   bv;
+
                switch ( f->f_result ) {
                case LDAP_COMPARE_FALSE:
                        if ( dc->target->mt_flags & LDAP_BACK_F_SUPPORT_T_F ) {
-                               ber_str2bv( "(|)", STRLENOF( "(|)" ), 1, fstr );
-
-                       } else {
-#if 0
-                               ber_str2bv( "(?=false)", STRLENOF( "(?=false)" ), 1, fstr );
-#endif
-                               /* better than nothing... */
-                               ber_str2bv( "(!(objectClass=*))", STRLENOF( "(!(objectClass=*))" ), 1, fstr );
+                               BER_BVSTR( &bv, "(|)" );
+                               break;
                        }
+                       /* fallthru */
+
+               /* FIXME: treat UNDEFINED as FALSE */
+               case SLAPD_COMPARE_UNDEFINED:
+                       /* better than nothing... */
+                       BER_BVSTR( &bv, "(!(objectClass=*))" );
                        break;
 
                case LDAP_COMPARE_TRUE:
                        if ( dc->target->mt_flags & LDAP_BACK_F_SUPPORT_T_F ) {
-                               ber_str2bv( "(&)", STRLENOF( "(&)" ), 1, fstr );
-
-                       } else {
-#if 0
-                               ber_str2bv( "(?=true)", STRLENOF( "(?=true)" ), 1, fstr );
-#endif
-                               /* better than nothing... */
-                               ber_str2bv( "(objectClass=*)", STRLENOF( "(objectClass=*)" ), 1, fstr );
+                               BER_BVSTR( &bv, "(&)" );
+                               break;
                        }
-                       break;
 
-               case SLAPD_COMPARE_UNDEFINED:
-                       ber_str2bv( "(?=undefined)", STRLENOF( "(?=undefined)" ), 1, fstr );
+                       /* better than nothing... */
+                       BER_BVSTR( &bv, "(objectClass=*)" );
                        break;
 
                default:
-                       ber_str2bv( "(?=error)", STRLENOF( "(?=error)" ), 1, fstr );
+                       BER_BVSTR( &bv, "(?=error)" );
                        break;
                }
-               break;
+
+               ber_dupbv( fstr, &bv );
+               } break;
 
        default:
                ber_str2bv( "(?=unknown)", STRLENOF( "(?=unknown)" ), 1, fstr );