|
|
081b2d |
From 961a1d68274453a9a0e79acdd4a3d6e3da146722 Mon Sep 17 00:00:00 2001
|
|
|
081b2d |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
081b2d |
Date: Tue, 16 Jan 2018 10:14:34 -0500
|
|
|
081b2d |
Subject: [PATCH] Ticket 49534 - Fix coverity issues and regression
|
|
|
081b2d |
|
|
|
081b2d |
Description: Fix regression introdcued in the previous coverity patch.
|
|
|
081b2d |
|
|
|
081b2d |
Also fixed many other coverity issues.
|
|
|
081b2d |
|
|
|
081b2d |
https://pagure.io/389-ds-base/issue/49534
|
|
|
081b2d |
|
|
|
081b2d |
Reviewed by: wibrown, tbordaz, lkrispen(Thanks!)
|
|
|
081b2d |
|
|
|
081b2d |
(cherry picked from commit 7658232cc427a5c46e94989eec9195f0392ee540)
|
|
|
081b2d |
---
|
|
|
081b2d |
ldap/servers/plugins/acl/acl.c | 6 ++++
|
|
|
081b2d |
ldap/servers/plugins/acl/acllas.c | 13 +++++--
|
|
|
081b2d |
ldap/servers/plugins/automember/automember.c | 6 ++++
|
|
|
081b2d |
ldap/servers/plugins/cos/cos_cache.c | 16 +++++++--
|
|
|
081b2d |
ldap/servers/plugins/memberof/memberof_config.c | 8 ++---
|
|
|
081b2d |
ldap/servers/plugins/replication/cl5_clcache.c | 9 +++--
|
|
|
081b2d |
.../plugins/replication/repl5_replica_config.c | 3 --
|
|
|
081b2d |
ldap/servers/plugins/rootdn_access/rootdn_access.c | 7 +++-
|
|
|
081b2d |
ldap/servers/plugins/uiduniq/7bit.c | 18 +++++-----
|
|
|
081b2d |
ldap/servers/plugins/views/views.c | 3 ++
|
|
|
081b2d |
ldap/servers/slapd/auth.c | 3 +-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/dblayer.c | 5 ++-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/filterindex.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/import-threads.c | 10 +++---
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/index.c | 3 +-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/instance.c | 4 +++
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/ldbm_add.c | 18 +++++++---
|
|
|
081b2d |
.../slapd/back-ldbm/ldbm_attrcrypt_config.c | 7 ++--
|
|
|
081b2d |
.../servers/slapd/back-ldbm/ldbm_instance_config.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/ldbm_search.c | 4 +--
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/vlv.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/back-ldbm/vlv_srch.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/backend.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/compare.c | 7 ++--
|
|
|
081b2d |
ldap/servers/slapd/connection.c | 40 ++++++++++++----------
|
|
|
081b2d |
ldap/servers/slapd/control.c | 6 ++++
|
|
|
081b2d |
ldap/servers/slapd/dse.c | 5 +--
|
|
|
081b2d |
ldap/servers/slapd/eventq.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/extendop.c | 10 +++---
|
|
|
081b2d |
ldap/servers/slapd/filter.c | 12 ++++---
|
|
|
081b2d |
ldap/servers/slapd/index_subsystem.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/main.c | 19 ++++++++--
|
|
|
081b2d |
ldap/servers/slapd/mapping_tree.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/modify.c | 39 ++++++++++-----------
|
|
|
081b2d |
ldap/servers/slapd/opshared.c | 7 ++++
|
|
|
081b2d |
ldap/servers/slapd/passwd_extop.c | 4 +++
|
|
|
081b2d |
ldap/servers/slapd/plugin.c | 8 +++--
|
|
|
081b2d |
ldap/servers/slapd/plugin_internal_op.c | 1 +
|
|
|
081b2d |
ldap/servers/slapd/psearch.c | 6 ++--
|
|
|
081b2d |
ldap/servers/slapd/pw.c | 3 +-
|
|
|
081b2d |
ldap/servers/slapd/pw_mgmt.c | 30 ++++++++++------
|
|
|
081b2d |
ldap/servers/slapd/result.c | 2 +-
|
|
|
081b2d |
ldap/servers/slapd/saslbind.c | 5 +++
|
|
|
081b2d |
ldap/servers/slapd/task.c | 5 +--
|
|
|
081b2d |
ldap/servers/slapd/util.c | 12 ++++---
|
|
|
081b2d |
ldap/servers/slapd/valueset.c | 10 ++++--
|
|
|
081b2d |
ldap/servers/slapd/vattr.c | 20 ++++++++---
|
|
|
081b2d |
ldap/servers/snmp/main.c | 19 ++++++----
|
|
|
081b2d |
48 files changed, 276 insertions(+), 153 deletions(-)
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
|
|
|
081b2d |
index f10c9f6b5..bc154c78f 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/acl/acl.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/acl/acl.c
|
|
|
081b2d |
@@ -437,6 +437,12 @@ acl_access_allowed(
|
|
|
081b2d |
* pointers to them--we must always start afresh (see psearch.c).
|
|
|
081b2d |
*/
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
|
|
|
081b2d |
+ if (op == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name,
|
|
|
081b2d |
+ "acl_access_allowed - NULL op\n");
|
|
|
081b2d |
+ ret_val = LDAP_OPERATIONS_ERROR;
|
|
|
081b2d |
+ goto cleanup_and_ret;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
if (operation_is_flag_set(op, OP_FLAG_PS) ||
|
|
|
081b2d |
(aclpb->aclpb_curr_entry_sdn == NULL) ||
|
|
|
081b2d |
(slapi_sdn_compare(aclpb->aclpb_curr_entry_sdn, e_sdn) != 0) ||
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
|
|
|
081b2d |
index b9bea205c..3950fd405 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/acl/acllas.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/acl/acllas.c
|
|
|
081b2d |
@@ -4260,7 +4260,7 @@ acllas_replace_attr_macro(char *rule, lasInfo *lasinfo)
|
|
|
081b2d |
/*
|
|
|
081b2d |
* working_rule is the first member of working_list.
|
|
|
081b2d |
* str points to the next $attr.attrName in working_rule.
|
|
|
081b2d |
- * each member of working_list needs to have each occurence of
|
|
|
081b2d |
+ * each member of working_list needs to have each occurrence of
|
|
|
081b2d |
* $attr.atrName replaced with the value of attrName in e.
|
|
|
081b2d |
* If attrName is multi valued then this generates another
|
|
|
081b2d |
* list which replaces the old one.
|
|
|
081b2d |
@@ -4273,8 +4273,7 @@ acllas_replace_attr_macro(char *rule, lasInfo *lasinfo)
|
|
|
081b2d |
str = strstr(macro_str, ".");
|
|
|
081b2d |
if (!str) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, plugin_name,
|
|
|
081b2d |
- "acllas_replace_attr_macro - Invalid macro \"%s\".",
|
|
|
081b2d |
- macro_str);
|
|
|
081b2d |
+ "acllas_replace_attr_macro - Invalid macro \"%s\".", macro_str);
|
|
|
081b2d |
slapi_ch_free_string(¯o_str);
|
|
|
081b2d |
charray_free(working_list);
|
|
|
081b2d |
return NULL;
|
|
|
081b2d |
@@ -4282,10 +4281,18 @@ acllas_replace_attr_macro(char *rule, lasInfo *lasinfo)
|
|
|
081b2d |
|
|
|
081b2d |
str++; /* skip the . */
|
|
|
081b2d |
l = acl_strstr(&str[0], ")");
|
|
|
081b2d |
+ if (l == -1){
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name,
|
|
|
081b2d |
+ "acllas_replace_attr_macro - Invalid macro str \"%s\".", str);
|
|
|
081b2d |
+ slapi_ch_free_string(¯o_str);
|
|
|
081b2d |
+ charray_free(working_list);
|
|
|
081b2d |
+ return NULL;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
macro_attr_name = slapi_ch_malloc(l + 1);
|
|
|
081b2d |
strncpy(macro_attr_name, &str[0], l);
|
|
|
081b2d |
macro_attr_name[l] = '\0';
|
|
|
081b2d |
|
|
|
081b2d |
+
|
|
|
081b2d |
slapi_entry_attr_find(e, macro_attr_name, &attr);
|
|
|
081b2d |
if (NULL == attr) {
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
|
|
|
081b2d |
index 4c008e1f2..cbd25915a 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/automember/automember.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/automember/automember.c
|
|
|
081b2d |
@@ -1047,6 +1047,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
|
|
|
081b2d |
/* Order rules by target group DN */
|
|
|
081b2d |
if (slapi_sdn_compare(rule->target_group_dn, curr_rule->target_group_dn) < 0) {
|
|
|
081b2d |
PR_INSERT_BEFORE(&(rule->list), list);
|
|
|
081b2d |
+ rule = NULL;
|
|
|
081b2d |
break;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -1055,9 +1056,11 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
|
|
|
081b2d |
/* If we hit the end of the list, add to the tail. */
|
|
|
081b2d |
if ((PRCList *)config->inclusive_rules == list) {
|
|
|
081b2d |
PR_INSERT_BEFORE(&(rule->list), list);
|
|
|
081b2d |
+ rule = NULL;
|
|
|
081b2d |
break;
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
+ automember_free_regex_rule(rule);
|
|
|
081b2d |
} else {
|
|
|
081b2d |
/* Add to head of list */
|
|
|
081b2d |
PR_INSERT_LINK(&(rule->list), (PRCList *)config->inclusive_rules);
|
|
|
081b2d |
@@ -1101,6 +1104,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
|
|
|
081b2d |
/* Order rules by target group DN */
|
|
|
081b2d |
if (slapi_sdn_compare(rule->target_group_dn, curr_rule->target_group_dn) < 0) {
|
|
|
081b2d |
PR_INSERT_BEFORE(&(rule->list), list);
|
|
|
081b2d |
+ rule = NULL;
|
|
|
081b2d |
break;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -1109,6 +1113,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
|
|
|
081b2d |
/* If we hit the end of the list, add to the tail. */
|
|
|
081b2d |
if ((PRCList *)config->exclusive_rules == list) {
|
|
|
081b2d |
PR_INSERT_BEFORE(&(rule->list), list);
|
|
|
081b2d |
+ rule = NULL;
|
|
|
081b2d |
break;
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -1116,6 +1121,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
|
|
|
081b2d |
/* Add to head of list */
|
|
|
081b2d |
PR_INSERT_LINK(&(rule->list), (PRCList *)config->exclusive_rules);
|
|
|
081b2d |
}
|
|
|
081b2d |
+ automember_free_regex_rule(rule);
|
|
|
081b2d |
} else {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, AUTOMEMBER_PLUGIN_SUBSYSTEM,
|
|
|
081b2d |
"automember_parse_regex_entry - Skipping invalid exclusive "
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
|
|
|
081b2d |
index 3b3c05783..5e0cf1725 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/cos/cos_cache.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/cos/cos_cache.c
|
|
|
081b2d |
@@ -874,7 +874,7 @@ cos_dn_defs_cb(Slapi_Entry *e, void *callback_data)
|
|
|
081b2d |
|
|
|
081b2d |
if (pCosAttribute && (!pCosTargetTree || !pCosTemplateDn)) {
|
|
|
081b2d |
/* get the parent of the definition */
|
|
|
081b2d |
- char *orig = slapi_dn_parent(pDn->val);
|
|
|
081b2d |
+ char *orig = pDn ? slapi_dn_parent(pDn->val) : NULL;
|
|
|
081b2d |
char *parent = NULL;
|
|
|
081b2d |
if (orig) {
|
|
|
081b2d |
parent = slapi_create_dn_string("%s", orig);
|
|
|
081b2d |
@@ -900,7 +900,7 @@ cos_dn_defs_cb(Slapi_Entry *e, void *callback_data)
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, COS_PLUGIN_SUBSYSTEM,
|
|
|
081b2d |
"cos_dn_defs_cb - "
|
|
|
081b2d |
"Failed to get parent dn of cos definition %s.\n",
|
|
|
081b2d |
- pDn->val);
|
|
|
081b2d |
+ pDn ? pDn->val : "<NONE>");
|
|
|
081b2d |
if (!pCosTemplateDn) {
|
|
|
081b2d |
if (!pCosTargetTree) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, COS_PLUGIN_SUBSYSTEM, "cos_dn_defs_cb - cosTargetTree and cosTemplateDn are not set.\n");
|
|
|
081b2d |
@@ -1843,6 +1843,13 @@ cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAttrValue *ob
|
|
|
081b2d |
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_TRACE, COS_PLUGIN_SUBSYSTEM, "--> cos_cache_add_tmpl\n");
|
|
|
081b2d |
|
|
|
081b2d |
+ if (dn == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, COS_PLUGIN_SUBSYSTEM,
|
|
|
081b2d |
+ "cos_cache_add_tmpl - param cosAttrValue dn is NULL\n");
|
|
|
081b2d |
+ ret = -1;
|
|
|
081b2d |
+ goto done;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
/* create the attribute */
|
|
|
081b2d |
theTemp = (cosTemplates *)slapi_ch_malloc(sizeof(cosTemplates));
|
|
|
081b2d |
if (theTemp) {
|
|
|
081b2d |
@@ -1851,7 +1858,9 @@ cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAttrValue *ob
|
|
|
081b2d |
int index = 0;
|
|
|
081b2d |
int template_default = 0;
|
|
|
081b2d |
char *ptr = NULL;
|
|
|
081b2d |
- char *normed = slapi_create_dn_string("%s", dn->val);
|
|
|
081b2d |
+ char *normed = NULL;
|
|
|
081b2d |
+
|
|
|
081b2d |
+ normed = slapi_create_dn_string("%s", dn->val);
|
|
|
081b2d |
if (normed) {
|
|
|
081b2d |
slapi_ch_free_string(&dn->val);
|
|
|
081b2d |
dn->val = normed;
|
|
|
081b2d |
@@ -1964,6 +1973,7 @@ cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAttrValue *ob
|
|
|
081b2d |
ret = -1;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
+done:
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_TRACE, COS_PLUGIN_SUBSYSTEM, "<-- cos_cache_add_tmpl\n");
|
|
|
081b2d |
return ret;
|
|
|
081b2d |
}
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/memberof/memberof_config.c b/ldap/servers/plugins/memberof/memberof_config.c
|
|
|
081b2d |
index 3f22d95d6..8a27f5250 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/memberof/memberof_config.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/memberof/memberof_config.c
|
|
|
081b2d |
@@ -550,7 +550,7 @@ memberof_apply_config(Slapi_PBlock *pb __attribute__((unused)),
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/* Build the new list */
|
|
|
081b2d |
- for (i = 0; theConfig.groupattrs[i]; i++) {
|
|
|
081b2d |
+ for (i = 0; theConfig.groupattrs && theConfig.groupattrs[i]; i++) {
|
|
|
081b2d |
theConfig.group_slapiattrs[i] = slapi_attr_new();
|
|
|
081b2d |
slapi_attr_init(theConfig.group_slapiattrs[i], theConfig.groupattrs[i]);
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -572,7 +572,7 @@ memberof_apply_config(Slapi_PBlock *pb __attribute__((unused)),
|
|
|
081b2d |
bytes_out = snprintf(filter_str, filter_str_len - bytes_out, "(|");
|
|
|
081b2d |
|
|
|
081b2d |
/* Add filter section for each groupattr. */
|
|
|
081b2d |
- for (i = 0; theConfig.groupattrs[i]; i++) {
|
|
|
081b2d |
+ for (i = 0; theConfig.groupattrs && theConfig.groupattrs[i]; i++) {
|
|
|
081b2d |
bytes_out += snprintf(filter_str + bytes_out, filter_str_len - bytes_out, "(%s=*)", theConfig.groupattrs[i]);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -721,7 +721,7 @@ memberof_copy_config(MemberOfConfig *dest, MemberOfConfig *src)
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/* Count how many values we have in the source list. */
|
|
|
081b2d |
- for (j = 0; src->group_slapiattrs[j]; j++) {
|
|
|
081b2d |
+ for (j = 0; src->group_slapiattrs && src->group_slapiattrs[j]; j++) {
|
|
|
081b2d |
/* Do nothing. */
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -731,7 +731,7 @@ memberof_copy_config(MemberOfConfig *dest, MemberOfConfig *src)
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/* Copy the attributes. */
|
|
|
081b2d |
- for (i = 0; src->group_slapiattrs[i]; i++) {
|
|
|
081b2d |
+ for (i = 0; src->group_slapiattrs && src->group_slapiattrs[i]; i++) {
|
|
|
081b2d |
dest->group_slapiattrs[i] = slapi_attr_dup(src->group_slapiattrs[i]);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
|
|
|
081b2d |
index 40985b9a7..a8477a83a 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/replication/cl5_clcache.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
|
|
|
081b2d |
@@ -676,7 +676,7 @@ clcache_initial_anchorcsn(CLC_Buffer *buf, int *flag)
|
|
|
081b2d |
buf->buf_state = CLC_STATE_DONE;
|
|
|
081b2d |
} else {
|
|
|
081b2d |
csn_init_by_csn(buf->buf_current_csn, anchorcsn);
|
|
|
081b2d |
- csn_as_string(buf->buf_current_csn, 0, (char *)buf->buf_key.data);
|
|
|
081b2d |
+ buf->buf_key.data = csn_as_string(buf->buf_current_csn, 0, (char *)buf->buf_key.data);
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_REPL, "clcache_initial_anchorcsn",
|
|
|
081b2d |
"anchor is now: %s\n", (char *)buf->buf_key.data);
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -746,10 +746,9 @@ clcache_adjust_anchorcsn(CLC_Buffer *buf, int *flag)
|
|
|
081b2d |
buf->buf_state = CLC_STATE_DONE;
|
|
|
081b2d |
} else {
|
|
|
081b2d |
csn_init_by_csn(buf->buf_current_csn, anchorcsn);
|
|
|
081b2d |
- csn_as_string(buf->buf_current_csn, 0, (char *)buf->buf_key.data);
|
|
|
081b2d |
- slapi_log_err(SLAPI_LOG_REPL, buf->buf_agmt_name, "clcache_adjust_anchorcsn - "
|
|
|
081b2d |
- "anchor is now: %s\n",
|
|
|
081b2d |
- (char *)buf->buf_key.data);
|
|
|
081b2d |
+ buf->buf_key.data = csn_as_string(buf->buf_current_csn, 0, (char *)buf->buf_key.data);
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_REPL, buf->buf_agmt_name,
|
|
|
081b2d |
+ "clcache_adjust_anchorcsn - anchor is now: %s\n", (char *)buf->buf_key.data);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
return buf->buf_state;
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
081b2d |
index 95b933bb8..bda333362 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
081b2d |
@@ -2527,9 +2527,6 @@ add_cleaned_rid(cleanruv_data *cleanruv_data, char *maxcsn)
|
|
|
081b2d |
Replica *r;
|
|
|
081b2d |
char *forcing;
|
|
|
081b2d |
|
|
|
081b2d |
- if (data == NULL) {
|
|
|
081b2d |
- return;
|
|
|
081b2d |
- }
|
|
|
081b2d |
rid = cleanruv_data->rid;
|
|
|
081b2d |
r = cleanruv_data->replica;
|
|
|
081b2d |
forcing = cleanruv_data->force;
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/rootdn_access/rootdn_access.c b/ldap/servers/plugins/rootdn_access/rootdn_access.c
|
|
|
081b2d |
index b4db1202a..1cb999792 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/rootdn_access/rootdn_access.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/rootdn_access/rootdn_access.c
|
|
|
081b2d |
@@ -459,7 +459,7 @@ rootdn_check_access(Slapi_PBlock *pb)
|
|
|
081b2d |
PRNetAddr *client_addr = NULL;
|
|
|
081b2d |
PRHostEnt *host_entry = NULL;
|
|
|
081b2d |
time_t curr_time;
|
|
|
081b2d |
- struct tm *timeinfo;
|
|
|
081b2d |
+ struct tm *timeinfo = NULL;
|
|
|
081b2d |
char *dnsName = NULL;
|
|
|
081b2d |
int isRoot = 0;
|
|
|
081b2d |
int rc = SLAPI_PLUGIN_SUCCESS;
|
|
|
081b2d |
@@ -478,6 +478,11 @@ rootdn_check_access(Slapi_PBlock *pb)
|
|
|
081b2d |
if (open_time || daysAllowed) {
|
|
|
081b2d |
curr_time = slapi_current_utc_time();
|
|
|
081b2d |
timeinfo = localtime(&curr_time);
|
|
|
081b2d |
+ if (timeinfo == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, ROOTDN_PLUGIN_SUBSYSTEM,
|
|
|
081b2d |
+ "rootdn_check_access - Failed to get localtime\n");
|
|
|
081b2d |
+ return -1;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
/*
|
|
|
081b2d |
* First check TOD restrictions, continue through if we are in the open "window"
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/uiduniq/7bit.c b/ldap/servers/plugins/uiduniq/7bit.c
|
|
|
081b2d |
index b23e652cf..60fcbab93 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/uiduniq/7bit.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/uiduniq/7bit.c
|
|
|
081b2d |
@@ -715,18 +715,18 @@ preop_modrdn(Slapi_PBlock *pb)
|
|
|
081b2d |
int
|
|
|
081b2d |
NS7bitAttr_Init(Slapi_PBlock *pb)
|
|
|
081b2d |
{
|
|
|
081b2d |
- int err = 0;
|
|
|
081b2d |
+ int32_t err = 0;
|
|
|
081b2d |
Slapi_Entry *plugin_entry = NULL;
|
|
|
081b2d |
char *plugin_type = NULL;
|
|
|
081b2d |
- int preadd = SLAPI_PLUGIN_PRE_ADD_FN;
|
|
|
081b2d |
- int premod = SLAPI_PLUGIN_PRE_MODIFY_FN;
|
|
|
081b2d |
- int premdn = SLAPI_PLUGIN_PRE_MODRDN_FN;
|
|
|
081b2d |
+ int32_t preadd = SLAPI_PLUGIN_PRE_ADD_FN;
|
|
|
081b2d |
+ int32_t premod = SLAPI_PLUGIN_PRE_MODIFY_FN;
|
|
|
081b2d |
+ int32_t premdn = SLAPI_PLUGIN_PRE_MODRDN_FN;
|
|
|
081b2d |
|
|
|
081b2d |
BEGIN
|
|
|
081b2d |
- int attr_count = 0;
|
|
|
081b2d |
- int argc;
|
|
|
081b2d |
- char **argv;
|
|
|
081b2d |
- int valid_suffix = 0;
|
|
|
081b2d |
+ int32_t attr_count = 0;
|
|
|
081b2d |
+ int32_t argc = 0;
|
|
|
081b2d |
+ char **argv = NULL;
|
|
|
081b2d |
+ int32_t valid_suffix = 0;
|
|
|
081b2d |
|
|
|
081b2d |
/* Declare plugin version */
|
|
|
081b2d |
err = slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION,
|
|
|
081b2d |
@@ -752,7 +752,7 @@ NS7bitAttr_Init(Slapi_PBlock *pb)
|
|
|
081b2d |
break;
|
|
|
081b2d |
|
|
|
081b2d |
err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv);
|
|
|
081b2d |
- if (err)
|
|
|
081b2d |
+ if (err || argv == NULL)
|
|
|
081b2d |
break;
|
|
|
081b2d |
|
|
|
081b2d |
for (attr_count = 0; argv && argv[attr_count]; attr_count++) {
|
|
|
081b2d |
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c
|
|
|
081b2d |
index 6ba3e290d..6f784f599 100644
|
|
|
081b2d |
--- a/ldap/servers/plugins/views/views.c
|
|
|
081b2d |
+++ b/ldap/servers/plugins/views/views.c
|
|
|
081b2d |
@@ -558,6 +558,9 @@ views_cache_index(void)
|
|
|
081b2d |
/* copy over the views */
|
|
|
081b2d |
for (i = 0; i < theCache.view_count; i++) {
|
|
|
081b2d |
theCache.ppViewIndex[i] = theView;
|
|
|
081b2d |
+ if (theView == NULL){
|
|
|
081b2d |
+ break;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
theView = theView->list.pNext;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
|
|
|
081b2d |
index b8e171b27..a2050b990 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/auth.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/auth.c
|
|
|
081b2d |
@@ -463,7 +463,8 @@ handle_handshake_done(PRFileDesc *prfd, void *clientData)
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS,
|
|
|
081b2d |
"conn=%" PRIu64 " %s %i-bit %s; client %s; issuer %s\n",
|
|
|
081b2d |
conn->c_connid,
|
|
|
081b2d |
- sslversion, keySize, cipher ? cipher : "NULL",
|
|
|
081b2d |
+ sslversion, keySize,
|
|
|
081b2d |
+ cipher ? cipher : "NULL",
|
|
|
081b2d |
subject ? escape_string(subject, sbuf) : "NULL",
|
|
|
081b2d |
issuer ? escape_string(issuer, ibuf) : "NULL");
|
|
|
081b2d |
if (issuer)
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
081b2d |
index 9e557a24a..5d870e364 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
081b2d |
@@ -3007,7 +3007,7 @@ dblayer_erase_index_file_ex(backend *be, struct attrinfo *a, PRBool use_lock, in
|
|
|
081b2d |
struct dblayer_private_env *pEnv = NULL;
|
|
|
081b2d |
ldbm_instance *inst = NULL;
|
|
|
081b2d |
dblayer_handle *handle = NULL;
|
|
|
081b2d |
- char dbName[MAXPATHLEN];
|
|
|
081b2d |
+ char dbName[MAXPATHLEN] = {0};
|
|
|
081b2d |
char *dbNamep;
|
|
|
081b2d |
char *p;
|
|
|
081b2d |
int dbbasenamelen, dbnamelen;
|
|
|
081b2d |
@@ -3098,8 +3098,7 @@ dblayer_erase_index_file_ex(backend *be, struct attrinfo *a, PRBool use_lock, in
|
|
|
081b2d |
dbNamep = (char *)slapi_ch_realloc(dbNamep, dbnamelen);
|
|
|
081b2d |
}
|
|
|
081b2d |
p = dbNamep + dbbasenamelen;
|
|
|
081b2d |
- sprintf(p, "%c%s%s",
|
|
|
081b2d |
- get_sep(dbNamep), a->ai_type, LDBM_FILENAME_SUFFIX);
|
|
|
081b2d |
+ sprintf(p, "%c%s%s", get_sep(dbNamep), a->ai_type, LDBM_FILENAME_SUFFIX);
|
|
|
081b2d |
rc = dblayer_db_remove_ex(pEnv, dbNamep, 0, 0);
|
|
|
081b2d |
a->ai_dblayer = NULL;
|
|
|
081b2d |
if (dbNamep != dbName)
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
|
|
|
081b2d |
index fd079077c..e8c3c2008 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
|
|
|
081b2d |
@@ -563,7 +563,7 @@ range_candidates(
|
|
|
081b2d |
|
|
|
081b2d |
/* Check if it is for bulk import. */
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
|
|
|
081b2d |
- if (entryrdn_get_switch() && operation_is_flag_set(op, OP_FLAG_INTERNAL) &&
|
|
|
081b2d |
+ if (entryrdn_get_switch() && op && operation_is_flag_set(op, OP_FLAG_INTERNAL) &&
|
|
|
081b2d |
operation_is_flag_set(op, OP_FLAG_BULK_IMPORT)) {
|
|
|
081b2d |
/* parentid is treated specially that is needed for the bulk import. (See #48755) */
|
|
|
081b2d |
operator= SLAPI_OP_RANGE_NO_IDL_SORT | SLAPI_OP_RANGE_NO_ALLIDS;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
081b2d |
index b8cd9aaa0..0419865c9 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
081b2d |
@@ -1664,8 +1664,7 @@ upgradedn_producer(void *param)
|
|
|
081b2d |
slapi_ch_free_string(&rdn;;
|
|
|
081b2d |
}
|
|
|
081b2d |
} else {
|
|
|
081b2d |
- e =
|
|
|
081b2d |
- slapi_str2entry(data.data, SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT);
|
|
|
081b2d |
+ e = slapi_str2entry(data.data, SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT);
|
|
|
081b2d |
rdn = slapi_ch_strdup(slapi_entry_get_rdn_const(e));
|
|
|
081b2d |
if (NULL == rdn) {
|
|
|
081b2d |
Slapi_RDN srdn;
|
|
|
081b2d |
@@ -1683,6 +1682,7 @@ upgradedn_producer(void *param)
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_WARNING, "upgradedn_producer",
|
|
|
081b2d |
"%s: Skipping badly formatted entry (id %lu)\n",
|
|
|
081b2d |
inst->inst_name, (u_long)temp_id);
|
|
|
081b2d |
+ slapi_ch_free_string(&rdn;;
|
|
|
081b2d |
continue;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -2183,6 +2183,7 @@ done:
|
|
|
081b2d |
free_IDarray(&dn_norm_sp_conflicts);
|
|
|
081b2d |
slapi_ch_free_string(&ecopy);
|
|
|
081b2d |
slapi_ch_free(&(data.data));
|
|
|
081b2d |
+ slapi_ch_free_string(&rdn;;
|
|
|
081b2d |
if (job->upgradefd) {
|
|
|
081b2d |
fclose(job->upgradefd);
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -3783,7 +3784,7 @@ out:
|
|
|
081b2d |
slapi_ch_free_string(&search_scope);
|
|
|
081b2d |
|
|
|
081b2d |
|
|
|
081b2d |
- if (fd > 0) {
|
|
|
081b2d |
+ if (fd >= 0) {
|
|
|
081b2d |
close(fd);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -3949,8 +3950,7 @@ import_get_and_add_parent_rdns(ImportWorkerInfo *info,
|
|
|
081b2d |
rc = slapi_rdn_add_srdn_to_all_rdns(srdn, &mysrdn);
|
|
|
081b2d |
if (rc) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, "import_get_and_add_parent_rdns",
|
|
|
081b2d |
- "Failed to merge Slapi_RDN %s to RDN\n",
|
|
|
081b2d |
- slapi_sdn_get_dn(bdn->dn_sdn));
|
|
|
081b2d |
+ "Failed to merge Slapi_RDN to RDN\n");
|
|
|
081b2d |
}
|
|
|
081b2d |
bail:
|
|
|
081b2d |
slapi_ch_free(&data.data);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
|
|
|
081b2d |
index 587f4d991..7e1cdd0db 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/index.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/index.c
|
|
|
081b2d |
@@ -749,7 +749,7 @@ index_add_mods(
|
|
|
081b2d |
mods[i]->mod_type,
|
|
|
081b2d |
&curr_attr);
|
|
|
081b2d |
if (curr_attr) {
|
|
|
081b2d |
- for (j = 0; mods_valueArray[j] != NULL; j++) {
|
|
|
081b2d |
+ for (j = 0; mods_valueArray && mods_valueArray[j] != NULL; j++) {
|
|
|
081b2d |
if (!slapi_valueset_find(curr_attr, all_vals, mods_valueArray[j])) {
|
|
|
081b2d |
/*
|
|
|
081b2d |
* If the mod del value is not found in all_vals
|
|
|
081b2d |
@@ -1054,6 +1054,7 @@ index_read_ext_allids(
|
|
|
081b2d |
for (retry_count = 0; retry_count < IDL_FETCH_RETRY_COUNT; retry_count++) {
|
|
|
081b2d |
*err = NEW_IDL_DEFAULT;
|
|
|
081b2d |
PRIntervalTime interval;
|
|
|
081b2d |
+ idl_free(&idl);
|
|
|
081b2d |
idl = idl_fetch_ext(be, db, &key, db_txn, ai, err, allidslimit);
|
|
|
081b2d |
if (*err == DB_LOCK_DEADLOCK) {
|
|
|
081b2d |
ldbm_nasty("index_read_ext_allids", "index read retrying transaction", 1045, *err);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
|
|
|
081b2d |
index d4715ab9c..7f9f423a5 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/instance.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/instance.c
|
|
|
081b2d |
@@ -352,6 +352,10 @@ ldbm_instance_find_by_name(struct ldbminfo *li, char *name)
|
|
|
081b2d |
Object *inst_obj;
|
|
|
081b2d |
ldbm_instance *inst;
|
|
|
081b2d |
|
|
|
081b2d |
+ if (name == NULL) {
|
|
|
081b2d |
+ return NULL;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
inst_obj = objset_first_obj(li->li_instance_set);
|
|
|
081b2d |
while (inst_obj != NULL) {
|
|
|
081b2d |
inst = (ldbm_instance *)object_get_data(inst_obj);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
081b2d |
index f29945a7e..c93d44a65 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
081b2d |
@@ -60,7 +60,7 @@ ldbm_back_add(Slapi_PBlock *pb)
|
|
|
081b2d |
ID pid;
|
|
|
081b2d |
int isroot;
|
|
|
081b2d |
char *errbuf = NULL;
|
|
|
081b2d |
- back_txn txn;
|
|
|
081b2d |
+ back_txn txn = {0};
|
|
|
081b2d |
back_txnid parent_txn;
|
|
|
081b2d |
int retval = -1;
|
|
|
081b2d |
char *msg;
|
|
|
081b2d |
@@ -96,6 +96,7 @@ ldbm_back_add(Slapi_PBlock *pb)
|
|
|
081b2d |
PRUint64 conn_id;
|
|
|
081b2d |
int op_id;
|
|
|
081b2d |
int result_sent = 0;
|
|
|
081b2d |
+
|
|
|
081b2d |
if (slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id) < 0) {
|
|
|
081b2d |
conn_id = 0; /* connection is NULL */
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -109,6 +110,11 @@ ldbm_back_add(Slapi_PBlock *pb)
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_BACKEND, &be);
|
|
|
081b2d |
|
|
|
081b2d |
+ if (operation == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_add", "NULL operation\n");
|
|
|
081b2d |
+ return LDAP_OPERATIONS_ERROR;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
is_resurect_operation = operation_is_flag_set(operation, OP_FLAG_RESURECT_ENTRY);
|
|
|
081b2d |
is_tombstone_operation = operation_is_flag_set(operation, OP_FLAG_TOMBSTONE_ENTRY);
|
|
|
081b2d |
is_fixup_operation = operation_is_flag_set(operation, OP_FLAG_REPL_FIXUP);
|
|
|
081b2d |
@@ -126,6 +132,11 @@ ldbm_back_add(Slapi_PBlock *pb)
|
|
|
081b2d |
goto error_return;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
+ if (e == NULL){
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_add", "entry is NULL.\n");
|
|
|
081b2d |
+ goto error_return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
/* sdn & parentsdn need to be initialized before "goto *_return" */
|
|
|
081b2d |
slapi_sdn_init(&parentsdn);
|
|
|
081b2d |
|
|
|
081b2d |
@@ -169,9 +180,8 @@ ldbm_back_add(Slapi_PBlock *pb)
|
|
|
081b2d |
* before we make our last abandon check to avoid race conditions in
|
|
|
081b2d |
* the code that processes abandon operations.
|
|
|
081b2d |
*/
|
|
|
081b2d |
- if (operation) {
|
|
|
081b2d |
- operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
|
|
|
081b2d |
- }
|
|
|
081b2d |
+ operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
|
|
|
081b2d |
+
|
|
|
081b2d |
if (slapi_op_abandoned(pb)) {
|
|
|
081b2d |
ldap_result_code = -1; /* needs to distinguish from "success" */
|
|
|
081b2d |
goto error_return;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
|
|
|
081b2d |
index e792c26cf..9ecb09903 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
|
|
|
081b2d |
@@ -124,8 +124,8 @@ ldbm_instance_attrcrypt_config_add_callback(Slapi_PBlock *pb __attribute__((unus
|
|
|
081b2d |
{
|
|
|
081b2d |
ldbm_instance *inst = (ldbm_instance *)arg;
|
|
|
081b2d |
char *attribute_name = NULL;
|
|
|
081b2d |
- int cipher = 0;
|
|
|
081b2d |
- int ret = 0;
|
|
|
081b2d |
+ int32_t cipher = 0;
|
|
|
081b2d |
+ int32_t ret = SLAPI_DSE_CALLBACK_OK;
|
|
|
081b2d |
|
|
|
081b2d |
returntext[0] = '\0';
|
|
|
081b2d |
|
|
|
081b2d |
@@ -146,7 +146,6 @@ ldbm_instance_attrcrypt_config_add_callback(Slapi_PBlock *pb __attribute__((unus
|
|
|
081b2d |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
081b2d |
ret = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
081b2d |
} else {
|
|
|
081b2d |
-
|
|
|
081b2d |
ainfo_get(inst->inst_be, attribute_name, &ai;;
|
|
|
081b2d |
/* If we couldn't find a non-default attrinfo, then that means
|
|
|
081b2d |
* that no indexing or encryption has yet been defined for this attribute
|
|
|
081b2d |
@@ -172,9 +171,7 @@ ldbm_instance_attrcrypt_config_add_callback(Slapi_PBlock *pb __attribute__((unus
|
|
|
081b2d |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
081b2d |
ret = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
081b2d |
}
|
|
|
081b2d |
- ret = SLAPI_DSE_CALLBACK_OK;
|
|
|
081b2d |
}
|
|
|
081b2d |
-
|
|
|
081b2d |
} else {
|
|
|
081b2d |
ret = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
081b2d |
}
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
081b2d |
index c2e49d5ab..eb2603897 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
081b2d |
@@ -1307,7 +1307,7 @@ ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb __attribute__((unu
|
|
|
081b2d |
char *returntext,
|
|
|
081b2d |
void *arg)
|
|
|
081b2d |
{
|
|
|
081b2d |
- char *instance_name;
|
|
|
081b2d |
+ char *instance_name = NULL;
|
|
|
081b2d |
struct ldbminfo *li = (struct ldbminfo *)arg;
|
|
|
081b2d |
struct ldbm_instance *inst = NULL;
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
081b2d |
index 02a21bf92..8f3111813 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
081b2d |
@@ -1157,7 +1157,7 @@ subtree_candidates(
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_REQUESTOR_ISROOT, &isroot);
|
|
|
081b2d |
/* Check if it is for bulk import. */
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
|
|
|
081b2d |
- if (entryrdn_get_switch() && operation_is_flag_set(op, OP_FLAG_INTERNAL) &&
|
|
|
081b2d |
+ if (op && entryrdn_get_switch() && operation_is_flag_set(op, OP_FLAG_INTERNAL) &&
|
|
|
081b2d |
operation_is_flag_set(op, OP_FLAG_BULK_IMPORT)) {
|
|
|
081b2d |
is_bulk_import = PR_TRUE;
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -1168,7 +1168,7 @@ subtree_candidates(
|
|
|
081b2d |
* since tombstone entries are not indexed in the ancestorid index.
|
|
|
081b2d |
* Note: they are indexed in the entryrdn index.
|
|
|
081b2d |
*/
|
|
|
081b2d |
- if (candidates != NULL && (idl_length(candidates) > FILTER_TEST_THRESHOLD)) {
|
|
|
081b2d |
+ if (candidates != NULL && (idl_length(candidates) > FILTER_TEST_THRESHOLD) && e) {
|
|
|
081b2d |
IDList *tmp = candidates, *descendants = NULL;
|
|
|
081b2d |
back_txn txn = {NULL};
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
|
|
|
081b2d |
index 9a1a1c63e..23825c2d5 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/vlv.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
|
|
|
081b2d |
@@ -1518,7 +1518,7 @@ vlv_trim_candidates_byvalue(backend *be, const IDList *candidates, const sort_sp
|
|
|
081b2d |
{
|
|
|
081b2d |
PRUint32 si = 0; /* The Selected Index */
|
|
|
081b2d |
PRUint32 low = 0;
|
|
|
081b2d |
- PRUint32 high = candidates->b_nids - 1;
|
|
|
081b2d |
+ PRUint32 high = 0;
|
|
|
081b2d |
PRUint32 current = 0;
|
|
|
081b2d |
ID id = NOID;
|
|
|
081b2d |
int found = 0;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
|
|
|
081b2d |
index e9780b590..c4c0875ad 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
|
|
|
081b2d |
@@ -168,7 +168,7 @@ vlvSearch_init(struct vlvSearch *p, Slapi_PBlock *pb, const Slapi_Entry *e, ldbm
|
|
|
081b2d |
|
|
|
081b2d |
/* switch context back to the DSE backend */
|
|
|
081b2d |
slapi_pblock_set(pb, SLAPI_BACKEND, oldbe);
|
|
|
081b2d |
- slapi_pblock_set(pb, SLAPI_PLUGIN, oldbe->be_database);
|
|
|
081b2d |
+ slapi_pblock_set(pb, SLAPI_PLUGIN, oldbe ? oldbe->be_database: NULL);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/* make (&(parentid=idofbase)(|(originalfilter)(objectclass=referral))) */
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
|
|
|
081b2d |
index fb3eb77a3..78c00a5a8 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/backend.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/backend.c
|
|
|
081b2d |
@@ -171,7 +171,7 @@ slapi_be_issuffix(const Slapi_Backend *be, const Slapi_DN *suffix)
|
|
|
081b2d |
struct suffixlist *list;
|
|
|
081b2d |
int r = 0;
|
|
|
081b2d |
/* this backend is no longer valid */
|
|
|
081b2d |
- if (be->be_state != BE_STATE_DELETED) {
|
|
|
081b2d |
+ if (be && be->be_state != BE_STATE_DELETED) {
|
|
|
081b2d |
int i = 0, count;
|
|
|
081b2d |
|
|
|
081b2d |
count = slapi_counter_get_value(be->be_suffixcounter);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
|
|
|
081b2d |
index 2626d91d0..88a6c3599 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/compare.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/compare.c
|
|
|
081b2d |
@@ -47,9 +47,11 @@ do_compare(Slapi_PBlock *pb)
|
|
|
081b2d |
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_TRACE, "do_compare", "=>\n");
|
|
|
081b2d |
|
|
|
081b2d |
+ /* have to init this here so we can "done" it below if we short circuit */
|
|
|
081b2d |
+ slapi_sdn_init(&sdn;;
|
|
|
081b2d |
+
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
-
|
|
|
081b2d |
if (pb_op == NULL || pb_conn == NULL) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, "do_compare", "NULL param: pb_conn (0x%p) pb_op (0x%p)\n",
|
|
|
081b2d |
pb_conn, pb_op);
|
|
|
081b2d |
@@ -62,9 +64,6 @@ do_compare(Slapi_PBlock *pb)
|
|
|
081b2d |
/* count the compare request */
|
|
|
081b2d |
slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsCompareOps);
|
|
|
081b2d |
|
|
|
081b2d |
- /* have to init this here so we can "done" it below if we short circuit */
|
|
|
081b2d |
- slapi_sdn_init(&sdn;;
|
|
|
081b2d |
-
|
|
|
081b2d |
/*
|
|
|
081b2d |
* Parse the compare request. It looks like this:
|
|
|
081b2d |
*
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
|
|
|
081b2d |
index fa24ec040..5d2b64ed2 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/connection.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/connection.c
|
|
|
081b2d |
@@ -1526,18 +1526,6 @@ connection_threadmain()
|
|
|
081b2d |
[blackflag 624234] */
|
|
|
081b2d |
ret = connection_wait_for_new_work(pb, interval);
|
|
|
081b2d |
|
|
|
081b2d |
- /*
|
|
|
081b2d |
- * Connection wait for new work provides the conn and op for us.
|
|
|
081b2d |
- */
|
|
|
081b2d |
- slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
- if (pb_conn == NULL) {
|
|
|
081b2d |
- slapi_log_err(SLAPI_LOG_ERR, "connection_threadmain",
|
|
|
081b2d |
- "pb_conn is NULL\n");
|
|
|
081b2d |
- slapi_pblock_destroy(pb);
|
|
|
081b2d |
- g_decr_active_threadcnt();
|
|
|
081b2d |
- return;
|
|
|
081b2d |
- }
|
|
|
081b2d |
-
|
|
|
081b2d |
switch (ret) {
|
|
|
081b2d |
case CONN_NOWORK:
|
|
|
081b2d |
PR_ASSERT(interval != PR_INTERVAL_NO_TIMEOUT); /* this should never happen with PR_INTERVAL_NO_TIMEOUT */
|
|
|
081b2d |
@@ -1550,15 +1538,22 @@ connection_threadmain()
|
|
|
081b2d |
return;
|
|
|
081b2d |
case CONN_FOUND_WORK_TO_DO:
|
|
|
081b2d |
/* note - don't need to lock here - connection should only
|
|
|
081b2d |
- be used by this thread - since c_gettingber is set to 1
|
|
|
081b2d |
- in connection_activity when the conn is added to the
|
|
|
081b2d |
- work queue, setup_pr_read_pds won't add the connection prfd
|
|
|
081b2d |
- to the poll list */
|
|
|
081b2d |
+ be used by this thread - since c_gettingber is set to 1
|
|
|
081b2d |
+ in connection_activity when the conn is added to the
|
|
|
081b2d |
+ work queue, setup_pr_read_pds won't add the connection prfd
|
|
|
081b2d |
+ to the poll list */
|
|
|
081b2d |
+ slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
+ if (pb_conn == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "connection_threadmain", "pb_conn is NULL\n");
|
|
|
081b2d |
+ slapi_pblock_destroy(pb);
|
|
|
081b2d |
+ g_decr_active_threadcnt();
|
|
|
081b2d |
+ return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
if (pb_conn->c_opscompleted == 0) {
|
|
|
081b2d |
/*
|
|
|
081b2d |
- * We have a new connection, set the anonymous reslimit idletimeout
|
|
|
081b2d |
- * if applicable.
|
|
|
081b2d |
- */
|
|
|
081b2d |
+ * We have a new connection, set the anonymous reslimit idletimeout
|
|
|
081b2d |
+ * if applicable.
|
|
|
081b2d |
+ */
|
|
|
081b2d |
char *anon_dn = config_get_anon_limits_dn();
|
|
|
081b2d |
int idletimeout;
|
|
|
081b2d |
/* If an anonymous limits dn is set, use it to set the limits. */
|
|
|
081b2d |
@@ -1578,6 +1573,7 @@ connection_threadmain()
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, "connection_threadmain",
|
|
|
081b2d |
"Could not add/remove IO layers from connection\n");
|
|
|
081b2d |
}
|
|
|
081b2d |
+ break;
|
|
|
081b2d |
default:
|
|
|
081b2d |
break;
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -1604,6 +1600,12 @@ connection_threadmain()
|
|
|
081b2d |
/* Once we're here we have a pb */
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &conn;;
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
|
|
|
081b2d |
+ if (conn == NULL || op == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "connection_threadmain", "NULL param: conn (0x%p) op (0x%p)\n", conn, op);
|
|
|
081b2d |
+ slapi_pblock_destroy(pb);
|
|
|
081b2d |
+ g_decr_active_threadcnt();
|
|
|
081b2d |
+ return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
maxthreads = config_get_maxthreadsperconn();
|
|
|
081b2d |
more_data = 0;
|
|
|
081b2d |
ret = connection_read_operation(conn, op, &tag, &more_data);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
|
|
|
081b2d |
index 366ec7897..4fd8473be 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/control.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/control.c
|
|
|
081b2d |
@@ -304,6 +304,12 @@ get_ldapmessage_controls_ext(
|
|
|
081b2d |
|
|
|
081b2d |
Operation *pb_op = NULL;
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
+ if (pb_op == NULL) {
|
|
|
081b2d |
+ rc = LDAP_OPERATIONS_ERROR;
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "get_ldapmessage_controls_ext", "NULL pb_op\n");
|
|
|
081b2d |
+ slapi_rwlock_unlock(supported_controls_lock);
|
|
|
081b2d |
+ goto free_and_return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
if (supported_controls == NULL ||
|
|
|
081b2d |
supported_controls[i] == NULL ||
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
|
|
|
081b2d |
index 662e91aa7..932912c17 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/dse.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/dse.c
|
|
|
081b2d |
@@ -1727,8 +1727,9 @@ dse_modify(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
- internal_op = operation_is_flag_set(pb_op, OP_FLAG_INTERNAL);
|
|
|
081b2d |
-
|
|
|
081b2d |
+ if (pb_op){
|
|
|
081b2d |
+ internal_op = operation_is_flag_set(pb_op, OP_FLAG_INTERNAL);
|
|
|
081b2d |
+ }
|
|
|
081b2d |
/* Find the entry we are about to modify. */
|
|
|
081b2d |
ec = dse_get_entry_copy(pdse, sdn, DSE_USE_LOCK);
|
|
|
081b2d |
if (ec == NULL) {
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/eventq.c b/ldap/servers/slapd/eventq.c
|
|
|
081b2d |
index 8fccf38a8..a491acd0a 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/eventq.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/eventq.c
|
|
|
081b2d |
@@ -462,7 +462,7 @@ slapi_eq_get_arg(Slapi_Eq_Context ctx)
|
|
|
081b2d |
slapi_eq_context **p;
|
|
|
081b2d |
|
|
|
081b2d |
PR_ASSERT(eq_initialized);
|
|
|
081b2d |
- if (!eq_stopped) {
|
|
|
081b2d |
+ if (eq && !eq_stopped) {
|
|
|
081b2d |
PR_Lock(eq->eq_lock);
|
|
|
081b2d |
p = &(eq->eq_queue);
|
|
|
081b2d |
while (p && *p != NULL) {
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
|
|
|
081b2d |
index 815949be6..98595bcaa 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/extendop.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/extendop.c
|
|
|
081b2d |
@@ -135,10 +135,12 @@ extop_handle_import_start(Slapi_PBlock *pb, char *extoid __attribute__((unused))
|
|
|
081b2d |
* connection block & mark this connection as belonging to a bulk import
|
|
|
081b2d |
*/
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
- PR_EnterMonitor(pb_conn->c_mutex);
|
|
|
081b2d |
- pb_conn->c_flags |= CONN_FLAG_IMPORT;
|
|
|
081b2d |
- pb_conn->c_bi_backend = be;
|
|
|
081b2d |
- PR_ExitMonitor(pb_conn->c_mutex);
|
|
|
081b2d |
+ if (pb_conn) {
|
|
|
081b2d |
+ PR_EnterMonitor(pb_conn->c_mutex);
|
|
|
081b2d |
+ pb_conn->c_flags |= CONN_FLAG_IMPORT;
|
|
|
081b2d |
+ pb_conn->c_bi_backend = be;
|
|
|
081b2d |
+ PR_ExitMonitor(pb_conn->c_mutex);
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_set(pb, SLAPI_EXT_OP_RET_OID, EXTOP_BULK_IMPORT_START_OID);
|
|
|
081b2d |
bv.bv_val = NULL;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
|
|
|
081b2d |
index ef975e679..2ac3d2cd8 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/filter.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/filter.c
|
|
|
081b2d |
@@ -686,11 +686,13 @@ slapi_filter_dup(Slapi_Filter *f)
|
|
|
081b2d |
outl = &out->f_list;
|
|
|
081b2d |
for (fl = f->f_list; fl != NULL; fl = fl->f_next) {
|
|
|
081b2d |
(*outl) = slapi_filter_dup(fl);
|
|
|
081b2d |
- (*outl)->f_next = 0;
|
|
|
081b2d |
- if (lastout)
|
|
|
081b2d |
- lastout->f_next = *outl;
|
|
|
081b2d |
- lastout = *outl;
|
|
|
081b2d |
- outl = &((*outl)->f_next);
|
|
|
081b2d |
+ if (*outl){
|
|
|
081b2d |
+ (*outl)->f_next = 0;
|
|
|
081b2d |
+ if (lastout)
|
|
|
081b2d |
+ lastout->f_next = *outl;
|
|
|
081b2d |
+ lastout = *outl;
|
|
|
081b2d |
+ outl = &((*outl)->f_next);
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
break;
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
|
|
|
081b2d |
index 47ca90047..97cb7b489 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/index_subsystem.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/index_subsystem.c
|
|
|
081b2d |
@@ -1179,7 +1179,7 @@ index_subsys_assign_decoder(Slapi_Filter *f)
|
|
|
081b2d |
* have the same associated attributes configuration for now
|
|
|
081b2d |
* though they may have different namespaces
|
|
|
081b2d |
*/
|
|
|
081b2d |
- if (index_subsys_index_matches_index(f->assigned_decoder, index)) {
|
|
|
081b2d |
+ if (index_subsys_index_matches_index(f->assigned_decoder, index) && last) {
|
|
|
081b2d |
/* add to end */
|
|
|
081b2d |
last->list.pNext = index_subsys_index_shallow_dup(index);
|
|
|
081b2d |
last = last->list.pNext;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
|
|
|
081b2d |
index ddaceffea..e1493bb80 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/main.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/main.c
|
|
|
081b2d |
@@ -683,13 +683,26 @@ main(int argc, char **argv)
|
|
|
081b2d |
{
|
|
|
081b2d |
char *s = getenv("DEBUG_SLEEP");
|
|
|
081b2d |
if ((s != NULL) && isdigit(*s)) {
|
|
|
081b2d |
- int secs = atoi(s);
|
|
|
081b2d |
- printf("slapd pid is %d\n", getpid());
|
|
|
081b2d |
+ char *endp = NULL;
|
|
|
081b2d |
+ int64_t secs;
|
|
|
081b2d |
+ errno = 0;
|
|
|
081b2d |
+
|
|
|
081b2d |
+ secs = strtol(s, &endp, 10);
|
|
|
081b2d |
+ if ( endp == s ||
|
|
|
081b2d |
+ *endp != '\0' ||
|
|
|
081b2d |
+ ((secs == LONG_MIN || secs == LONG_MAX) && errno == ERANGE) ||
|
|
|
081b2d |
+ secs < 1 )
|
|
|
081b2d |
+ {
|
|
|
081b2d |
+ /* Invalid value, default to 30 seconds */
|
|
|
081b2d |
+ secs = 30;
|
|
|
081b2d |
+ } else if (secs > 3600) {
|
|
|
081b2d |
+ secs = 3600;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+ printf("slapd pid is %d - sleeping for %ld\n", getpid(), secs);
|
|
|
081b2d |
sleep(secs);
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
-
|
|
|
081b2d |
/* used to set configfile to the default config file name here */
|
|
|
081b2d |
if ((mcfg.myname = strrchr(argv[0], '/')) == NULL) {
|
|
|
081b2d |
mcfg.myname = slapi_ch_strdup(argv[0]);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
|
|
|
081b2d |
index 8cc531834..472a2f6aa 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/mapping_tree.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/mapping_tree.c
|
|
|
081b2d |
@@ -2629,7 +2629,7 @@ mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb, Slapi_Backend **be,
|
|
|
081b2d |
(target_node->mtn_be_states[*index] == SLAPI_BE_STATE_OFFLINE)) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_TRACE, "mtn_get_be",
|
|
|
081b2d |
"Operation attempted on backend in OFFLINE state : %s\n",
|
|
|
081b2d |
- target_node->mtn_backend_names[*index]);
|
|
|
081b2d |
+ target_node->mtn_backend_names ? target_node->mtn_backend_names[*index] : "Unknown backend");
|
|
|
081b2d |
result = LDAP_OPERATIONS_ERROR;
|
|
|
081b2d |
*be = defbackend_get_backend();
|
|
|
081b2d |
}
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
|
|
|
081b2d |
index 10d263159..f2f6d1783 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/modify.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/modify.c
|
|
|
081b2d |
@@ -123,7 +123,7 @@ do_modify(Slapi_PBlock *pb)
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
- if (operation == NULL) {
|
|
|
081b2d |
+ if (operation == NULL || pb_conn == NULL) {
|
|
|
081b2d |
send_ldap_result(pb, LDAP_OPERATIONS_ERROR,
|
|
|
081b2d |
NULL, "operation is NULL parameter", 0, NULL);
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_ERR, "do_modify",
|
|
|
081b2d |
@@ -1156,6 +1156,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
char *proxydn = NULL;
|
|
|
081b2d |
char *proxystr = NULL;
|
|
|
081b2d |
char *errtext = NULL;
|
|
|
081b2d |
+ int32_t needpw = 0;
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
|
|
|
081b2d |
if (repl_op) {
|
|
|
081b2d |
@@ -1169,24 +1170,23 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_REQUESTOR_ISROOT, &isroot);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_PWPOLICY, &pwresponse_req);
|
|
|
081b2d |
- internal_op = operation_is_flag_set(operation, OP_FLAG_INTERNAL);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
+ slapi_sdn_init_dn_byref(&sdn, dn);
|
|
|
081b2d |
|
|
|
081b2d |
- if (pb_conn == NULL || operation == NULL) {
|
|
|
081b2d |
- slapi_log_err(SLAPI_LOG_ERR, "op_shared_allow_pw_change",
|
|
|
081b2d |
- "NULL param error: conn (0x%p) op (0x%p)\n", pb_conn, operation);
|
|
|
081b2d |
+ if (operation == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "op_shared_allow_pw_change", "NULL operation\n");
|
|
|
081b2d |
rc = -1;
|
|
|
081b2d |
goto done;
|
|
|
081b2d |
}
|
|
|
081b2d |
-
|
|
|
081b2d |
- slapi_sdn_init_dn_byref(&sdn, dn);
|
|
|
081b2d |
- pwpolicy = new_passwdPolicy(pb, (char *)slapi_sdn_get_ndn(&sdn));
|
|
|
081b2d |
+ if (pb_conn) {
|
|
|
081b2d |
+ needpw = pb_conn->c_needpw;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
/* get the proxy auth dn if the proxy auth control is present */
|
|
|
081b2d |
if ((proxy_err = proxyauth_get_dn(pb, &proxydn, &errtext)) != LDAP_SUCCESS) {
|
|
|
081b2d |
if (operation_is_flag_set(operation, OP_FLAG_ACTION_LOG_ACCESS)) {
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
|
|
|
081b2d |
- pb_conn->c_connid, operation->o_opid,
|
|
|
081b2d |
+ pb_conn ? pb_conn->c_connid: -1, operation->o_opid,
|
|
|
081b2d |
slapi_sdn_get_dn(&sdn));
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -1195,6 +1195,9 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
goto done;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
+ pwpolicy = new_passwdPolicy(pb, (char *)slapi_sdn_get_ndn(&sdn));
|
|
|
081b2d |
+ internal_op = operation_is_flag_set(operation, OP_FLAG_INTERNAL);
|
|
|
081b2d |
+
|
|
|
081b2d |
/* internal operation has root permissions for subtrees it is allowed to access */
|
|
|
081b2d |
if (!internal_op) {
|
|
|
081b2d |
/* slapi_acl_check_mods needs an array of LDAPMods, but
|
|
|
081b2d |
@@ -1225,7 +1228,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
|
|
|
081b2d |
}
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s\n",
|
|
|
081b2d |
- pb_conn->c_connid, operation->o_opid,
|
|
|
081b2d |
+ pb_conn ? pb_conn->c_connid : -1, operation->o_opid,
|
|
|
081b2d |
slapi_sdn_get_dn(&sdn), proxystr ? proxystr : "");
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -1254,7 +1257,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
|
|
|
081b2d |
/* Check if password policy allows users to change their passwords.*/
|
|
|
081b2d |
if (!operation->o_isroot && slapi_sdn_compare(&sdn, &operation->o_sdn) == 0 &&
|
|
|
081b2d |
- !pb_conn->c_needpw && !pwpolicy->pw_change) {
|
|
|
081b2d |
+ !needpw && !pwpolicy->pw_change) {
|
|
|
081b2d |
if (pwresponse_req == 1) {
|
|
|
081b2d |
slapi_pwpolicy_make_response_control(pb, -1, -1, LDAP_PWPOLICY_PWDMODNOTALLOWED);
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -1267,7 +1270,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
081b2d |
- pb_conn->c_connid, operation->o_opid,
|
|
|
081b2d |
+ pb_conn ? pb_conn->c_connid : -1, operation->o_opid,
|
|
|
081b2d |
slapi_sdn_get_dn(&sdn),
|
|
|
081b2d |
proxystr ? proxystr : "",
|
|
|
081b2d |
"user is not allowed to change password");
|
|
|
081b2d |
@@ -1280,8 +1283,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
|
|
|
081b2d |
/* check if password is within password minimum age;
|
|
|
081b2d |
error result is sent directly from check_pw_minage */
|
|
|
081b2d |
- if (pb_conn && !pb_conn->c_needpw &&
|
|
|
081b2d |
- check_pw_minage(pb, &sdn, mod->mod_bvalues) == 1) {
|
|
|
081b2d |
+ if (!needpw && check_pw_minage(pb, &sdn, mod->mod_bvalues) == 1) {
|
|
|
081b2d |
if (operation_is_flag_set(operation, OP_FLAG_ACTION_LOG_ACCESS)) {
|
|
|
081b2d |
if (proxydn) {
|
|
|
081b2d |
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
|
|
|
081b2d |
@@ -1289,7 +1291,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
|
|
|
081b2d |
if (!internal_op) {
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
081b2d |
- pb_conn->c_connid,
|
|
|
081b2d |
+ pb_conn ? pb_conn->c_connid : -1,
|
|
|
081b2d |
operation->o_opid,
|
|
|
081b2d |
slapi_sdn_get_dn(&sdn),
|
|
|
081b2d |
proxystr ? proxystr : "",
|
|
|
081b2d |
@@ -1303,17 +1305,14 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
"within password minimum age");
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
-
|
|
|
081b2d |
rc = -1;
|
|
|
081b2d |
goto done;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
-
|
|
|
081b2d |
/* check password syntax; remember the old password;
|
|
|
081b2d |
error sent directly from check_pw_syntax function */
|
|
|
081b2d |
valuearray_init_bervalarray(mod->mod_bvalues, &values);
|
|
|
081b2d |
- switch (check_pw_syntax_ext(pb, &sdn, values, old_pw, NULL,
|
|
|
081b2d |
- mod->mod_op, smods)) {
|
|
|
081b2d |
+ switch (check_pw_syntax_ext(pb, &sdn, values, old_pw, NULL, mod->mod_op, smods)) {
|
|
|
081b2d |
case 0: /* success */
|
|
|
081b2d |
rc = 1;
|
|
|
081b2d |
break;
|
|
|
081b2d |
@@ -1326,7 +1325,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
|
|
|
081b2d |
|
|
|
081b2d |
if (!internal_op) {
|
|
|
081b2d |
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
081b2d |
- pb_conn->c_connid,
|
|
|
081b2d |
+ pb_conn ? pb_conn->c_connid : -1,
|
|
|
081b2d |
operation->o_opid,
|
|
|
081b2d |
slapi_sdn_get_dn(&sdn),
|
|
|
081b2d |
proxystr ? proxystr : "",
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
|
|
|
081b2d |
index 46dcf6fba..50b7ae8f6 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/opshared.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/opshared.c
|
|
|
081b2d |
@@ -276,6 +276,13 @@ op_shared_search(Slapi_PBlock *pb, int send_result)
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_SEARCH_STRFILTER, &fstr);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_SEARCH_ATTRS, &attrs);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
|
|
|
081b2d |
+ if (operation == NULL) {
|
|
|
081b2d |
+ op_shared_log_error_access(pb, "SRCH", base, "NULL operation");
|
|
|
081b2d |
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "NULL operation", 0, NULL);
|
|
|
081b2d |
+ rc = -1;
|
|
|
081b2d |
+ goto free_and_return_nolock;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
internal_op = operation_is_flag_set(operation, OP_FLAG_INTERNAL);
|
|
|
081b2d |
flag_psearch = operation_is_flag_set(operation, OP_FLAG_PS);
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c
|
|
|
081b2d |
index 40145af2e..5f21f2f71 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/passwd_extop.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/passwd_extop.c
|
|
|
081b2d |
@@ -727,6 +727,10 @@ parse_req_done:
|
|
|
081b2d |
*/
|
|
|
081b2d |
Operation *pb_op = NULL;
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
+ if (pb_op == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "passwd_modify_extop", "pb_op is NULL");
|
|
|
081b2d |
+ goto free_and_return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
operation_set_target_spec(pb_op, slapi_entry_get_sdn(targetEntry));
|
|
|
081b2d |
slapi_pblock_set(pb, SLAPI_REQUESTOR_ISROOT, &pb_op->o_isroot);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
|
|
|
081b2d |
index e02133abc..2db3c7fcd 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/plugin.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/plugin.c
|
|
|
081b2d |
@@ -3625,9 +3625,11 @@ plugin_invoke_plugin_pb(struct slapdplugin *plugin, int operation, Slapi_PBlock
|
|
|
081b2d |
return PR_TRUE;
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
-
|
|
|
081b2d |
-
|
|
|
081b2d |
- PR_ASSERT(pb_op);
|
|
|
081b2d |
+ if (pb_op == NULL) {
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "plugin_invoke_plugin_pb", "pb_op is NULL");
|
|
|
081b2d |
+ PR_ASSERT(0);
|
|
|
081b2d |
+ return PR_FALSE;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
target_spec = operation_get_target_spec(pb_op);
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c
|
|
|
081b2d |
index 52b8df8c3..f6bbafb92 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/plugin_internal_op.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/plugin_internal_op.c
|
|
|
081b2d |
@@ -527,6 +527,7 @@ internal_plugin_search_entry_callback(Slapi_Entry *e, void *callback_data)
|
|
|
081b2d |
this_entry = (Entry_Node *)slapi_ch_calloc(1, sizeof(Entry_Node));
|
|
|
081b2d |
|
|
|
081b2d |
if ((this_entry->data = slapi_entry_dup(e)) == NULL) {
|
|
|
081b2d |
+ slapi_ch_free((void**)&this_entry);
|
|
|
081b2d |
return (0);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
|
|
|
081b2d |
index 1bf062954..8ad268a85 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/psearch.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/psearch.c
|
|
|
081b2d |
@@ -353,8 +353,8 @@ ps_send_results(void *arg)
|
|
|
081b2d |
if (rc) {
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
081b2d |
"conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
|
|
|
081b2d |
- pb_conn->c_connid, pb_op->o_opid,
|
|
|
081b2d |
- rc, slapi_entry_get_dn_const(ec), pb_op->o_status);
|
|
|
081b2d |
+ pb_conn->c_connid, pb_op ? pb_op->o_opid: -1,
|
|
|
081b2d |
+ rc, slapi_entry_get_dn_const(ec), pb_op ? pb_op->o_status : -1);
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -401,7 +401,7 @@ ps_send_results(void *arg)
|
|
|
081b2d |
|
|
|
081b2d |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
081b2d |
"conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
|
|
|
081b2d |
- conn->c_connid, pb_op->o_opid);
|
|
|
081b2d |
+ conn->c_connid, pb_op ? pb_op->o_opid : -1);
|
|
|
081b2d |
/* Delete this op from the connection's list */
|
|
|
081b2d |
connection_remove_operation_ext(ps->ps_pblock, conn, pb_op);
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
|
|
|
081b2d |
index 0cf795b41..53464c64a 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/pw.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/pw.c
|
|
|
081b2d |
@@ -1741,7 +1741,6 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn)
|
|
|
081b2d |
pwdpolicy->pw_min8bit = SLAPD_DEFAULT_PW_MIN8BIT;
|
|
|
081b2d |
pwdpolicy->pw_maxrepeats = SLAPD_DEFAULT_PW_MAXREPEATS;
|
|
|
081b2d |
pwdpolicy->pw_mincategories = SLAPD_DEFAULT_PW_MINCATEGORIES;
|
|
|
081b2d |
- pwdpolicy->pw_mintokenlength = SLAPD_DEFAULT_PW_MINTOKENLENGTH;
|
|
|
081b2d |
pwdpolicy->pw_maxage = SLAPD_DEFAULT_PW_MAXAGE;
|
|
|
081b2d |
pwdpolicy->pw_minage = SLAPD_DEFAULT_PW_MINAGE;
|
|
|
081b2d |
pwdpolicy->pw_warning = SLAPD_DEFAULT_PW_WARNING;
|
|
|
081b2d |
@@ -2229,7 +2228,7 @@ slapi_check_account_lock(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int p
|
|
|
081b2d |
/*
|
|
|
081b2d |
* Check if the password policy has to be checked or not
|
|
|
081b2d |
*/
|
|
|
081b2d |
- if (!check_password_policy || pwpolicy->pw_lockout == 0) {
|
|
|
081b2d |
+ if (!check_password_policy || !pwpolicy || pwpolicy->pw_lockout == 0) {
|
|
|
081b2d |
goto notlocked;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c
|
|
|
081b2d |
index 50bcbde99..602868470 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/pw_mgmt.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/pw_mgmt.c
|
|
|
081b2d |
@@ -44,6 +44,7 @@ need_new_pw(Slapi_PBlock *pb, Slapi_Entry *e, int pwresponse_req)
|
|
|
081b2d |
char graceUserTime[16] = {0};
|
|
|
081b2d |
Connection *pb_conn = NULL;
|
|
|
081b2d |
long t;
|
|
|
081b2d |
+ int needpw = 0;
|
|
|
081b2d |
|
|
|
081b2d |
if (NULL == e) {
|
|
|
081b2d |
return (-1);
|
|
|
081b2d |
@@ -91,6 +92,9 @@ need_new_pw(Slapi_PBlock *pb, Slapi_Entry *e, int pwresponse_req)
|
|
|
081b2d |
slapi_ch_free_string(&passwordExpirationTime);
|
|
|
081b2d |
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
+ if (pb_conn) {
|
|
|
081b2d |
+ needpw = pb_conn->c_needpw;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
/* Check if password has been reset */
|
|
|
081b2d |
if (pw_exp_date == NO_TIME) {
|
|
|
081b2d |
@@ -99,7 +103,11 @@ need_new_pw(Slapi_PBlock *pb, Slapi_Entry *e, int pwresponse_req)
|
|
|
081b2d |
if (pwpolicy->pw_must_change) {
|
|
|
081b2d |
/* set c_needpw for this connection to be true. this client
|
|
|
081b2d |
now can only change its own password */
|
|
|
081b2d |
- pb_conn->c_needpw = 1;
|
|
|
081b2d |
+ if (pb_conn){
|
|
|
081b2d |
+ pb_conn->c_needpw = needpw = 1;
|
|
|
081b2d |
+ } else {
|
|
|
081b2d |
+ needpw = 1;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
t = 0;
|
|
|
081b2d |
/* We need to include "changeafterreset" error in
|
|
|
081b2d |
* passwordpolicy response control. So, we will not be
|
|
|
081b2d |
@@ -121,7 +129,7 @@ skip:
|
|
|
081b2d |
/* if password never expires, don't need to go on; return 0 */
|
|
|
081b2d |
if (pwpolicy->pw_exp == 0) {
|
|
|
081b2d |
/* check for "changeafterreset" condition */
|
|
|
081b2d |
- if (pb_conn->c_needpw == 1) {
|
|
|
081b2d |
+ if (needpw == 1) {
|
|
|
081b2d |
if (pwresponse_req) {
|
|
|
081b2d |
slapi_pwpolicy_make_response_control(pb, -1, -1, LDAP_PWPOLICY_CHGAFTERRESET);
|
|
|
081b2d |
}
|
|
|
081b2d |
@@ -150,7 +158,7 @@ skip:
|
|
|
081b2d |
slapi_mods_done(&smods);
|
|
|
081b2d |
if (pwresponse_req) {
|
|
|
081b2d |
/* check for "changeafterreset" condition */
|
|
|
081b2d |
- if (pb_conn->c_needpw == 1) {
|
|
|
081b2d |
+ if (needpw == 1) {
|
|
|
081b2d |
slapi_pwpolicy_make_response_control(pb, -1,
|
|
|
081b2d |
((pwpolicy->pw_gracelimit) - pwdGraceUserTime),
|
|
|
081b2d |
LDAP_PWPOLICY_CHGAFTERRESET);
|
|
|
081b2d |
@@ -182,9 +190,11 @@ skip:
|
|
|
081b2d |
if (pb_conn && (LDAP_VERSION2 == pb_conn->c_ldapversion)) {
|
|
|
081b2d |
Operation *pb_op = NULL;
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
081b2d |
- /* We close the connection only with LDAPv2 connections */
|
|
|
081b2d |
- disconnect_server(pb_conn, pb_op->o_connid,
|
|
|
081b2d |
- pb_op->o_opid, SLAPD_DISCONNECT_UNBIND, 0);
|
|
|
081b2d |
+ if (pb_op) {
|
|
|
081b2d |
+ /* We close the connection only with LDAPv2 connections */
|
|
|
081b2d |
+ disconnect_server(pb_conn, pb_op->o_connid,
|
|
|
081b2d |
+ pb_op->o_opid, SLAPD_DISCONNECT_UNBIND, 0);
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
/* Apply current modifications */
|
|
|
081b2d |
pw_apply_mods(sdn, &smods);
|
|
|
081b2d |
@@ -207,7 +217,7 @@ skip:
|
|
|
081b2d |
/* reset the expiration time to current + warning time
|
|
|
081b2d |
* and set passwordExpWarned to true
|
|
|
081b2d |
*/
|
|
|
081b2d |
- if (pb_conn->c_needpw != 1) {
|
|
|
081b2d |
+ if (needpw != 1) {
|
|
|
081b2d |
pw_exp_date = time_plus_sec(cur_time, pwpolicy->pw_warning);
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
@@ -227,14 +237,14 @@ skip:
|
|
|
081b2d |
slapi_mods_done(&smods);
|
|
|
081b2d |
if (pwresponse_req) {
|
|
|
081b2d |
/* check for "changeafterreset" condition */
|
|
|
081b2d |
- if (pb_conn->c_needpw == 1) {
|
|
|
081b2d |
+ if (needpw == 1) {
|
|
|
081b2d |
slapi_pwpolicy_make_response_control(pb, t, -1, LDAP_PWPOLICY_CHGAFTERRESET);
|
|
|
081b2d |
} else {
|
|
|
081b2d |
slapi_pwpolicy_make_response_control(pb, t, -1, -1);
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
- if (pb_conn->c_needpw == 1) {
|
|
|
081b2d |
+ if (needpw == 1) {
|
|
|
081b2d |
slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
|
|
|
081b2d |
} else {
|
|
|
081b2d |
slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRING, t);
|
|
|
081b2d |
@@ -250,7 +260,7 @@ skip:
|
|
|
081b2d |
pw_apply_mods(sdn, &smods);
|
|
|
081b2d |
slapi_mods_done(&smods);
|
|
|
081b2d |
/* Leftover from "changeafterreset" condition */
|
|
|
081b2d |
- if (pb_conn->c_needpw == 1) {
|
|
|
081b2d |
+ if (needpw == 1) {
|
|
|
081b2d |
slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
|
|
|
081b2d |
}
|
|
|
081b2d |
/* passes checking, return 0 */
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
|
|
|
081b2d |
index ce394d948..6892ccfdc 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/result.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/result.c
|
|
|
081b2d |
@@ -1340,7 +1340,7 @@ send_specific_attrs(Slapi_Entry *e, char **attrs, Slapi_Operation *op, Slapi_PBl
|
|
|
081b2d |
attrs = attrs_ext;
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
- for (i = 0; attrs && attrs[i] != NULL; i++) {
|
|
|
081b2d |
+ for (i = 0; my_searchattrs && attrs && attrs[i] != NULL; i++) {
|
|
|
081b2d |
char *current_type_name = attrs[i];
|
|
|
081b2d |
Slapi_ValueSet **values = NULL;
|
|
|
081b2d |
int attr_free_flags = 0;
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
|
|
|
081b2d |
index 67da97148..0907c623f 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/saslbind.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/saslbind.c
|
|
|
081b2d |
@@ -884,6 +884,11 @@ ids_sasl_check_bind(Slapi_PBlock *pb)
|
|
|
081b2d |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
081b2d |
PR_ASSERT(pb_conn);
|
|
|
081b2d |
|
|
|
081b2d |
+ if (pb_conn == NULL){
|
|
|
081b2d |
+ slapi_log_err(SLAPI_LOG_ERR, "ids_sasl_check_bind", "pb_conn is NULL\n");
|
|
|
081b2d |
+ return;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
+
|
|
|
081b2d |
PR_EnterMonitor(pb_conn->c_mutex); /* BIG LOCK */
|
|
|
081b2d |
continuing = pb_conn->c_flags & CONN_FLAG_SASL_CONTINUE;
|
|
|
081b2d |
pb_conn->c_flags &= ~CONN_FLAG_SASL_CONTINUE; /* reset flag */
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
|
|
|
081b2d |
index 002083c04..4bd8895ff 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/task.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/task.c
|
|
|
081b2d |
@@ -2335,8 +2335,9 @@ task_fixup_tombstone_thread(void *arg)
|
|
|
081b2d |
Slapi_Task *task = task_data->task;
|
|
|
081b2d |
char **base = task_data->base;
|
|
|
081b2d |
char *filter = NULL;
|
|
|
081b2d |
- int fixup_count = 0;
|
|
|
081b2d |
- int rc, i, j;
|
|
|
081b2d |
+ int32_t fixup_count = 0;
|
|
|
081b2d |
+ int32_t rc = 0;
|
|
|
081b2d |
+ int32_t i, j;
|
|
|
081b2d |
|
|
|
081b2d |
if (!task) {
|
|
|
081b2d |
return; /* no task */
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
|
|
|
081b2d |
index a0f3268da..a72de9b07 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/util.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/util.c
|
|
|
081b2d |
@@ -746,8 +746,9 @@ normalize_mods2bvals(const LDAPMod **mods)
|
|
|
081b2d |
struct berval **mbvp = NULL;
|
|
|
081b2d |
|
|
|
081b2d |
for (mbvp = mods[w]->mod_bvalues,
|
|
|
081b2d |
- normmbvp = normalized_mods[w]->mod_bvalues;
|
|
|
081b2d |
- mbvp && *mbvp; mbvp++, normmbvp++) {
|
|
|
081b2d |
+ normmbvp = normalized_mods[w]->mod_bvalues;
|
|
|
081b2d |
+ normmbvp && mbvp && *mbvp; mbvp++, normmbvp++)
|
|
|
081b2d |
+ {
|
|
|
081b2d |
if (is_dn_syntax) {
|
|
|
081b2d |
Slapi_DN *sdn = slapi_sdn_new_dn_byref((*mbvp)->bv_val);
|
|
|
081b2d |
if (slapi_sdn_get_dn(sdn)) {
|
|
|
081b2d |
@@ -769,8 +770,9 @@ normalize_mods2bvals(const LDAPMod **mods)
|
|
|
081b2d |
char **mvp = NULL;
|
|
|
081b2d |
|
|
|
081b2d |
for (mvp = mods[w]->mod_values,
|
|
|
081b2d |
- normmbvp = normalized_mods[w]->mod_bvalues;
|
|
|
081b2d |
- mvp && *mvp; mvp++, normmbvp++) {
|
|
|
081b2d |
+ normmbvp = normalized_mods[w]->mod_bvalues;
|
|
|
081b2d |
+ normmbvp && mvp && *mvp; mvp++, normmbvp++)
|
|
|
081b2d |
+ {
|
|
|
081b2d |
vlen = strlen(*mvp);
|
|
|
081b2d |
|
|
|
081b2d |
*normmbvp =
|
|
|
081b2d |
@@ -801,7 +803,7 @@ normalize_mods2bvals(const LDAPMod **mods)
|
|
|
081b2d |
PR_ASSERT(normmbvp - normalized_mods[w]->mod_bvalues <= num_values);
|
|
|
081b2d |
|
|
|
081b2d |
/* don't forget to null terminate it */
|
|
|
081b2d |
- if (num_values > 0) {
|
|
|
081b2d |
+ if (num_values > 0 && normmbvp) {
|
|
|
081b2d |
*normmbvp = NULL;
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
|
|
|
081b2d |
index 14ebc48e6..2af3ee18d 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/valueset.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/valueset.c
|
|
|
081b2d |
@@ -121,7 +121,9 @@ valuearray_add_valuearray_fast(Slapi_Value ***vals,
|
|
|
081b2d |
j++;
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
- (*vals)[nvals + j] = NULL;
|
|
|
081b2d |
+ if (*vals) {
|
|
|
081b2d |
+ (*vals)[nvals + j] = NULL;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
void
|
|
|
081b2d |
@@ -1138,7 +1140,7 @@ slapi_valueset_add_attr_valuearray_ext(const Slapi_Attr *a, Slapi_ValueSet *vs,
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
for (size_t i = 0; i < naddvals; i++) {
|
|
|
081b2d |
- if (addvals[i] != NULL) {
|
|
|
081b2d |
+ if (addvals[i] != NULL && vs->va) {
|
|
|
081b2d |
if (passin) {
|
|
|
081b2d |
/* We consume the values */
|
|
|
081b2d |
(vs->va)[vs->num] = addvals[i];
|
|
|
081b2d |
@@ -1166,7 +1168,9 @@ slapi_valueset_add_attr_valuearray_ext(const Slapi_Attr *a, Slapi_ValueSet *vs,
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
- (vs->va)[vs->num] = NULL;
|
|
|
081b2d |
+ if (vs->va){
|
|
|
081b2d |
+ (vs->va)[vs->num] = NULL;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
|
|
|
081b2d |
PR_ASSERT((vs->sorted == NULL) || (vs->num < VALUESET_ARRAY_SORT_THRESHOLD) || ((vs->num >= VALUESET_ARRAY_SORT_THRESHOLD) && (vs->sorted[0] < vs->num)));
|
|
|
081b2d |
return (rc);
|
|
|
081b2d |
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
|
|
|
081b2d |
index 13e527188..f7c473ab1 100644
|
|
|
081b2d |
--- a/ldap/servers/slapd/vattr.c
|
|
|
081b2d |
+++ b/ldap/servers/slapd/vattr.c
|
|
|
081b2d |
@@ -316,13 +316,19 @@ vattr_context_check(vattr_context *c)
|
|
|
081b2d |
static void
|
|
|
081b2d |
vattr_context_mark(vattr_context *c)
|
|
|
081b2d |
{
|
|
|
081b2d |
- c->vattr_context_loop_count += 1;
|
|
|
081b2d |
+ if (c) {
|
|
|
081b2d |
+ c->vattr_context_loop_count += 1;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
static int
|
|
|
081b2d |
vattr_context_unmark(vattr_context *c)
|
|
|
081b2d |
{
|
|
|
081b2d |
- return (c->vattr_context_loop_count -= 1);
|
|
|
081b2d |
+ if (c) {
|
|
|
081b2d |
+ return (c->vattr_context_loop_count -= 1);
|
|
|
081b2d |
+ } else {
|
|
|
081b2d |
+ return 0;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/* modify the context structure on exit from a vattr sp function */
|
|
|
081b2d |
@@ -385,13 +391,19 @@ vattr_context_grok(vattr_context **c)
|
|
|
081b2d |
static void
|
|
|
081b2d |
vattr_context_set_loop_msg_displayed(vattr_context **c)
|
|
|
081b2d |
{
|
|
|
081b2d |
- (*c)->error_displayed = 1;
|
|
|
081b2d |
+ if (c && *c){
|
|
|
081b2d |
+ (*c)->error_displayed = 1;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
static int
|
|
|
081b2d |
vattr_context_is_loop_msg_displayed(vattr_context **c)
|
|
|
081b2d |
{
|
|
|
081b2d |
- return (*c)->error_displayed;
|
|
|
081b2d |
+ if (c && *c){
|
|
|
081b2d |
+ return (*c)->error_displayed;
|
|
|
081b2d |
+ } else {
|
|
|
081b2d |
+ return 0;
|
|
|
081b2d |
+ }
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
/*
|
|
|
081b2d |
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
|
|
|
081b2d |
index 5bd318df4..95cc26148 100644
|
|
|
081b2d |
--- a/ldap/servers/snmp/main.c
|
|
|
081b2d |
+++ b/ldap/servers/snmp/main.c
|
|
|
081b2d |
@@ -21,6 +21,7 @@
|
|
|
081b2d |
#include "ldap.h"
|
|
|
081b2d |
#include "ldif.h"
|
|
|
081b2d |
#include <ctype.h>
|
|
|
081b2d |
+#include <limits.h>
|
|
|
081b2d |
#include <errno.h>
|
|
|
081b2d |
|
|
|
081b2d |
static char *agentx_master = NULL;
|
|
|
081b2d |
@@ -56,16 +57,22 @@ main(int argc, char *argv[])
|
|
|
081b2d |
char *s = getenv("DEBUG_SLEEP");
|
|
|
081b2d |
if ((s != NULL) && isdigit(*s)) {
|
|
|
081b2d |
char *endp = NULL;
|
|
|
081b2d |
- long secs;
|
|
|
081b2d |
+ int64_t secs;
|
|
|
081b2d |
errno = 0;
|
|
|
081b2d |
|
|
|
081b2d |
- printf("%s pid is %d\n", argv[0], getpid());
|
|
|
081b2d |
secs = strtol(s, &endp, 10);
|
|
|
081b2d |
- if (*endp != '\0' || errno == ERANGE) {
|
|
|
081b2d |
- sleep(10);
|
|
|
081b2d |
- } else {
|
|
|
081b2d |
- sleep(secs);
|
|
|
081b2d |
+ if ( endp == s ||
|
|
|
081b2d |
+ *endp != '\0' ||
|
|
|
081b2d |
+ ((secs == LONG_MIN || secs == LONG_MAX) && errno == ERANGE) ||
|
|
|
081b2d |
+ secs < 1 )
|
|
|
081b2d |
+ {
|
|
|
081b2d |
+ /* Invalid value, default to 30 seconds */
|
|
|
081b2d |
+ secs = 30;
|
|
|
081b2d |
+ } else if (secs > 3600) {
|
|
|
081b2d |
+ secs = 3600;
|
|
|
081b2d |
}
|
|
|
081b2d |
+ printf("%s pid is %d - sleeping for %ld\n", argv[0], getpid(), secs);
|
|
|
081b2d |
+ sleep(secs);
|
|
|
081b2d |
}
|
|
|
081b2d |
}
|
|
|
081b2d |
|
|
|
081b2d |
--
|
|
|
081b2d |
2.13.6
|
|
|
081b2d |
|