From: Howard Chu Date: Sun, 9 Oct 2022 10:51:54 +0000 (+0100) Subject: ITS#9929 dynlist: avoid unnecessary search for dynamic lists X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a64320d8abd8b1bd894e08b152fea90924d78293;p=thirdparty%2Fopenldap.git ITS#9929 dynlist: avoid unnecessary search for dynamic lists --- diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 1fcbcbb35d..769c3dbd2b 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -1708,13 +1708,24 @@ dynlist_search( Operation *op, SlapReply *rs ) /* Find all groups in scope. For group expansion * we only need the groups within the search scope, but * for memberOf populating, we need all dyngroups. + * + * We ignore dynamic lists here; they're handled later. */ for ( dli = dlg->dlg_dli; dli; dli = dli->dli_next ) { + int got_dn = 1; static_oc = NULL; nested = 0; tmpwant = 0; if ( dlg->dlg_memberOf ) { + if ( !dli->dli_dlm ) + continue; + for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) { + if ( dlm->dlm_mapped_ad ) { + got_dn = 0; + break; + } + if ( dlm->dlm_memberOf_ad ) { int want = 0; @@ -1774,6 +1785,9 @@ dynlist_search( Operation *op, SlapReply *rs ) } } + if ( !got_dn ) + continue; + if ( static_oc ) { f[0].f_choice = LDAP_FILTER_OR; f[0].f_list = &f[1];