From: Howard Chu Date: Thu, 21 Apr 2022 14:40:14 +0000 (+0100) Subject: ITS#9825 dynlist: don't lose earlier filter elements X-Git-Tag: OPENLDAP_REL_ENG_2_5_12~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbb574908c9bd93563ddfe80ed2f5e1625c8938f;p=thirdparty%2Fopenldap.git ITS#9825 dynlist: don't lose earlier filter elements --- diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index b04f65c0c6..3490cfb640 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -1208,13 +1208,16 @@ dynlist_filter_stgroup( Operation *op, Filter *n, Attribute *a ) Filter *dnf, *orf = NULL; int i; - if ( a->a_numvals == 1 ) { + if ( a->a_numvals == 1 && n->f_choice == SLAPD_FILTER_COMPUTED ) { dnf = n; } else { orf = n; - orf->f_choice = LDAP_FILTER_OR; + if ( n->f_choice != LDAP_FILTER_OR ) { + orf->f_choice = LDAP_FILTER_OR; + orf->f_list = NULL; + } dnf = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx ); - dnf->f_next = NULL; + dnf->f_next = orf->f_list; orf->f_list = dnf; } @@ -1298,9 +1301,9 @@ dynlist_filter_dup( Operation *op, Filter *f, AttributeDescription *ad, dynlist_ break; case LDAP_FILTER_EQUALITY: - n->f_choice = SLAPD_FILTER_COMPUTED; if ( f->f_av_desc == ad ) { dynlist_name_t *dyn = ldap_tavl_find( ds->ds_names, &f->f_av_value, dynlist_avl_cmp ); + n->f_choice = SLAPD_FILTER_COMPUTED; if ( dyn && !dynlist_filter_group( op, dyn, n, ds )) break; }