From fcab1dd1bc3da4285b35c4fe7d7bcb0836c1511c Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 1 Jul 2006 19:00:27 +0000 Subject: [PATCH] handle computed filters the best it can (ITS#4604) --- servers/slapd/back-sql/search.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index c1ea9952f5..f6a5dcd346 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -654,9 +654,35 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) Debug( LDAP_DEBUG_TRACE, "==>backsql_process_filter()\n", 0, 0, 0 ); if ( f->f_choice == SLAPD_FILTER_COMPUTED ) { + struct berval flt; + char *msg = NULL; + + switch ( f->f_result ) { + case LDAP_COMPARE_TRUE: + BER_BVSTR( &flt, "10=10" ); + msg = "TRUE"; + break; + + case LDAP_COMPARE_FALSE: + BER_BVSTR( &flt, "11=0" ); + msg = "FALSE"; + break; + + case SLAPD_COMPARE_UNDEFINED: + BER_BVSTR( &flt, "12=0" ); + msg = "UNDEFINED"; + break; + + default: + rc = -1; + goto done; + } + Debug( LDAP_DEBUG_TRACE, "backsql_process_filter(): " - "invalid filter\n", 0, 0, 0 ); - rc = -1; + "filter computed (%s)\n", msg, 0, 0 ); + backsql_strfcat_x( &bsi->bsi_flt_where, + bsi->bsi_op->o_tmpmemctx, "b", &flt ); + rc = 1; goto done; } -- 2.39.5