[389-commits] 4 commits - ldap/servers

Richard Allen Megginson rmeggins at fedoraproject.org
Fri Mar 2 21:33:20 UTC 2012


 ldap/servers/plugins/dna/dna.c                      |    8 +++++---
 ldap/servers/plugins/mep/mep.c                      |    3 ++-
 ldap/servers/slapd/back-ldbm/ldbm_instance_config.c |    8 ++++----
 ldap/servers/slapd/util.c                           |    7 ++-----
 4 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 93adf5f97832e5ec1539953feb11c060d30554eb
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Mar 1 19:27:09 2012 -0700

    destroy the entry cache and dn cache in the dse post op delete callback
    
    don't destroy the entry and dn cache in the ldbm instance pre op delete
    callback because other preop callback may attempt to access the
    caches - wait and destroy it in the dse post op delete callback
    Reviewed by: nhosoi (Thanks!)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 88b20d0..f41bd88 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -1091,6 +1091,10 @@ ldbm_instance_post_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry*
 
     LDAPDebug(LDAP_DEBUG_ANY, "ldbm: removing '%s'.\n", instance_name, 0, 0);
 
+    cache_destroy_please(&inst->inst_cache, CACHE_TYPE_ENTRY);
+    if (entryrdn_get_switch()) { /* subtree-rename: on */
+        cache_destroy_please(&inst->inst_dncache, CACHE_TYPE_DN);
+    }
     {
         struct ldbminfo *li = (struct ldbminfo *) inst->inst_be->be_database->plg_private;
         dblayer_private *priv = (dblayer_private*) li->li_dblayer_private;
@@ -1211,10 +1215,6 @@ ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entr
               instance_name, 0, 0);
     slapi_mtn_be_stopping(inst->inst_be);
     dblayer_instance_close(inst->inst_be);
-    cache_destroy_please(&inst->inst_cache, CACHE_TYPE_ENTRY);
-    if (entryrdn_get_switch()) { /* subtree-rename: on */
-        cache_destroy_please(&inst->inst_dncache, CACHE_TYPE_DN);
-    }
     slapi_ch_free((void **)&instance_name);
 
     return SLAPI_DSE_CALLBACK_OK;


commit f6e4d3d0d4313ef9b4396ab8433a1c260989274b
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Mar 1 18:50:05 2012 -0700

    memleak in normalize_mods2bvals
    
    do not re malloc the berval again - only need to do it once
    Reviewed by: nhosoi (Thanks!)

diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 9cd3656..649b3a9 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -464,16 +464,13 @@ normalize_mods2bvals(const LDAPMod **mods)
                  normmbvp = normalized_mods[w]->mod_bvalues; 
                  mvp && *mvp; mvp++, normmbvp++)
             {
-                *normmbvp = 
-                    (struct berval *)slapi_ch_malloc(sizeof(struct berval));
-        
                 vlen = strlen(*mvp);
 
+                *normmbvp = 
+                    (struct berval *)slapi_ch_malloc(sizeof(struct berval));
                 if (is_dn_syntax) {
                     Slapi_DN *sdn = slapi_sdn_new_dn_byref(*mvp);
                     if (slapi_sdn_get_dn(sdn)) {
-                        *normmbvp = 
-                        (struct berval *)slapi_ch_malloc(sizeof(struct berval));
                         (*normmbvp)->bv_val = 
                                   slapi_ch_strdup(slapi_sdn_get_dn(sdn));
                         (*normmbvp)->bv_len = slapi_sdn_get_ndn_len(sdn);


commit 54fbe0b3b3669a0379a4b0a50769b4855539c225
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Mar 1 18:47:34 2012 -0700

    memleak in mep_parse_config_entry
    
    pass in value to slapi_sdn_new_dn_passin() so that entry->template_sdn
    will own the memory
    Reviewed by: nhosoi (Thanks!)

diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index b51c241..f8e3c2b 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -626,7 +626,8 @@ mep_parse_config_entry(Slapi_Entry * e, int apply)
     if (value) {
         Slapi_Entry *test_entry = NULL;
 
-        entry->template_sdn = slapi_sdn_new_dn_byval(value); 
+        entry->template_sdn = slapi_sdn_new_dn_passin(value);
+        value = NULL; /* entry->template_sdn owns value now */
 
         /*  Fetch the managed entry template */
         slapi_search_internal_get_entry(entry->template_sdn, 0,


commit afd6b1fd63c48642dd050e0e821b3d7c69fc4991
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Wed Feb 29 17:27:32 2012 -0700

    handle null smods
    
    Under certain error conditions, smods will be NULL at the end of the function.
    Do not call passout if smods is NULL.
    Reviewed by: nhosoi (Thanks!)

diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index d1aa74c..7ace2b1 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -3493,9 +3493,11 @@ bail:
 
     if (LDAP_CHANGETYPE_MODIFY == modtype) {
         /* Put the updated mods back into place. */
-        mods = slapi_mods_get_ldapmods_passout(smods);
-        slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
-        slapi_mods_free(&smods);
+        if (smods) { /* smods == NULL if we bailed before initializing it */
+            mods = slapi_mods_get_ldapmods_passout(smods);
+            slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
+            slapi_mods_free(&smods);
+        }
     }
 
     slapi_ch_array_free(generated_types);




More information about the 389-commits mailing list