From: Pierangelo Masarati Date: Fri, 12 Feb 2010 08:55:34 +0000 (+0000) Subject: reduce code duplication X-Git-Tag: MIGRATION_CVS2GIT~699 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3cd65c0a5de2fdcfb7517fb7577eb641d32d60ea;p=openldap reduce code duplication --- diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 1b83f9f41d..f936bc7145 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -108,46 +108,12 @@ dynlist_is_dynlist_next( Operation *op, SlapReply *rs, dynlist_info_t *old_dli ) for ( ; dli; dli = dli->dli_next ) { if ( dli->dli_lud != NULL ) { /* check base and scope */ - if ( !BER_BVISNULL( &dli->dli_uri_nbase ) ) { - int d = rs->sr_entry->e_nname.bv_len - dli->dli_uri_nbase.bv_len; - - if ( d < 0 ) { - continue; - } - - if ( !dnIsSuffix( &rs->sr_entry->e_nname, &dli->dli_uri_nbase ) ) { - continue; - } - - switch ( dli->dli_lud->lud_scope ) { - case LDAP_SCOPE_BASE: - if ( d != 0 ) { - continue; - } - break; - - case LDAP_SCOPE_ONELEVEL: { - struct berval pdn; - - dnParent( &rs->sr_entry->e_nname, &pdn ); - if ( pdn.bv_len != dli->dli_uri_nbase.bv_len ) { - continue; - } - } break; - - case LDAP_SCOPE_SUBORDINATE: - if ( d == 0 ) { - continue; - } - break; - - case LDAP_SCOPE_SUBTREE: - case LDAP_SCOPE_DEFAULT: - break; - - default: - continue; - } + if ( !BER_BVISNULL( &dli->dli_uri_nbase ) + && !dnIsSuffixScope( &rs->sr_entry->e_nname, + &dli->dli_uri_nbase, + dli->dli_lud->lud_scope ) ) + { + continue; } /* check filter */