mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
honor T-F filters (ITS#3706)
This commit is contained in:
parent
4199f4577a
commit
b8b0bb000b
@ -1310,6 +1310,10 @@ rwm_db_config(
|
|||||||
char **argv
|
char **argv
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
slap_overinst *on = (slap_overinst *) be->bd_info;
|
||||||
|
struct ldaprwmap *rwmap =
|
||||||
|
(struct ldaprwmap *)on->on_bi.bi_private;
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *argv0 = NULL;
|
char *argv0 = NULL;
|
||||||
|
|
||||||
@ -1327,6 +1331,33 @@ rwm_db_config(
|
|||||||
} else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
|
} else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
|
||||||
rc = rwm_suffixmassage_config( be, fname, lineno, argc, argv );
|
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 {
|
} else {
|
||||||
rc = SLAP_CONF_UNKNOWN;
|
rc = SLAP_CONF_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,11 @@ struct ldaprwmap {
|
|||||||
*/
|
*/
|
||||||
struct ldapmap rwm_oc;
|
struct ldapmap rwm_oc;
|
||||||
struct ldapmap rwm_at;
|
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... */
|
/* Whatever context ldap_back_dn_massage needs... */
|
||||||
@ -110,7 +115,7 @@ void rwm_map ( struct ldapmap *map, struct berval *s, struct berval *m,
|
|||||||
int remap );
|
int remap );
|
||||||
int rwm_mapping ( struct ldapmap *map, struct berval *s,
|
int rwm_mapping ( struct ldapmap *map, struct berval *s,
|
||||||
struct ldapmapping **m, int remap );
|
struct ldapmapping **m, int remap );
|
||||||
#define RWM_MAP 0
|
#define RWM_MAP 0
|
||||||
#define RWM_REMAP 1
|
#define RWM_REMAP 1
|
||||||
char *
|
char *
|
||||||
rwm_map_filter(
|
rwm_map_filter(
|
||||||
|
@ -450,8 +450,18 @@ rwm_int_filter_map_rewrite(
|
|||||||
vtmp,
|
vtmp,
|
||||||
tmp;
|
tmp;
|
||||||
static struct berval
|
static struct berval
|
||||||
|
#if 0
|
||||||
ber_bvfalse = BER_BVC( "(?=false)" ),
|
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)" ),
|
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_bvundefined = BER_BVC( "(?=undefined)" ),
|
||||||
ber_bverror = BER_BVC( "(?=error)" ),
|
ber_bverror = BER_BVC( "(?=error)" ),
|
||||||
ber_bvunknown = BER_BVC( "(?=unknown)" ),
|
ber_bvunknown = BER_BVC( "(?=unknown)" ),
|
||||||
@ -666,11 +676,19 @@ rwm_int_filter_map_rewrite(
|
|||||||
case SLAPD_FILTER_COMPUTED:
|
case SLAPD_FILTER_COMPUTED:
|
||||||
switch ( f->f_result ) {
|
switch ( f->f_result ) {
|
||||||
case LDAP_COMPARE_FALSE:
|
case LDAP_COMPARE_FALSE:
|
||||||
tmp = ber_bvfalse;
|
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
|
||||||
|
tmp = ber_bvtf_false;
|
||||||
|
} else {
|
||||||
|
tmp = ber_bvfalse;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LDAP_COMPARE_TRUE:
|
case LDAP_COMPARE_TRUE:
|
||||||
tmp = ber_bvtrue;
|
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
|
||||||
|
tmp = ber_bvtf_true;
|
||||||
|
} else {
|
||||||
|
tmp = ber_bvtrue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SLAPD_COMPARE_UNDEFINED:
|
case SLAPD_COMPARE_UNDEFINED:
|
||||||
|
Loading…
Reference in New Issue
Block a user