]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/dynlist.c
ITS#4720 release csn mutex before checkpointing.
[openldap] / servers / slapd / overlays / dynlist.c
index 163e4daa8552eb3e22b14ce2abfed20d046d5fb4..872ede5e7ae802df04311ab7539b273f0f682ea1 100644 (file)
@@ -24,7 +24,7 @@
 
 #if LDAP_VENDOR_VERSION_MINOR != X && LDAP_VENDOR_VERSION_MINOR < 3
 #define OL_2_2_COMPAT
-#elif defined(LDAP_DEVEL) && SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC
+#elif SLAPD_OVER_DYNGROUP != SLAPD_MOD_STATIC
 #define TAKEOVER_DYNGROUP
 #endif
 
@@ -350,7 +350,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
                        continue;
                }
 
-               if ( lud->lud_host ) {
+               if ( lud->lud_host != NULL ) {
                        /* FIXME: host not allowed; reject as illegal? */
                        Debug( LDAP_DEBUG_ANY, "dynlist_send_entry(\"%s\"): "
                                "illegal URI \"%s\"\n",
@@ -365,6 +365,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
                         * this can be useful in case of a database serving
                         * the empty suffix */
                        BER_BVSTR( &dn, "" );
+
                } else {
                        ber_str2bv( lud->lud_dn, 0, 0, &dn );
                }
@@ -435,6 +436,7 @@ dynlist_send_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
                if ( lud->lud_filter == NULL ) {
                        ber_dupbv_x( &o.ors_filterstr,
                                        &dli->dli_default_filter, op->o_tmpmemctx );
+
                } else {
                        struct berval   flt;
                        ber_str2bv( lud->lud_filter, 0, 0, &flt );
@@ -471,13 +473,9 @@ cleanup:;
                if ( !BER_BVISNULL( &o.o_req_ndn ) ) {
                        op->o_tmpfree( o.o_req_ndn.bv_val, op->o_tmpmemctx );
                }
-               if ( o.ors_filterstr.bv_val != lud->lud_filter ) {
-                       op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx );
-                       lud->lud_filter = NULL;
-               }
-               if ( lud ) {
-                       ldap_free_urldesc( lud );
-               }
+               assert( o.ors_filterstr.bv_val != lud->lud_filter );
+               op->o_tmpfree( o.ors_filterstr.bv_val, op->o_tmpmemctx );
+               ldap_free_urldesc( lud );
        }
 
        rs->sr_entry = e;
@@ -696,7 +694,7 @@ dynlist_build_def_filter( dynlist_info_t *dli )
 
        dli->dli_default_filter.bv_len = STRLENOF( "(!(objectClass=" "))" )
                + dli->dli_oc->soc_cname.bv_len;
-       dli->dli_default_filter.bv_val = SLAP_MALLOC( dli->dli_default_filter.bv_len + 1 );
+       dli->dli_default_filter.bv_val = ch_malloc( dli->dli_default_filter.bv_len + 1 );
        if ( dli->dli_default_filter.bv_val == NULL ) {
                Debug( LDAP_DEBUG_ANY, "dynlist_db_open: malloc failed.\n",
                        0, 0, 0 );
@@ -1345,9 +1343,11 @@ dynlist_db_open(
                        dli->dli_ad = ad;                       
                }
 
-               rc = dynlist_build_def_filter( dli );
-               if ( rc != 0 ) {
-                       return rc;
+               if ( BER_BVISNULL( &dli->dli_default_filter ) ) {
+                       rc = dynlist_build_def_filter( dli );
+                       if ( rc != 0 ) {
+                               return rc;
+                       }
                }
        }