honor T-F filters (ITS#3706)

This commit is contained in:
Pierangelo Masarati 2005-05-04 23:57:33 +00:00
parent 4199f4577a
commit b8b0bb000b
3 changed files with 57 additions and 3 deletions

View File

@ -1310,6 +1310,10 @@ rwm_db_config(
char **argv
)
{
slap_overinst *on = (slap_overinst *) be->bd_info;
struct ldaprwmap *rwmap =
(struct ldaprwmap *)on->on_bi.bi_private;
int rc = 0;
char *argv0 = NULL;
@ -1327,6 +1331,33 @@ rwm_db_config(
} else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
rc = rwm_suffixmassage_config( be, fname, lineno, argc, argv );
} else if ( strcasecmp( argv[0], "t-f-support" ) == 0 ) {
if ( argc != 2 ) {
fprintf( stderr,
"%s: line %d: \"t-f-support {no|yes|discover}\" needs 1 argument.\n",
fname, lineno );
return( 1 );
}
if ( strcasecmp( argv[ 1 ], "no" ) == 0 ) {
rwmap->rwm_flags &= ~(RWM_F_SUPPORT_T_F|RWM_F_SUPPORT_T_F_DISCOVER);
} else if ( strcasecmp( argv[ 1 ], "yes" ) == 0 ) {
rwmap->rwm_flags |= RWM_F_SUPPORT_T_F;
#if 0
/* TODO: not implemented yet */
} else if ( strcasecmp( argv[ 1 ], "discover" ) == 0 ) {
rwmap->rwm_flags |= RWM_F_SUPPORT_T_F_DISCOVER;
#endif
} else {
fprintf( stderr,
"%s: line %d: unknown value \"%s\" for \"t-f-support {no|yes|discover}\".\n",
fname, lineno, argv[ 1 ] );
return 1;
}
} else {
rc = SLAP_CONF_UNKNOWN;
}

View File

@ -80,6 +80,11 @@ struct ldaprwmap {
*/
struct ldapmap rwm_oc;
struct ldapmap rwm_at;
#define RWM_F_NONE 0x0000U
#define RWM_F_SUPPORT_T_F 0x4000U
#define RWM_F_SUPPORT_T_F_DISCOVER 0x8000U
unsigned rwm_flags;
};
/* Whatever context ldap_back_dn_massage needs... */

View File

@ -450,8 +450,18 @@ 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( "(&)" ),
ber_bvundefined = BER_BVC( "(?=undefined)" ),
ber_bverror = BER_BVC( "(?=error)" ),
ber_bvunknown = BER_BVC( "(?=unknown)" ),
@ -666,11 +676,19 @@ rwm_int_filter_map_rewrite(
case SLAPD_FILTER_COMPUTED:
switch ( f->f_result ) {
case LDAP_COMPARE_FALSE:
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
tmp = ber_bvtf_false;
} else {
tmp = ber_bvfalse;
}
break;
case LDAP_COMPARE_TRUE:
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
tmp = ber_bvtf_true;
} else {
tmp = ber_bvtrue;
}
break;
case SLAPD_COMPARE_UNDEFINED: