summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-11-22 15:17:44 -0500
committerSimo Sorce <ssorce@redhat.com>2010-11-23 11:40:38 -0500
commitaa70959f16bc9111798e14da5371c34438a7c146 (patch)
treeb97b855c7e9ebe062125a6cd6960d5c28012afea /daemons/ipa-slapi-plugins
parent960fc6644714c1231a0822bc24b0750c873557df (diff)
downloadfreeipa-aa70959f16bc9111798e14da5371c34438a7c146.tar.gz
freeipa-aa70959f16bc9111798e14da5371c34438a7c146.tar.xz
freeipa-aa70959f16bc9111798e14da5371c34438a7c146.zip
Fix modrdn plugin crash bug.
Constant values were assigned to variables gthat would later be freed with slapi_ch_free_string(). Make copies instead so the free doesn't blow. Also remove useless tests, as these functions already check for NULL on their own. Fixes: https://fedorahosted.org/freeipa/ticket/529
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
index 5a0cef573..42f1da969 100644
--- a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
+++ b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
@@ -444,7 +444,7 @@ ipamodrdn_parse_config_entry(Slapi_Entry * e, bool apply)
if (value && value[0]) {
entry->prefix = value;
} else {
- entry->prefix = "";
+ entry->prefix = slapi_ch_strdup("");
}
LOG_CONFIG("----------> %s [%s]\n", IPAMODRDN_PREFIX, entry->prefix);
@@ -452,7 +452,7 @@ ipamodrdn_parse_config_entry(Slapi_Entry * e, bool apply)
if (value && value[0]) {
entry->suffix = value;
} else {
- entry->suffix = "";
+ entry->suffix = slapi_ch_strdup("");
}
LOG_CONFIG("----------> %s [%s]\n", IPAMODRDN_SUFFIX, entry->suffix);
@@ -556,30 +556,15 @@ ipamodrdn_free_config_entry(struct configEntry **entry)
if (e->dn) {
LOG_CONFIG("freeing config entry [%s]\n", e->dn);
- slapi_ch_free_string(&e->dn);
}
- if (e->sattr) {
- slapi_ch_free_string(&e->sattr);
- }
- if (e->tattr) {
- slapi_ch_free_string(&e->tattr);
- }
- if (e->prefix) {
- slapi_ch_free_string(&e->prefix);
- }
- if (e->suffix) {
- slapi_ch_free_string(&e->prefix);
- }
- if (e->filter) {
- slapi_ch_free_string(&e->filter);
- }
- if (e->slapi_filter) {
- slapi_filter_free(e->slapi_filter, 1);
- }
- if (e->scope) {
- slapi_ch_free_string(&e->scope);
- }
-
+ slapi_ch_free_string(&e->dn);
+ slapi_ch_free_string(&e->sattr);
+ slapi_ch_free_string(&e->tattr);
+ slapi_ch_free_string(&e->prefix);
+ slapi_ch_free_string(&e->suffix);
+ slapi_ch_free_string(&e->filter);
+ slapi_filter_free(e->slapi_filter, 1);
+ slapi_ch_free_string(&e->scope);
slapi_ch_free((void **)entry);
}