]> git.sur5r.net Git - openldap/commitdiff
reduce code duplication
authorQuanah Gibson-Mount <quanah@openldap.org>
Thu, 15 Apr 2010 00:42:53 +0000 (00:42 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 15 Apr 2010 00:42:53 +0000 (00:42 +0000)
servers/slapd/overlays/dynlist.c

index 706ff597604fc1bc5e7caf29827d1ad7492dcebe..26c357cecafaffc5e7f0ac83cc7b9d7635aff3bc 100644 (file)
@@ -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 */