mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-16 20:06:06 -05:00
Add slapi_x_filter_set_attribute_type() API
This commit is contained in:
parent
9e9c4b5397
commit
5eda803bc1
2 changed files with 44 additions and 0 deletions
|
|
@ -211,6 +211,7 @@ extern int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **b
|
|||
extern Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
|
||||
extern Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
|
||||
extern int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type );
|
||||
extern int slapi_x_filter_set_attribute_type( Slapi_Filter *f, const char *type );
|
||||
extern int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
|
||||
char ***any, char **final );
|
||||
extern Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2);
|
||||
|
|
|
|||
|
|
@ -1938,6 +1938,49 @@ slapi_filter_get_attribute_type( Slapi_Filter *f, char **type )
|
|||
#endif /* LDAP_SLAPI */
|
||||
}
|
||||
|
||||
int
|
||||
slapi_x_filter_set_attribute_type( Slapi_Filter *f, const char *type )
|
||||
{
|
||||
#ifdef LDAP_SLAPI
|
||||
AttributeDescription **adp, *ad = NULL;
|
||||
const char *text;
|
||||
int rc;
|
||||
|
||||
if ( f == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch ( f->f_choice ) {
|
||||
case LDAP_FILTER_GE:
|
||||
case LDAP_FILTER_LE:
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
case LDAP_FILTER_APPROX:
|
||||
adp = &f->f_av_desc;
|
||||
break;
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
adp = &f->f_sub_desc;
|
||||
break;
|
||||
case LDAP_FILTER_PRESENT:
|
||||
adp = &f->f_desc;
|
||||
break;
|
||||
case LDAP_FILTER_EXT:
|
||||
adp = &f->f_mr_desc;
|
||||
break;
|
||||
default:
|
||||
/* Complex filters need not apply. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = slap_str2ad( type, &ad, &text );
|
||||
if ( rc == LDAP_SUCCESS )
|
||||
*adp = ad;
|
||||
|
||||
return ( rc == LDAP_SUCCESS ) ? 0 : -1;
|
||||
#else
|
||||
return -1;
|
||||
#endif /* LDAP_SLAPI */
|
||||
}
|
||||
|
||||
int
|
||||
slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
|
||||
char ***any, char **final )
|
||||
|
|
|
|||
Loading…
Reference in a new issue