This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new f6c7e2c Issue 50620 - Fix regressions from 50506 (slapi_enry_attr_get_ref)
f6c7e2c is described below
commit f6c7e2cb396936ee0746b2a72c03866e5c1d4f46
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Sep 24 12:43:48 2019 -0400
Issue 50620 - Fix regressions from 50506 (slapi_enry_attr_get_ref)
Description: Some crashes were found in upstream testing. Needed
to revert slapi_entry_attr_get_ref() back to
slapi_entry_attr_get_charptr()
relates:
https://pagure.io/389-ds-base/issue/50620
Reviewed by: tbordaz(Thanks!)
---
ldap/servers/plugins/automember/automember.c | 6 ++-
ldap/servers/plugins/dna/dna.c | 48 +++++++++++++++-------
ldap/servers/plugins/mep/mep.c | 4 +-
ldap/servers/plugins/pam_passthru/pam_ptconfig.c | 3 +-
.../plugins/replication/windows_protocol_util.c | 3 +-
ldap/servers/plugins/roles/roles_cache.c | 7 +++-
ldap/servers/slapd/back-ldbm/ldbm_add.c | 3 +-
ldap/servers/slapd/back-ldbm/ldbm_index_config.c | 8 ++--
8 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/ldap/servers/plugins/automember/automember.c
b/ldap/servers/plugins/automember/automember.c
index d7919a0..185fc26 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -584,7 +584,7 @@ automember_parse_config_entry(Slapi_Entry *e, int apply)
}
/* Load the filter */
- value = (char *)slapi_entry_attr_get_ref(e, AUTOMEMBER_FILTER_TYPE);
+ value = slapi_entry_attr_get_charptr(e, AUTOMEMBER_FILTER_TYPE);
if (value) {
/* Convert to a Slapi_Filter to improve performance. */
if (NULL == (entry->filter = slapi_str2filter(value))) {
@@ -595,6 +595,7 @@ automember_parse_config_entry(Slapi_Entry *e, int apply)
AUTOMEMBER_FILTER_TYPE, entry->dn, value);
ret = -1;
}
+ slapi_ch_free_string(&value);
if (ret != 0) {
goto bail;
}
@@ -993,7 +994,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry
*e)
"--> automember_parse_regex_entry\n");
/* Make sure the target group was specified. */
- target_group = (char *)slapi_entry_attr_get_ref(e, AUTOMEMBER_TARGET_GROUP_TYPE);
+ target_group = slapi_entry_attr_get_charptr(e, AUTOMEMBER_TARGET_GROUP_TYPE);
if (!target_group) {
slapi_log_err(SLAPI_LOG_ERR, AUTOMEMBER_PLUGIN_SUBSYSTEM,
"automember_parse_regex_entry - The %s config "
@@ -1142,6 +1143,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry
*e)
}
bail:
+ slapi_ch_free_string(&target_group);
slapi_log_err(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM,
"<-- automember_parse_regex_entry\n");
}
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index a63bac9..1ee2713 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -988,9 +988,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
"----------> %s [%s]\n", DNA_TYPE,
entry->types[i]);
}
- value = (char *)slapi_entry_attr_get_ref(e, DNA_NEXTVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_NEXTVAL);
if (value) {
entry->nextval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
slapi_log_err(SLAPI_LOG_ERR, DNA_PLUGIN_SUBSYSTEM,
"dna_parse_config_entry - The %s config "
@@ -1023,9 +1024,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int
apply)
entry->interval = 1;
#ifdef DNA_ENABLE_INTERVAL
- value = (char *)slapi_entry_attr_get_ref(e, DNA_INTERVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_INTERVAL);
if (value) {
entry->interval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
}
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
@@ -1121,9 +1123,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int
apply)
/* optional, if not specified set -1 which is converted to the max unsigned
* value */
- value = (char *)slapi_entry_attr_get_ref(e, DNA_MAXVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_MAXVAL);
if (value) {
entry->maxval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
entry->maxval = -1;
}
@@ -1246,7 +1249,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
entry->shared_cfg_base);
}
- value = (char *)slapi_entry_attr_get_ref(e, DNA_THRESHOLD);
+ value = slapi_entry_attr_get_charptr(e, DNA_THRESHOLD);
if (value) {
entry->threshold = strtoull(value, 0, 0);
@@ -1258,6 +1261,8 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
slapi_log_err(SLAPI_LOG_ERR, DNA_PLUGIN_SUBSYSTEM,
"----------> %s too low, setting to [%s]\n",
DNA_THRESHOLD, value);
}
+
+ slapi_ch_free_string(&value);
} else {
entry->threshold = 1;
}
@@ -1266,9 +1271,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int
apply)
"dna_parse_config_entry - %s [%" PRIu64 "]\n",
DNA_THRESHOLD,
entry->threshold);
- value = (char *)slapi_entry_attr_get_ref(e, DNA_RANGE_REQUEST_TIMEOUT);
+ value = slapi_entry_attr_get_charptr(e, DNA_RANGE_REQUEST_TIMEOUT);
if (value) {
entry->timeout = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
entry->timeout = DNA_DEFAULT_TIMEOUT;
}
@@ -1277,7 +1283,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
"dna_parse_config_entry - %s [%" PRIu64 "]\n",
DNA_RANGE_REQUEST_TIMEOUT,
entry->timeout);
- value = (char *)slapi_entry_attr_get_ref(e, DNA_NEXT_RANGE);
+ value = slapi_entry_attr_get_charptr(e, DNA_NEXT_RANGE);
if (value) {
char *p = NULL;
@@ -1323,6 +1329,8 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
DNA_NEXT_RANGE, entry->dn);
ret = DNA_FAILURE;
}
+
+ slapi_ch_free_string(&value);
}
/* If we were only called to validate config, we can
@@ -2287,7 +2295,7 @@ dna_first_free_value(struct configEntry *config_entry,
int multitype = 0;
int result, status;
PRUint64 tmpval, sval, i;
- const char *strval = NULL;
+ char *strval = NULL;
/* check if the config is already out of range */
if (config_entry->nextval > config_entry->maxval) {
@@ -2411,7 +2419,7 @@ dna_first_free_value(struct configEntry *config_entry,
* type from the list of types directly. */
sval = 0;
for (i = 0; NULL != entries[i]; i++) {
- strval = slapi_entry_attr_get_ref(entries[i], config_entry->types[0]);
+ strval = slapi_entry_attr_get_charptr(entries[i],
config_entry->types[0]);
errno = 0;
sval = strtoull(strval, 0, 0);
if (errno) {
@@ -2419,6 +2427,7 @@ dna_first_free_value(struct configEntry *config_entry,
status = LDAP_OPERATIONS_ERROR;
goto cleanup;
}
+ slapi_ch_free_string(&strval);
if (tmpval != sval)
break;
@@ -2444,6 +2453,7 @@ dna_first_free_value(struct configEntry *config_entry,
cleanup:
slapi_ch_free_string(&filter);
+ slapi_ch_free_string(&strval);
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
@@ -2964,7 +2974,7 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server,
char **bind
char *attrs[6];
char *filter = NULL;
char *bind_cred = NULL;
- const char *transport = NULL;
+ char *transport = NULL;
Slapi_Entry **entries = NULL;
int ret = LDAP_OPERATIONS_ERROR;
@@ -3049,7 +3059,7 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server,
char **bind
*bind_dn = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_BIND_DN);
*bind_method = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_BIND_METHOD);
bind_cred = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_CREDS);
- transport = slapi_entry_attr_get_ref(entries[0], DNA_REPL_TRANSPORT);
+ transport = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_TRANSPORT);
*port = slapi_entry_attr_get_int(entries[0], DNA_REPL_PORT);
/* Check if we should use SSL */
@@ -3106,10 +3116,11 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer
*server, char **bind
ret = 0;
bail:
- slapi_ch_free_string(&bind_cred);
+ slapi_ch_free_string(&transport);
slapi_ch_free_string(&filter);
slapi_sdn_free(&range_sdn);
slapi_ch_free_string(&replica_dn);
+ slapi_ch_free_string(&bind_cred);
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
@@ -3468,21 +3479,24 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
* for types where the magic value is set. We do not
* generate a value for missing types. */
for (i = 0; config_entry->types && config_entry->types[i];
i++) {
- value = (char *)slapi_entry_attr_get_ref(e,
config_entry->types[i]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[i]);
if (value) {
if (config_entry->generate == NULL ||
!slapi_UTF8CASECMP(config_entry->generate, value)) {
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[i]));
}
+ slapi_ch_free_string(&value);
}
}
} else {
/* For a single type range, we generate the value if
* the magic value is set or if the type is missing. */
- value = (char *)slapi_entry_attr_get_ref(e, config_entry->types[0]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[0]);
+
if ((config_entry->generate == NULL) || (0 == value) ||
(value && !slapi_UTF8CASECMP(config_entry->generate,
value))) {
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[0]));
}
+ slapi_ch_free_string(&value);
}
if (types_to_generate && types_to_generate[0]) {
@@ -4139,24 +4153,28 @@ dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
* for types where the magic value is set. We do not
* generate a value for missing types. */
for (i = 0; config_entry->types &&
config_entry->types[i]; i++) {
- value = (char *)slapi_entry_attr_get_ref(e,
config_entry->types[i]);
+ value = slapi_entry_attr_get_charptr(e,
config_entry->types[i]);
+
if (value && !slapi_UTF8CASECMP(value, DNA_NEEDS_UPDATE))
{
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[i]));
/* Need to remove DNA_NEEDS_UPDATE */
slapi_entry_attr_delete(e, config_entry->types[i]);
}
+ slapi_ch_free_string(&value);
}
} else {
/* For a single type range, we generate the value if
* the magic value is set or if the type is missing. */
- value = (char *)slapi_entry_attr_get_ref(e,
config_entry->types[0]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[0]);
+
if (0 == value || (value && !slapi_UTF8CASECMP(value,
DNA_NEEDS_UPDATE))) {
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[0]));
/* Need to remove DNA_NEEDS_UPDATE */
slapi_entry_attr_delete(e, config_entry->types[0]);
}
+ slapi_ch_free_string(&value);
}
} else {
/* check mods for DNA_NEEDS_UPDATE*/
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index a636622..ca9a64b 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -533,7 +533,7 @@ mep_parse_config_entry(Slapi_Entry *e, int apply)
}
/* Load the origin filter */
- value = (char *)slapi_entry_attr_get_ref(e, MEP_FILTER_TYPE);
+ value = (char *)slapi_entry_attr_get_charptr(e, MEP_FILTER_TYPE);
if (value) {
/* Convert to a Slapi_Filter to improve performance. */
if (NULL == (entry->origin_filter = slapi_str2filter(value))) {
@@ -544,7 +544,7 @@ mep_parse_config_entry(Slapi_Entry *e, int apply)
MEP_FILTER_TYPE, slapi_sdn_get_dn(entry->sdn), value);
ret = -1;
}
-
+ slapi_ch_free_string(&value);
if (ret != 0) {
goto bail;
}
diff --git a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
index 19a3428..46a76d8 100644
--- a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
+++ b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
@@ -495,7 +495,7 @@ pam_passthru_validate_config(Slapi_Entry *e, char *returntext)
}
/* Validate filter by converting to Slapi_Filter */
- pam_filter_str = (char *)slapi_entry_attr_get_ref(e, PAMPT_FILTER_ATTR);
+ pam_filter_str = (char *)slapi_entry_attr_get_charptr(e, PAMPT_FILTER_ATTR);
if (pam_filter_str) {
pam_filter = slapi_str2filter(pam_filter_str);
if (pam_filter == NULL) {
@@ -524,6 +524,7 @@ done:
slapi_ch_array_free(includes);
includes = NULL;
slapi_filter_free(pam_filter, 1);
+ slapi_ch_free_string(&pam_filter_str);
return rc;
}
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c
b/ldap/servers/plugins/replication/windows_protocol_util.c
index 0d287fd..3658139 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -3440,7 +3440,7 @@ map_windows_tombstone_dn(Slapi_Entry *e, Slapi_DN **dn,
Private_Repl_Protocol *p
cn = slapi_entry_attr_get_ref(e, "ntuserdomainid");
}
- guid = (char *)slapi_entry_attr_get_ref(e, "ntUniqueId");
+ guid = slapi_entry_attr_get_charptr(e, "ntUniqueId");
if (guid) {
/* the GUID is in a different form in the tombstone DN, so
* we need to transform it from the way we store it. */
@@ -3476,6 +3476,7 @@ map_windows_tombstone_dn(Slapi_Entry *e, Slapi_DN **dn,
Private_Repl_Protocol *p
slapi_entry_get_dn(e));
rc = 1;
}
+ slapi_ch_free_string(&guid);
return rc;
}
diff --git a/ldap/servers/plugins/roles/roles_cache.c
b/ldap/servers/plugins/roles/roles_cache.c
index 15af6a2..de99ba2 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -1154,7 +1154,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry,
role_object **resu
char *parent = NULL;
/* Get the filter and retrieve the filter attribute */
- filter_attr_value = (char *)slapi_entry_attr_get_ref(role_entry,
ROLE_FILTER_ATTR_NAME);
+ filter_attr_value = (char *)slapi_entry_attr_get_charptr(role_entry,
ROLE_FILTER_ATTR_NAME);
if (filter_attr_value == NULL) {
/* Means probably no attribute or no value there */
slapi_ch_free((void **)&this_role);
@@ -1197,6 +1197,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry,
role_object **resu
ROLE_FILTER_ATTR_NAME, filter_attr_value,
ROLE_FILTER_ATTR_NAME);
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
}
@@ -1208,6 +1209,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry,
role_object **resu
if (filter == NULL) {
/* An error has occured */
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
if (roles_check_filter(filter)) {
@@ -1218,11 +1220,12 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry,
role_object **resu
filter_attr_value,
ROLE_FILTER_ATTR_NAME);
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
/* Store on the object */
this_role->filter = filter;
-
+ slapi_ch_free_string(&filter_attr_value);
break;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c
b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index ce8be3e..d0d88bf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -573,13 +573,14 @@ ldbm_back_add(Slapi_PBlock *pb)
}
/* And copy the reason from e */
- reason = (char *)slapi_entry_attr_get_ref(e,
"nsds5ReplConflict");
+ reason = slapi_entry_attr_get_charptr(e, "nsds5ReplConflict");
if (reason) {
if (!slapi_entry_attr_hasvalue(addingentry->ep_entry,
"nsds5ReplConflict", reason)) {
slapi_entry_add_string(addingentry->ep_entry,
"nsds5ReplConflict", reason);
slapi_log_err(SLAPI_LOG_REPL, "ldbm_back_add",
"Resurrection of %s - Added Conflict reason %s\n",
dn, reason);
}
+ slapi_ch_free_string(&reason);
}
/* Clear the Tombstone Flag in the entry */
slapi_entry_clear_flag(addingentry->ep_entry,
SLAPI_ENTRY_FLAG_TOMBSTONE);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index b535192..68377d7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -49,6 +49,7 @@ ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e, const char
*trace_st
}
if (index_name != NULL) {
+ slapi_ch_free_string(index_name);
*index_name = slapi_ch_strdup(attrValue->bv_val);
}
@@ -113,7 +114,7 @@ ldbm_instance_index_config_add_callback(Slapi_PBlock *pb
__attribute__((unused))
void *arg)
{
ldbm_instance *inst = (ldbm_instance *)arg;
- char *index_name;
+ char *index_name = NULL;
returntext[0] = '\0';
*returncode = ldbm_index_parse_entry(inst, e, "from DSE add",
&index_name);
@@ -129,7 +130,7 @@ ldbm_instance_index_config_add_callback(Slapi_PBlock *pb
__attribute__((unused))
PR_ASSERT(ai != NULL);
ai->ai_indexmask |= INDEX_OFFLINE;
}
- slapi_ch_free((void **)&index_name);
+ slapi_ch_free_string(&index_name);
return SLAPI_DSE_CALLBACK_OK;
} else {
return SLAPI_DSE_CALLBACK_ERROR;
@@ -358,7 +359,7 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst,
Slapi_Entry *e)
int rc = LDAP_SUCCESS;
struct attrinfo *ai = NULL;
- index_name = (char *)slapi_entry_attr_get_ref(e, "cn");
+ index_name = slapi_entry_attr_get_charptr(e, "cn");
if (index_name) {
ainfo_get(inst->inst_be, index_name, &ai);
}
@@ -373,6 +374,7 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst,
Slapi_Entry *e)
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
}
+ slapi_ch_free_string(&index_name);
return rc;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.