From 9e88e197f20a08c7ce21d209d1f6f19e6c229709 Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Sep 12 2019 13:51:57 +0000 Subject: Issue 50506 - Fix regression for relication stripattrs Bug: When parsing the provided attribute value, a reference was used and modified, the original attribute was corrupted Fix: Use a copy for parsing Reviewed by: ? --- diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c index f2f16f5..2948270 100644 --- a/ldap/servers/plugins/replication/repl5_agmt.c +++ b/ldap/servers/plugins/replication/repl5_agmt.c @@ -530,9 +530,10 @@ agmt_new_from_entry(Slapi_Entry *e) * Extract the attributes to strip for "empty" mods */ ra->attrs_to_strip = NULL; - tmpstr = (char *)slapi_entry_attr_get_ref(e, type_nsds5ReplicaStripAttrs); + tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs); if (NULL != tmpstr) { ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0); + slapi_ch_free_string(&tmpstr); } if (!agmt_is_valid(ra)) { @@ -2954,7 +2955,7 @@ agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e) { char *tmpstr = NULL; - tmpstr = (char *)slapi_entry_attr_get_ref(e, type_nsds5ReplicaStripAttrs); + tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs); PR_Lock(ra->lock); if (ra->attrs_to_strip) { @@ -2964,6 +2965,7 @@ agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e) ra->attrs_to_strip = NULL; } else { ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0); + slapi_ch_free_string(&tmpstr); } PR_Unlock(ra->lock);