Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit a875da1d99f05e15e0ae7f1cd57049f35209044d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 18:10:19 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Description: Due to the changes made on NSPRIu64 and NSPRI64 along with
this fix:
> Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
> NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
casting PRInt64 to (long long int) in the log print is no longer needed.
Got rid of them.
Reviewed and advised by rmeggins(a)redhat.com (Thank you, Rich!!)
https://fedorahosted.org/389/ticket/48048
(cherry picked from commit 8f1eef1b53a88e5d42e3313eae5fe63b9a7dd99b)
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 944876c..1014a03 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2293,7 +2293,7 @@ log__open_accesslogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short*/);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_access_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -3906,7 +3906,7 @@ log__open_errorlogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_error_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -4033,7 +4033,7 @@ log__open_auditlogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_audit_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
8 years, 7 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 8f1eef1b53a88e5d42e3313eae5fe63b9a7dd99b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 18:10:19 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Description: Due to the changes made on NSPRIu64 and NSPRI64 along with
this fix:
> Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
> NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
casting PRInt64 to (long long int) in the log print is no longer needed.
Got rid of them.
Reviewed and advised by rmeggins(a)redhat.com (Thank you, Rich!!)
https://fedorahosted.org/389/ticket/48048
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 944876c..1014a03 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2293,7 +2293,7 @@ log__open_accesslogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short*/);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_access_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -3906,7 +3906,7 @@ log__open_errorlogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_error_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -4033,7 +4033,7 @@ log__open_auditlogfile(int logfile_state, int locked)
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_audit_file, tbuf,
- logp->l_ctime, (long long int)logp->l_size);
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
8 years, 7 months
Branch '389-ds-base-1.3.3' - 40 commits - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/acl/acl.c | 37 ++++++---
ldap/servers/plugins/acl/aclanom.c | 68 +++++++++---------
ldap/servers/plugins/acl/acllas.c | 29 +++----
ldap/servers/plugins/chainingdb/cb_bind.c | 6 +
ldap/servers/plugins/chainingdb/cb_compare.c | 7 +
ldap/servers/plugins/chainingdb/cb_delete.c | 5 +
ldap/servers/plugins/chainingdb/cb_modify.c | 4 +
ldap/servers/plugins/chainingdb/cb_modrdn.c | 5 +
ldap/servers/plugins/chainingdb/cb_search.c | 4 -
ldap/servers/plugins/chainingdb/cb_utils.c | 30 ++++---
ldap/servers/plugins/deref/deref.c | 2
ldap/servers/plugins/dna/dna.c | 40 +++++-----
ldap/servers/plugins/replication/cl5_clcache.c | 3
ldap/servers/plugins/replication/repl5_inc_protocol.c | 4 -
ldap/servers/plugins/replication/repl5_init.c | 2
ldap/servers/plugins/replication/repl5_plugins.c | 57 +++++++++------
ldap/servers/plugins/replication/repl5_replica.c | 22 +++--
ldap/servers/plugins/replication/repl5_total.c | 4 -
ldap/servers/plugins/replication/repl_connext.c | 20 ++---
ldap/servers/plugins/replication/repl_extop.c | 26 +++---
ldap/servers/plugins/replication/repl_ops.c | 15 ++-
ldap/servers/plugins/retrocl/retrocl_po.c | 6 +
ldap/servers/plugins/roles/roles_cache.c | 22 ++---
ldap/servers/plugins/sync/sync_persist.c | 12 ++-
ldap/servers/plugins/syntaxes/validate_task.c | 20 ++---
ldap/servers/plugins/usn/usn.c | 19 +++--
ldap/servers/slapd/abandon.c | 8 +-
ldap/servers/slapd/add.c | 4 -
ldap/servers/slapd/auth.c | 18 ++--
ldap/servers/slapd/back-ldbm/filterindex.c | 2
ldap/servers/slapd/back-ldbm/import-merge.c | 4 -
ldap/servers/slapd/back-ldbm/import-threads.c | 18 ++--
ldap/servers/slapd/back-ldbm/import.c | 11 +-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 10 +-
ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c | 7 +
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 4 -
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 4 -
ldap/servers/slapd/back-ldbm/ldbm_search.c | 29 ++++++-
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 2
ldap/servers/slapd/back-ldbm/matchrule.c | 10 +-
ldap/servers/slapd/back-ldbm/misc.c | 6 -
ldap/servers/slapd/back-ldbm/monitor.c | 10 +-
ldap/servers/slapd/bind.c | 8 +-
ldap/servers/slapd/compare.c | 2
ldap/servers/slapd/configdse.c | 3
ldap/servers/slapd/connection.c | 24 +++---
ldap/servers/slapd/conntable.c | 10 +-
ldap/servers/slapd/control.c | 2
ldap/servers/slapd/delete.c | 2
ldap/servers/slapd/extendop.c | 4 -
ldap/servers/slapd/filter.c | 24 ++++++
ldap/servers/slapd/mapping_tree.c | 12 ++-
ldap/servers/slapd/modify.c | 12 +--
ldap/servers/slapd/modrdn.c | 6 -
ldap/servers/slapd/monitor.c | 8 +-
ldap/servers/slapd/operation.c | 4 -
ldap/servers/slapd/opshared.c | 2
ldap/servers/slapd/psearch.c | 10 +-
ldap/servers/slapd/pw.c | 28 +++++--
ldap/servers/slapd/result.c | 10 +-
ldap/servers/slapd/sasl_io.c | 12 +--
ldap/servers/slapd/saslbind.c | 14 ++-
ldap/servers/slapd/schema.c | 8 ++
ldap/servers/slapd/search.c | 2
ldap/servers/slapd/slapi-plugin.h | 5 +
ldap/servers/slapd/snmp_collator.c | 2
ldap/servers/slapd/tools/dbscan.c | 2
ldap/servers/slapd/tools/ldclt/ldapfct.c | 6 -
ldap/servers/slapd/unbind.c | 6 -
69 files changed, 502 insertions(+), 342 deletions(-)
New commits:
commit 27c382fc9024abb524d8462ee61bf1cf6506e97c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 16:25:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Description: Due to the changes made on NSPRIu64 and NSPRI64 along with
this fix:
> Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
> NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
casting PRUint64 to (long long unsigned int) in the log print is no longer
needed. Got rid of them.
Reviewed and advised by rmeggins(a)redhat.com (Thank you, Rich!!)
https://fedorahosted.org/389/ticket/48048
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 25123cb..7da853b 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -979,7 +979,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_NEXTVAL,
- (long long unsigned int)entry->nextval);
+ entry->nextval);
value = slapi_entry_attr_get_charptr(e, DNA_PREFIX);
if (value && value[0]) {
@@ -1108,7 +1108,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_MAXVAL,
- (long long unsigned int)entry->maxval);
+ entry->maxval);
/* get the global bind dn and password(if any) */
value = slapi_entry_attr_get_charptr(e, DNA_REMOTE_BIND_DN);
@@ -1232,7 +1232,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_THRESHOLD,
- (long long unsigned int)entry->threshold);
+ entry->threshold);
value = slapi_entry_attr_get_charptr(e, DNA_RANGE_REQUEST_TIMEOUT);
if (value) {
@@ -1244,7 +1244,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_RANGE_REQUEST_TIMEOUT,
- (long long unsigned int)entry->timeout);
+ entry->timeout);
value = slapi_entry_attr_get_charptr(e, DNA_NEXT_RANGE);
if (value) {
@@ -2276,8 +2276,8 @@ dna_first_free_value(struct configEntry *config_entry,
filter = slapi_ch_smprintf("(&%s(&(%s>=%" NSPRIu64 ")(%s<=%" NSPRIu64 ")))",
config_entry->filter,
- config_entry->types[0], (long long unsigned int)tmpval,
- config_entry->types[0], (long long unsigned int)config_entry->maxval);
+ config_entry->types[0], tmpval,
+ config_entry->types[0], config_entry->maxval);
}
if (NULL == filter) {
@@ -2464,7 +2464,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
if ((config_entry->maxval == -1) ||
(nextval <= (config_entry->maxval + config_entry->interval))) {
/* try to set the new next value in the config entry */
- PR_snprintf(next_value, sizeof(next_value),"%" NSPRIu64, (long long unsigned int)nextval);
+ PR_snprintf(next_value, sizeof(next_value),"%" NSPRIu64, nextval);
/* set up our replace modify operation */
replace_val[0] = next_value;
@@ -2491,7 +2491,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
if (LDAP_SUCCESS == ret) {
slapi_ch_free_string(next_value_ret);
- *next_value_ret = slapi_ch_smprintf("%" NSPRIu64, (long long unsigned int)setval);
+ *next_value_ret = slapi_ch_smprintf("%" NSPRIu64, setval);
if (NULL == *next_value_ret) {
ret = LDAP_OPERATIONS_ERROR;
goto done;
@@ -2577,7 +2577,7 @@ dna_update_shared_config(struct configEntry *config_entry)
/* We store the number of remaining assigned values
* in the shared config entry. */
PR_snprintf(remaining_vals, sizeof(remaining_vals),"%" NSPRIu64,
- (long long unsigned int)config_entry->remaining);
+ config_entry->remaining);
/* set up our replace modify operation */
replace_val[0] = remaining_vals;
@@ -2677,7 +2677,7 @@ dna_update_next_range(struct configEntry *config_entry,
/* Try to set the new next range in the config entry. */
PR_snprintf(nextrange_value, sizeof(nextrange_value), "%" NSPRIu64 "-%" NSPRIu64,
- (long long unsigned int)lower, (long long unsigned int)upper);
+ lower, upper);
/* set up our replace modify operation */
replace_val[0] = nextrange_value;
@@ -2745,8 +2745,8 @@ dna_activate_next_range(struct configEntry *config_entry)
int ret = 0;
/* Setup the modify operation for the config entry */
- PR_snprintf(maxval_val, sizeof(maxval_val),"%" NSPRIu64, (long long unsigned int)config_entry->next_range_upper);
- PR_snprintf(nextval_val, sizeof(nextval_val),"%" NSPRIu64, (long long unsigned int)config_entry->next_range_lower);
+ PR_snprintf(maxval_val, sizeof(maxval_val),"%" NSPRIu64, config_entry->next_range_upper);
+ PR_snprintf(nextval_val, sizeof(nextval_val),"%" NSPRIu64, config_entry->next_range_lower);
maxval_vals[0] = maxval_val;
maxval_vals[1] = 0;
@@ -3489,8 +3489,8 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
"dna_pre_op: Passed threshold of %"
NSPRIu64 " remaining values "
"for range %s. (%" NSPRIu64 " values remain)\n",
- (long long unsigned int)config_entry->threshold, config_entry->dn,
- (long long unsigned int)config_entry->remaining);
+ config_entry->threshold, config_entry->dn,
+ config_entry->remaining);
dna_fix_maxval(config_entry, 0);
}
@@ -3761,8 +3761,8 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods, char **e
"dna_pre_op: Passed threshold of %"
NSPRIu64 " remaining values "
"for range %s. (%" NSPRIu64 " values remain)\n",
- (long long unsigned int)config_entry->threshold, config_entry->dn,
- (long long unsigned int)config_entry->remaining);
+ config_entry->threshold, config_entry->dn,
+ config_entry->remaining);
dna_fix_maxval(config_entry, 0);
}
@@ -4335,8 +4335,8 @@ static int dna_extend_exop(Slapi_PBlock *pb)
char highstr[16];
/* Create the exop response */
- PR_snprintf(lowstr, sizeof(lowstr), "%" NSPRIu64, (long long unsigned int)lower);
- PR_snprintf(highstr, sizeof(highstr), "%" NSPRIu64, (long long unsigned int)upper);
+ PR_snprintf(lowstr, sizeof(lowstr), "%" NSPRIu64, lower);
+ PR_snprintf(highstr, sizeof(highstr), "%" NSPRIu64, upper);
range_low.bv_val = lowstr;
range_low.bv_len = strlen(range_low.bv_val);
range_high.bv_val = highstr;
@@ -4370,7 +4370,7 @@ static int dna_extend_exop(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_PLUGIN, DNA_PLUGIN_SUBSYSTEM,
"dna_extend_exop: Released range %" NSPRIu64 "-%" NSPRIu64 ".\n",
- (long long unsigned int)lower, (long long unsigned int)upper);
+ lower, upper);
}
free_and_return:
@@ -4511,7 +4511,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
*lower = *upper - release + 1;
/* try to set the new maxval in the config entry */
- PR_snprintf(max_value, sizeof(max_value),"%" NSPRIu64, (long long unsigned int)(*lower - 1));
+ PR_snprintf(max_value, sizeof(max_value),"%" NSPRIu64, (*lower - 1));
/* set up our replace modify operation */
replace_val[0] = max_value;
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 5cf170c..f18fde5 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -1982,8 +1982,8 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
/* Isn't listening. Do something drastic. */
return_value = -1;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "%s: repl5_inc_stop: protocol does not stop after %llu seconds\n",
- agmt_get_long_name(prp->agmt), (long long unsigned int)timeout);
+ "%s: repl5_inc_stop: protocol does not stop after %" NSPRIu64 " seconds\n",
+ agmt_get_long_name(prp->agmt), timeout);
}
else
{
diff --git a/ldap/servers/plugins/replication/repl5_init.c b/ldap/servers/plugins/replication/repl5_init.c
index 56f01a1..8e2f114 100644
--- a/ldap/servers/plugins/replication/repl5_init.c
+++ b/ldap/servers/plugins/replication/repl5_init.c
@@ -227,7 +227,7 @@ get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
if (opid) {
slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" NSPRIu64 " op=%d",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
slapi_pblock_get ( pb, SLAPI_OPERATION, &op );
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 61ae7ec..c184178 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -474,7 +474,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica in use locking_purl=%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root),
r->locking_purl ? r->locking_purl : "unknown");
rval = PR_FALSE;
@@ -487,7 +487,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Acquired replica\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root));
r->repl_state_flags |= REPLICA_IN_USE;
if (isInc && *isInc)
@@ -528,13 +528,13 @@ replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica not in use\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root));
} else {
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Released replica held by locking_purl=%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root),
r->locking_purl);
@@ -3411,7 +3411,6 @@ abort_csn_callback(const CSN *csn, void *data)
Replica *r = (Replica *)data;
Object *ruv_obj;
RUV *ruv;
- int rc;
PR_ASSERT(NULL != csn);
PR_ASSERT(NULL != data);
@@ -3423,11 +3422,14 @@ abort_csn_callback(const CSN *csn, void *data)
replica_lock(r->repl_lock);
- if (NULL != r->min_csn_pl)
- {
- rc = csnplRemove(r->min_csn_pl, csn);
- PR_ASSERT(rc == 0);
- }
+ if (NULL != r->min_csn_pl)
+ {
+ int rc = csnplRemove(r->min_csn_pl, csn);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "csnplRemove failed");
+ return;
+ }
+ }
ruv_cancel_csn_inprogress (ruv, csn);
replica_unlock(r->repl_lock);
diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c
index 45cdbae..f22246d 100644
--- a/ldap/servers/plugins/replication/repl5_total.c
+++ b/ldap/servers/plugins/replication/repl5_total.c
@@ -882,7 +882,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not import entry dn %s "
"for total update operation conn=%" NSPRIu64 " op=%d\n",
- rc, dn, (long long unsigned int)connid, opid);
+ rc, dn, connid, opid);
rc = -1;
}
@@ -892,7 +892,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not decode the total update extop "
"for total update operation conn=%" NSPRIu64 " op=%d\n",
- rc, (long long unsigned int)connid, opid);
+ rc, connid, opid);
}
if (rc != 0)
diff --git a/ldap/servers/plugins/replication/repl_connext.c b/ldap/servers/plugins/replication/repl_connext.c
index a591898..9da2cbb 100644
--- a/ldap/servers/plugins/replication/repl_connext.c
+++ b/ldap/servers/plugins/replication/repl_connext.c
@@ -111,7 +111,7 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Aborting total update in progress for replicated "
"area %s connid=%" NSPRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn),
- (long long unsigned int)connid);
+ connid);
slapi_stop_bulk_import(pb);
}
else
@@ -183,20 +183,20 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
ret = connext;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Acquired consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
else if (opid == connext->in_use_opid)
{
ret = connext;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Reacquired consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
else
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not acquire consumer connection extension; it is in use by op=%d\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
}
/* step 5, drop the lock */
@@ -206,7 +206,7 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not acquire consumer extension, it is NULL!\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
return ret;
@@ -244,7 +244,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Consumer connection extension is not in use\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
ret = 2;
}
else if (opid == connext->in_use_opid)
@@ -252,7 +252,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
/* step 4, relinquish it (normal) */
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Relinquishing consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
connext->in_use_opid = -1;
ret = 1;
}
@@ -261,7 +261,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
/* step 4, relinquish it (forced) */
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Forced to relinquish consumer connection extension held by op=%d\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
connext->in_use_opid = -1;
ret = 1;
}
@@ -269,7 +269,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Not relinquishing consumer connection extension, it is held by op=%d!\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
}
/* step 5, drop the lock */
@@ -279,7 +279,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not relinquish consumer extension, it is NULL!\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
return ret;
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 4fefe9f..583d2cc 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -697,7 +697,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_TRUE;
}
else if (strcmp(protocol_oid, REPL_NSDS50_TOTAL_PROTOCOL_OID) == 0)
@@ -723,7 +723,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_FALSE;
}
else if (strcmp(protocol_oid, REPL_NSDS71_INCREMENTAL_PROTOCOL_OID) == 0)
@@ -732,7 +732,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_TRUE;
}
else if (strcmp(protocol_oid, REPL_NSDS71_TOTAL_PROTOCOL_OID) == 0)
@@ -744,7 +744,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_FALSE;
}
else
@@ -767,7 +767,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d replica=\"%s\": "
"Replica is being configured: try again later\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
response = NSDS50_REPL_REPLICA_BUSY;
goto send_response;
}
@@ -838,7 +838,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Excessive clock skew from supplier RUV\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
goto send_response;
}
@@ -875,7 +875,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica has same replicaID %d as supplier\n",
- (long long unsigned int)connid, opid, repl_root, replica_get_rid(replica));
+ connid, opid, repl_root, replica_get_rid(replica));
response = NSDS50_REPL_REPLICAID_ERROR;
goto send_response;
}
@@ -887,7 +887,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
*/
/* junkrc = ruv_get_first_id_and_purl(supplier_ruv, &junkrid, &locking_purl); */
PR_snprintf(locking_session, sizeof(locking_session), "conn=%" NSPRIu64 " id=%d",
- (long long unsigned int)connid, opid);
+ connid, opid);
locking_purl = &locking_session[0];
if (replica_get_exclusive_access(replica, &isInc, connid, opid,
locking_purl,
@@ -914,7 +914,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"374 - Starting sleep: connext->repl_protocol_version == %d\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
while (REPL_PROTOCOL_50_INCREMENTAL == connext->repl_protocol_version && i++ < max) {
usleep(200000);
@@ -923,7 +923,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"374 - Finished sleep: connext->repl_protocol_version == %d\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
}
#endif
@@ -1018,7 +1018,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Unexpected update protocol received: %d. "
"Expected incremental or total.\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
goto send_response;
}
@@ -1057,7 +1057,7 @@ send_response:
slapi_log_error (resp_log_level, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d replica=\"%s\": "
"Unable to acquire replica: error: %s%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
(replica ? slapi_sdn_get_dn(replica_get_root(replica)) : "unknown"),
protocol_response2string (response), purlstr);
@@ -1109,7 +1109,7 @@ send_response:
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"%s: response=%d rc=%d\n",
- (long long unsigned int)connid, opid, repl_root,
+ connid, opid, repl_root,
is90 ? "StartNSDS90ReplicationRequest" :
"StartNSDS50ReplicationRequest", response, rc);
slapi_send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
index 4bd7da8..53b2d13 100644
--- a/ldap/servers/plugins/sync/sync_persist.c
+++ b/ldap/servers/plugins/sync/sync_persist.c
@@ -578,14 +578,14 @@ sync_send_results( void *arg )
if (NULL == conn) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
return;
}
conn_acq_flag = sync_acquire_connection (conn);
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
return;
}
@@ -596,7 +596,7 @@ sync_send_results( void *arg )
if ( op == NULL || slapi_is_operation_abandoned( op ) ) {
slapi_log_error(SLAPI_LOG_PLUGIN, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Operation no longer active - terminating\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
break;
}
if ( NULL == req->ps_eq_head || !req->req_active) {
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
index 9f9a143..d730dc7 100644
--- a/ldap/servers/plugins/syntaxes/validate_task.c
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
@@ -231,12 +231,12 @@ syntax_validate_task_thread(void *arg)
/* Log finished message. */
slapi_task_log_notice(task, "Syntax validate task complete. Found %" NSPRIu64
- " invalid entries.\n", (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ " invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
slapi_task_log_status(task, "Syntax validate task complete. Found %" NSPRIu64
- " invalid entries.\n", (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ " invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
slapi_log_error(SLAPI_LOG_FATAL, SYNTAX_PLUGIN_SUBSYSTEM, "Syntax validate task complete."
" Found %" NSPRIu64 " invalid entries.\n",
- (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ slapi_counter_get_value(td->invalid_entries));
slapi_task_inc_progress(task);
/* this will queue the destruction of the task */
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 55ab5f7..7a12abe 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -350,7 +350,7 @@ _usn_add_next_usn(Slapi_Entry *e, Slapi_Backend *be)
/* add next USN to the entry; "be" contains the usn counter */
usn_berval.bv_val = slapi_ch_smprintf("%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
usn_berval.bv_len = strlen(usn_berval.bv_val);
slapi_entry_attr_find(e, SLAPI_ATTR_ENTRYUSN, &attr);
if (NULL == attr) { /* ENTRYUSN does not exist; add it */
@@ -390,7 +390,7 @@ _usn_mod_next_usn(LDAPMod ***mods, Slapi_Backend *be)
/* add next USN to the mods; "be" contains the usn counter */
usn_berval.bv_val = counter_buf;
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
usn_berval.bv_len = strlen(usn_berval.bv_val);
bvals[0] = &usn_berval;
bvals[1] = NULL;
@@ -528,7 +528,7 @@ usn_bepostop (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -566,7 +566,7 @@ usn_bepostop_modify (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -617,7 +617,7 @@ usn_bepostop_delete (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -711,7 +711,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
* then minus 1 from it (except if be_usn_counter has value 0) */
if (slapi_counter_get_value(be->be_usn_counter)) {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter)-1);
+ slapi_counter_get_value(be->be_usn_counter)-1);
} else {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
}
@@ -734,7 +734,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
* then minus 1 from it (except if be_usn_counter has value 0) */
if (slapi_counter_get_value(be->be_usn_counter)) {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter)-1);
+ slapi_counter_get_value(be->be_usn_counter)-1);
} else {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
}
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 6b4bbf2..43158a8 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/ldap/servers/slapd/abandon.c
@@ -155,19 +155,19 @@ do_abandon( Slapi_PBlock *pb )
if ( 0 == pagedresults_free_one_msgid_nolock(pb->pb_conn, id) ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64
" op=%d ABANDON targetop=Simple Paged Results\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid );
} else if ( NULL == o ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=NOTFOUND msgid=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else if ( suppressed_by_plugin ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=%d msgid=%d nentries=%d etime=%ld\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
o->o_results.r.r_search.nentries, current_time() - o->o_time );
}
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 243ef63..12b97e8 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -201,7 +201,7 @@ do_add( Slapi_PBlock *pb )
!= LDAP_SUCCESS ) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
slapi_entry_get_dn_const(e), normtype );
send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
@@ -487,7 +487,7 @@ static void op_shared_add (Slapi_PBlock *pb)
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ADD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
operation->o_opid,
slapi_entry_get_dn_const(e),
proxystr ? proxystr : "");
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 0219576..ae4af50 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -403,7 +403,7 @@ handle_bad_certificate (void* clientData, PRFileDesc *prfd)
char* issuer = issuer_of (clientCert);
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL" );
if (issuer) free (issuer);
@@ -440,7 +440,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " SSL failed to obtain channel info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
goto done;
}
if ( (slapd_ssl_getCipherSuiteInfo (channelInfo.cipherSuite, &cipherInfo, sizeof(cipherInfo)) )
@@ -449,7 +449,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " SSL failed to obtain cipher info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
goto done;
}
@@ -469,14 +469,14 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL" );
goto done;
}
if (clientCert == NULL) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL" );
} else {
subject = subject_of (clientCert);
@@ -485,7 +485,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s %i-bit %s; missing subject\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL");
goto done;
}
@@ -496,7 +496,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s %i-bit %s; client %s; issuer %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL",
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL");
@@ -540,7 +540,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s client bound as %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, clientDN);
} else if (clientCert != NULL) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
@@ -548,7 +548,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s failed to map client "
"certificate to LDAP DN (%s)\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, extraErrorMsg);
}
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index fdc87c0..6ad1c48 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -4031,7 +4031,7 @@ _get_import_entryusn(ImportJob *job, Slapi_Value **usn_value)
* next entryusn. */
PR_snprintf(counter_buf, USN_COUNTER_BUF_LEN,
"%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
} else {
/* import_init value is digit.
* Initialize the entryusn values with the digit */
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 3de8efa..498c3c1 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -136,7 +136,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
if ((NULL == addr) || (NULL == sdnp))
@@ -1500,7 +1500,7 @@ diskfull_return:
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
return rc;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 6a4982c..f5a404b 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -171,7 +171,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
inst = (ldbm_instance *) be->be_instance_info;
@@ -1563,7 +1563,7 @@ common_return:
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
return retval;
}
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index d344e3c..19c7593 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -83,8 +83,8 @@ void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
return;
}
operation_id = operation->o_opid;
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
- (long long unsigned int)connection_id, operation_id, string);
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
+ connection_id, operation_id, string);
}
int return_on_disk_full(struct ldbminfo *li)
@@ -443,7 +443,7 @@ ldbm_txn_ruv_modify_context( Slapi_PBlock *pb, modify_context *mc )
bentry = find_entry2modify_only( pb, be, &bentry_addr, &txn );
if (NULL == bentry) {
- /* Uh oh, we couldn't find and lock the RUV entry! */
+ /* Uh oh, we couldn't find and lock the RUV entry! */
LDAPDebug( LDAP_DEBUG_ANY, "Error: ldbm_txn_ruv_modify_context failed to retrieve and lock RUV entry\n",
0, 0, 0 );
rc = -1;
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c
index 409c771..469778d 100644
--- a/ldap/servers/slapd/back-ldbm/monitor.c
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
@@ -130,9 +130,9 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
/* fetch cache statistics */
cache_get_stats(&(inst->inst_dncache), &hits, &tries,
&nentries, &maxentries, &size, &maxsize);
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)hits);
+ sprintf(buf, "%" NSPRIu64, hits);
MSET("dnCacheHits");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)tries);
+ sprintf(buf, "%" NSPRIu64, tries);
MSET("dnCacheTries");
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
MSET("dnCacheHitRatio");
@@ -148,11 +148,11 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
/* normalized dn cache stats */
if(ndn_cache_started()){
ndn_cache_get_stats(&hits, &tries, &size, &maxsize, &count);
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)tries);
+ sprintf(buf, "%" NSPRIu64, tries);
MSET("normalizedDnCacheTries");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)hits);
+ sprintf(buf, "%" NSPRIu64, hits);
MSET("normalizedDnCacheHits");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)(tries - hits));
+ sprintf(buf, "%" NSPRIu64, (tries - hits));
MSET("normalizedDnCacheMisses");
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
MSET("normalizedDnCacheHitRatio");
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 7acec84..70d2d19 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -899,25 +899,25 @@ log_bind_access (
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
version, saslmech, msg );
} else if (method == LDAP_AUTH_SASL && saslmech) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
version, saslmech );
} else if (msg) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=%ld version=%d, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version, msg );
} else {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=%ld version=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version );
}
}
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 873d07f..5fb1d2f 100644
--- a/ldap/servers/slapd/compare.c
+++ b/ldap/servers/slapd/compare.c
@@ -144,7 +144,7 @@ do_compare( Slapi_PBlock *pb )
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, ava.ava_type );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, ava.ava_type );
/*
* We could be serving multiple database backends. Select the
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 529a3b1..9f0d9dc 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -448,7 +448,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
/* log useful stuff to our access log */
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
+ conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
/* initialize the remaining connection fields */
conn->c_ldapversion = LDAP_VERSION3;
@@ -548,7 +548,7 @@ connection_need_new_password(const Connection *conn, const Operation *op, Slapi_
{
slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
"UNPROCESSED OPERATION - need new password" );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM,
NULL, NULL, 0, NULL );
@@ -592,7 +592,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
" - Insufficient SSF (local_ssf=%d sasl_ssf=%d ssl_ssf=%d)\n",
- (long long unsigned int)conn->c_connid, op->o_opid, conn->c_local_ssf,
+ conn->c_connid, op->o_opid, conn->c_local_ssf,
conn->c_sasl_ssf, conn->c_ssl_ssf );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
"Minimum SSF not met.", 0, NULL );
@@ -620,7 +620,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
" - Anonymous access not allowed\n",
- (long long unsigned int)conn->c_connid, op->o_opid );
+ conn->c_connid, op->o_opid );
send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
"Anonymous access is not allowed.",
@@ -676,7 +676,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
int i = 1;
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",(long long unsigned int)conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
}
pop_cork = 1;
}
@@ -689,7 +689,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
int i = 0;
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",(long long unsigned int)conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
}
}
#endif
@@ -728,7 +728,7 @@ int connection_release_nolock (Connection *conn)
{
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
PR_ASSERT (PR_FALSE);
return -1;
}
@@ -749,7 +749,7 @@ int connection_acquire_nolock (Connection *conn)
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
return -1;
}
else
@@ -2966,13 +2966,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable"
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, maxbersize );
+ conn->c_connid, conn->c_sd, maxbersize );
} else {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was %" BERLEN_T " bytes, max allowable"
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, ber_len, maxbersize );
+ conn->c_connid, conn->c_sd, ber_len, maxbersize );
}
}
@@ -3023,13 +3023,13 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
if (error && (EPIPE != error) ) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
- (long long unsigned int)conn->c_connid, opid, conn->c_sd, error,
+ conn->c_connid, opid, conn->c_sd, error,
slapd_system_strerror(error),
slapd_pr_strerror(reason));
} else {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
- (long long unsigned int)conn->c_connid, opid, conn->c_sd,
+ conn->c_connid, opid, conn->c_sd,
slapd_pr_strerror(reason));
}
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index f1643ca..5225e11 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -440,8 +440,8 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
* by max threads.
*/
PR_snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%"NSPRIu64":%"NSPRIu64"",
- maxthreadstate, (long long unsigned int)ct->c[i].c_maxthreadscount,
- (long long unsigned int)ct->c[i].c_maxthreadsblocked);
+ maxthreadstate, ct->c[i].c_maxthreadscount,
+ ct->c[i].c_maxthreadsblocked);
if ((lendn + strlen(maxthreadbuf)) > (BUFSIZ - 46)) {
/*
@@ -475,17 +475,17 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnections", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(num_conns));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(num_conns));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "totalconnections", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(conns_in_maxthreads));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(conns_in_maxthreads));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnectionsatmaxthreads", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(max_threads_count));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(max_threads_count));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "maxthreadsperconnhits", vals );
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
index d97aa2f..02b88c1 100644
--- a/ldap/servers/slapd/control.c
+++ b/ldap/servers/slapd/control.c
@@ -367,7 +367,7 @@ get_ldapmessage_controls_ext(
slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
slapi_log_error(SLAPI_LOG_CONNS, "connection", "Warning: conn=%" NSPRIu64 " op=%d contains an empty list of controls\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid);
+ pb->pb_conn->c_connid, pb->pb_op->o_opid);
} else {
if ((tag != LBER_END_OF_SEQORSET) && (len != -1)) {
goto free_and_return;
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index b7fe02b..6d1a45b 100644
--- a/ldap/servers/slapd/delete.c
+++ b/ldap/servers/slapd/delete.c
@@ -294,7 +294,7 @@ static void op_shared_delete (Slapi_PBlock *pb)
if (!internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d DEL dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(sdn),
proxystr ? proxystr: "");
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index 4710c98..e5a4fcb 100644
--- a/ldap/servers/slapd/extendop.c
+++ b/ldap/servers/slapd/extendop.c
@@ -282,14 +282,14 @@ do_extended( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s)\n", extoid, 0, 0 );
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d EXT oid=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
} else {
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
extoid, name, 0 );
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
}
/* during a bulk import, only BULK_IMPORT_DONE is allowed!
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index fb0fdde..9b2f42d 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -713,7 +713,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(sdn),
proxystr ? proxystr : "");
@@ -1245,7 +1245,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn));
}
@@ -1285,7 +1285,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
}
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn), proxystr ? proxystr : "");
}
@@ -1326,7 +1326,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
}
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
"user is not allowed to change password");
@@ -1352,7 +1352,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
@@ -1395,7 +1395,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 8e7aff7..b4658c3 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -493,7 +493,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
{
slapi_log_access(LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
dn,
newrdn ? newrdn : "(null)",
@@ -527,7 +527,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
if ( !internal_op ) {
slapi_log_error(SLAPI_LOG_ARGS, NULL,
"conn=%" NSPRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newrdn) ? "(null)" : newrdn);
} else {
@@ -560,7 +560,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
if (!internal_op) {
slapi_log_error(SLAPI_LOG_ARGS, NULL,
"conn=%" NSPRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
newsuperior ? newsuperior : "(null)");
} else {
diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c
index 5b8147a..2c15c39 100644
--- a/ldap/servers/slapd/monitor.c
+++ b/ldap/servers/slapd/monitor.c
@@ -91,19 +91,19 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
connection_table_as_entry(the_connection_table, e);
- val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(ops_initiated) );
+ val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_initiated) );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "opsinitiated", vals );
- val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(ops_completed) );
+ val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_completed) );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "opscompleted", vals );
- val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)g_get_num_entries_sent() );
+ val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_entries_sent() );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "entriessent", vals );
- val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)g_get_num_bytes_sent() );
+ val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_bytes_sent() );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "bytessent", vals );
diff --git a/ldap/servers/slapd/operation.c b/ldap/servers/slapd/operation.c
index 69f0069..f27c673 100644
--- a/ldap/servers/slapd/operation.c
+++ b/ldap/servers/slapd/operation.c
@@ -609,7 +609,7 @@ int slapi_connection_acquire(Slapi_Connection *conn)
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
rc = -1;
}
else
@@ -647,7 +647,7 @@ slapi_connection_remove_operation( Slapi_PBlock *pb, Slapi_Connection *conn, Sla
if (conn->c_refcnt <= 0) {
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
rc = -1;
} else {
conn->c_refcnt--;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index c8a5f8c..84a2bb4 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -1740,7 +1740,7 @@ void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char
}
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s dn=\"%s\"%s, %s\n",
- ( pb->pb_conn ? (long long unsigned int)pb->pb_conn->c_connid : 0),
+ ( pb->pb_conn ? pb->pb_conn->c_connid : 0),
( pb->pb_op ? pb->pb_op->o_opid : 0),
type,
dn,
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
index b059a36..25a562a 100644
--- a/ldap/servers/slapd/psearch.c
+++ b/ldap/servers/slapd/psearch.c
@@ -313,7 +313,7 @@ ps_send_results( void *arg )
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
}
PR_Lock( psearch_list->pl_cvarlock );
@@ -323,7 +323,7 @@ ps_send_results( void *arg )
if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d The operation has been abandoned\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
break;
}
if ( NULL == ps->ps_eq_head ) {
@@ -381,7 +381,7 @@ ps_send_results( void *arg )
if (rc) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Error %d sending entry %s with op status %d\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
}
}
@@ -430,7 +430,7 @@ ps_send_results( void *arg )
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Releasing the connection and operation\n",
- (long long unsigned int)conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ conn->c_connid, ps->ps_pblock->pb_op->o_opid);
/* Delete this op from the connection's list */
connection_remove_operation_ext( ps->ps_pblock, conn, ps->ps_pblock->pb_op );
@@ -566,7 +566,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d entry %s with chgtype %d "
"matches the ps changetype %d\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid,
+ ps->ps_pblock->pb_conn->c_connid,
ps->ps_pblock->pb_op->o_opid,
edn, chgtype, ps->ps_changetypes);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 45a5b4c..d5984df 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2002,7 +2002,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
", SASL bind in progress\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2034,7 +2034,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
" dn=\"%s\"\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2059,7 +2059,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2123,7 +2123,7 @@ log_entry( Operation *op, Slapi_Entry *e )
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d ENTRY dn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ op->o_connid, op->o_opid,
slapi_entry_get_dn_const(e));
}
else
@@ -2148,7 +2148,7 @@ log_referral( Operation *op )
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d REFERRAL\n",
- (long long unsigned int)op->o_connid, op->o_opid );
+ op->o_connid, op->o_opid );
}
else
{
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index 3fe9057..b522d3d 100644
--- a/ldap/servers/slapd/sasl_io.c
+++ b/ldap/servers/slapd/sasl_io.c
@@ -281,7 +281,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
ber_tag_t tag = 0;
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
- "Sent an LDAP message that was not encrypted.\n", (long long unsigned int)c->c_connid,
+ "Sent an LDAP message that was not encrypted.\n", c->c_connid,
c->c_sd);
/* Build a berval so we can get the length before reading in the entire packet */
@@ -297,7 +297,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable "
"is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in "
"cn=config to increase.\n",
- (long long unsigned int)c->c_connid, c->c_sd, maxbersize );
+ c->c_connid, c->c_sd, maxbersize );
PR_SetError(PR_IO_ERROR, 0);
return PR_FAILURE;
}
@@ -388,7 +388,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
if (*ber->ber_ptr == LDAP_REQ_UNBIND){
#endif
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
- "Received unencrypted UNBIND operation.\n", (long long unsigned int)c->c_connid,
+ "Received unencrypted UNBIND operation.\n", c->c_connid,
c->c_sd);
sp->encrypted_buffer_count = sp->encrypted_buffer_offset;
sp->encrypted_buffer_offset = 0;
@@ -398,9 +398,9 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
"Error: received an LDAP message (tag 0x%lx) that was not encrypted.\n",
#ifdef USE_OPENLDAP
- (long long unsigned int)c->c_connid, c->c_sd, (long unsigned int)tag);
+ c->c_connid, c->c_sd, (long unsigned int)tag);
#else
- (long long unsigned int)c->c_connid, c->c_sd, (long unsigned int)*ber->ber_ptr);
+ c->c_connid, c->c_sd, (long unsigned int)*ber->ber_ptr);
#endif
}
}
@@ -409,7 +409,7 @@ done:
/* If we got here we have garbage, or a denied LDAP operation */
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
"Error: received an invalid message that was not encrypted.\n",
- (long long unsigned int)c->c_connid, c->c_sd);
+ c->c_connid, c->c_sd);
if (NULL != ber){
ber_free(ber, 1);
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 85b62cb..3ec9cd8 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -858,7 +858,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
slapi_log_error(SLAPI_LOG_CONNS, "ids_sasl_check_bind",
"cleaning up sasl IO conn=%" NSPRIu64 " op=%d complete=%d continuing=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
(pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE), continuing);
/* reset flag */
pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_COMPLETE;
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index 5cdef9c..d591c1b 100644
--- a/ldap/servers/slapd/search.c
+++ b/ldap/servers/slapd/search.c
@@ -410,7 +410,7 @@ static void log_search_access (Slapi_PBlock *pb, const char *base, int scope, co
{
slapi_log_access(LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
base, scope, fstr, msg ? msg : "");
}
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index f33202d..80fbfb1 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -794,7 +794,7 @@ static void
add_counter_to_value(Slapi_Entry *e, const char *type, PRUint64 countervalue)
{
char value[40];
- PR_snprintf(value,sizeof(value),"%" NSPRIu64, (long long unsigned int)countervalue);
+ PR_snprintf(value,sizeof(value),"%" NSPRIu64, countervalue);
slapi_entry_attr_set_charptr( e, type, value);
}
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index 1b76609..8cedeec 100644
--- a/ldap/servers/slapd/unbind.c
+++ b/ldap/servers/slapd/unbind.c
@@ -82,7 +82,7 @@ do_unbind( Slapi_PBlock *pb )
if ( ber_get_null( ber ) == LBER_ERROR ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
" decoding error: UnBindRequest not null\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid );
+ pb->pb_conn->c_connid, operation->o_opid );
/* LDAPv3 does not allow a response to an unbind... so just return. */
goto free_and_return;
}
@@ -97,7 +97,7 @@ do_unbind( Slapi_PBlock *pb )
if ( (err = get_ldapmessage_controls_ext( pb, ber, NULL, ignore_criticality )) != 0 ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
" error processing controls - error %d (%s)\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
err, ldap_err2string( err ));
/* LDAPv3 does not allow a response to an unbind... so just return. */
goto free_and_return;
@@ -111,7 +111,7 @@ do_unbind( Slapi_PBlock *pb )
/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid );
+ pb->pb_conn->c_connid, operation->o_opid );
/* pass the unbind to all backends */
be_unbindall( pb->pb_conn, operation );
commit cc5aba3f2628947502b7e76a52d6d1e24aaf0bf2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:28:43 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13030 - Logical vs. bitwise operator
Description: As coverity pointed out, meant to be '&' not '&&'.
modified: format_raw in dbscan.c
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index 023fade..b3d9f14 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -246,7 +246,7 @@ static char *format_raw(unsigned char *s, int len, int flags,
if ((flags & FMT_LF_OK) && (*p == '\n')) {
*o++ = '\n';
*o++ = '\t';
- } else if ((flags && FMT_SP_OK) && (*p == ' ')) {
+ } else if ((flags & FMT_SP_OK) && (*p == ' ')) {
*o++ = ' ';
} else {
*o++ = '%';
commit c1190b4b63eb4e360f991e59dfe49212308acbb5
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:22:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13031 - Logically dead code
Description: load_plugin_entry is not allowed to return failure.
If failed, the server does not run.
modified: load_plugin_entry in configdse.c
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index e70e340..5f26e6b 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -369,8 +369,7 @@ load_plugin_entry(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *r
}
*returncode = retval;
- return (retval == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK
- : SLAPI_DSE_CALLBACK_ERROR;
+ return SLAPI_DSE_CALLBACK_OK;
}
int
commit 67024620d55223728ab50dfc8592e4a9b4eafdc2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:14:24 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13032 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13033 - Explicit null dereferenced (FORWARD_NULL)
4overity defect 13034 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for operation and e.
modified: pw_send_ldap_result, update_pw_info, and check_pw_syntax_ext in pw.c
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index c781adc..b5a75d9 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -99,6 +99,10 @@ pw_send_ldap_result(
Slapi_Operation *operation = NULL;
slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "pw_send_ldap_result: no operation\n");
+ return;
+ }
internal_op= operation_is_flag_set(operation, OP_FLAG_INTERNAL);
if (internal_op) {
@@ -203,7 +207,7 @@ char* slapi_encode_ext (Slapi_PBlock *pb, const Slapi_DN *sdn, char *value, char
if (pws_enc == NULL)
{
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: no server scheme\n" );
return NULL;
}
@@ -215,12 +219,12 @@ char* slapi_encode_ext (Slapi_PBlock *pb, const Slapi_DN *sdn, char *value, char
{
char * scheme_list = plugin_get_pwd_storage_scheme_list(PLUGIN_LIST_PWD_STORAGE_SCHEME);
if ( scheme_list != NULL ) {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: invalid scheme - %s\n"
"Valid values are: %s\n", alg, scheme_list );
slapi_ch_free((void **)&scheme_list);
} else {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: invalid scheme - %s\n"
"no pwdstorage scheme plugin loaded", alg);
}
@@ -632,6 +636,10 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw)
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
slapi_pblock_get( pb, SLAPI_REQUESTOR_NDN, &bind_dn);
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &e);
+ if (NULL == e) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "update_pw_info: no password entry \n");
+ return -1;
+ }
internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
target_dn = slapi_sdn_get_ndn(sdn);
pwpolicy = new_passwdPolicy(pb, target_dn);
@@ -834,7 +842,7 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
return 0;
}
if (NULL == vals) {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"check_pw_syntax_ext: no passwords to check\n" );
return -1;
}
@@ -844,6 +852,10 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replication);
slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "check_pw_syntax_ext: no operation\n");
+ return -1;
+ }
internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
/*
@@ -2527,9 +2539,9 @@ pw_entry_constructor(void *object, void *parent)
struct slapi_pw_entry_ext *pw_extp = NULL;
Slapi_RWLock *rwlock;
if ((rwlock = slapi_new_rwlock()) == NULL) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"pw_entry_constructor: slapi_new_rwlock() failed\n");
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"WARNING: the server cannot handle unhashed password.\n");
return NULL;
}
@@ -2569,7 +2581,7 @@ pw_exp_init ( void )
pw_entry_destructor,
&pw_entry_objtype,
&pw_entry_handle) != 0) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"pw_init: slapi_register_object_extension failed; "
"unhashed password is not able to access\n");
}
@@ -2585,7 +2597,7 @@ slapi_pw_get_entry_ext(Slapi_Entry *entry, Slapi_Value ***vals)
struct slapi_pw_entry_ext *extp = NULL;
if (NULL == vals) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_pw_get_entry_ext: output param vals is NULL.\n");
return LDAP_PARAM_ERROR;
}
commit 20ef9c95e8f4bd4f8adecc2d36b463cf35f3a180
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:45:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13035 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: usn_preop_delete in usn.c
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 6b34bf4..55ab5f7 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -321,6 +321,11 @@ usn_preop_delete(Slapi_PBlock *pb)
"--> usn_preop_delete\n");
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,
+ "<-- usn_preop_delete failed; no operation.\n");
+ return SLAPI_PLUGIN_FAILURE;
+ }
slapi_operation_set_replica_attr_handler(op, (void *)usn_get_attr);
slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
commit 8c84bdf0c9e337d22fd42779e12bef38c24ccde1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:38:50 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13036 - Explicit null dereferenced (FORWARD_NULL)
Description: Modified slapi_filter_join_ex to accept NULL filter.
modified: slapi_filter_join_ex in ldap/servers/slapd/filter.c
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 5fd0347..5bebefe 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -856,6 +856,30 @@ slapi_filter_join_ex( int ftype, struct slapi_filter *f1, struct slapi_filter *f
struct slapi_filter *return_this;
int insert = 0;
+ if ((NULL == f1) || (NULL == f2)) {
+ switch(ftype) {
+ case LDAP_FILTER_AND:
+ return NULL;
+ case LDAP_FILTER_OR:
+ return f1?f1:f2;
+ default:
+ if (NULL == f1) {
+ if (NULL == f2) {
+ return NULL;
+ } else {
+ add_this = f2;
+ }
+ } else {
+ add_this = f1;
+ }
+ fjoin = (struct slapi_filter *)slapi_ch_calloc(1, sizeof(struct slapi_filter));
+ fjoin->f_choice = ftype;
+ fjoin->f_list = add_this;
+ filter_compute_hash(fjoin);
+ return fjoin;
+ }
+ }
+
if(!recurse_always)
{
/* try to optimise the filter join */
commit 13da51ef8c052ac600cfeec1738d04d9926bf4ce
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:14:45 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13038 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for pb_operation.
modified: roles_cache_change_notify in roles_cache.c
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c
index 16e450f..3f9b4d9 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -815,21 +815,21 @@ void roles_cache_change_notify(Slapi_PBlock *pb)
return;
}
- /* Don't update local cache when remote entries are updated */
- slapi_pblock_get( pb, SLAPI_BACKEND, &be );
- if ( ( be==NULL ) ||
- ( slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA)) )
- {
+ /* Don't update local cache when remote entries are updated */
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if ((be == NULL) || (slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA))) {
return;
}
- slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
- if( sdn == NULL )
- {
- return;
- }
+ slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
+ if(sdn == NULL) {
+ return;
+ }
- slapi_pblock_get (pb, SLAPI_OPERATION, &pb_operation);
+ slapi_pblock_get(pb, SLAPI_OPERATION, &pb_operation);
+ if (NULL == pb_operation) {
+ return;
+ }
operation = operation_get_type(pb_operation);
switch (operation)
commit 9542aa4504cfcab89ba8ffe842f44923e06d82df
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:07:21 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13040 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mech and cred.
modified: ids_sasl_check_bind in saslbind.c
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 6f53aea..85b62cb 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -800,10 +800,16 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
}
slapi_pblock_get(pb, SLAPI_BIND_SASLMECHANISM, &mech);
+ if (NULL == mech) {
+ rc = SASL_NOMECH;
+ goto sasl_check_result;
+ }
slapi_pblock_get(pb, SLAPI_BIND_CREDENTIALS, &cred);
+ if (NULL == cred) {
+ rc = SASL_BADPARAM;
+ goto sasl_check_result;
+ }
slapi_pblock_get(pb, SLAPI_PWPOLICY, &pwresponse_requested);
- PR_ASSERT(mech);
- PR_ASSERT(cred);
/* Work around a bug in the sasl library. We've told the
* library that CRAM-MD5 is disabled, but it gives us a
@@ -877,7 +883,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
cred->bv_val, cred->bv_len,
&sdata, &slen);
- sasl_check_result:
+sasl_check_result:
switch (rc) {
case SASL_OK: /* complete */
commit b22442098821af8904604fb5f0bb601d9d09cee9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 18:24:31 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 11895 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13037 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13039 - Dereference after null check (FORWARD_NULL)
Coverity defect 13043 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13044 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op, e, and op_params.
modified: copy_operation_parameters, write_changelog_and_ruv,
and cancel_opcsn in repl5_plugins.c
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
index 43b9d2e..495afeb 100644
--- a/ldap/servers/plugins/replication/repl5_plugins.c
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
@@ -987,11 +987,17 @@ copy_operation_parameters(Slapi_PBlock *pb)
/* we only save the original operation parameters for replicated operations
since client operations don't go through urp engine and pblock data can be logged */
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
- PR_ASSERT (op);
-
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM,
+ "copy_operation_parameters: operation is null.\n");
+ return;
+ }
replica = (Replica*)object_get_data (repl_obj);
- PR_ASSERT (replica);
-
+ if (NULL == replica) {
+ slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM,
+ "copy_operation_parameters: replica is null.\n");
+ return;
+ }
opext = (supplier_operation_extension*) repl_sup_get_ext (REPL_SUP_EXT_OP, op);
if (operation_is_flag_set(op,OP_FLAG_REPLICATED) &&
!operation_is_flag_set(op, OP_FLAG_REPL_FIXUP))
@@ -1054,7 +1060,7 @@ update_ruv_component(Replica *replica, CSN *opcsn, Slapi_PBlock *pb)
*/
static int
write_changelog_and_ruv (Slapi_PBlock *pb)
-{
+{
Slapi_Operation *op = NULL;
int rc;
slapi_operation_parameters *op_params = NULL;
@@ -1066,6 +1072,9 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
/* we just let fixup operations through */
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
+ if (NULL == op) {
+ return return_value;
+ }
if ((operation_is_flag_set(op, OP_FLAG_REPL_FIXUP)) ||
(operation_is_flag_set(op, OP_FLAG_TOMBSTONE_ENTRY)))
{
@@ -1125,7 +1134,9 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
const char *uniqueid = NULL;
slapi_pblock_get (pb, SLAPI_OPERATION_PARAMETERS, &op_params);
- PR_ASSERT (op_params);
+ if (NULL == op_params) {
+ return return_value;
+ }
/* need to set uniqueid operation parameter */
/* we try to use the appropriate entry (pre op or post op)
@@ -1142,12 +1153,13 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
{
slapi_pblock_get (pb, SLAPI_ENTRY_PRE_OP, &e);
}
-
- PR_ASSERT (e);
-
+ if (NULL == e) {
+ return return_value;
+ }
uniqueid = slapi_entry_get_uniqueid (e);
- PR_ASSERT (uniqueid);
-
+ if (NULL == uniqueid) {
+ return return_value;
+ }
op_params->target_address.uniqueid = slapi_ch_strdup (uniqueid);
}
@@ -1343,17 +1355,20 @@ cancel_opcsn (Slapi_PBlock *pb)
Object *repl_obj;
Slapi_Operation *op = NULL;
- PR_ASSERT (pb);
-
+ if (NULL == pb) {
+ return SLAPI_PLUGIN_SUCCESS;
+ }
repl_obj = replica_get_replica_for_op (pb);
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
- PR_ASSERT (op);
- if (repl_obj)
+ if (NULL == op) {
+ return SLAPI_PLUGIN_SUCCESS;
+ }
+ if (repl_obj)
{
Replica *r;
Object *gen_obj;
CSNGen *gen;
- CSN *opcsn;
+ CSN *opcsn;
r = (Replica*)object_get_data (repl_obj);
PR_ASSERT (r);
@@ -1365,11 +1380,11 @@ cancel_opcsn (Slapi_PBlock *pb)
gen_obj = replica_get_csngen (r);
PR_ASSERT (gen_obj);
gen = (CSNGen*)object_get_data (gen_obj);
-
- if (NULL != opcsn)
- {
- csngen_abort_csn (gen, operation_get_csn(op));
- }
+
+ if (NULL != opcsn)
+ {
+ csngen_abort_csn (gen, operation_get_csn(op));
+ }
object_release (gen_obj);
}
commit 0b47821eec89260a1c5f6c8e39942ab9c6311240
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 15:31:28 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13046 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and
opid are used in the accesslog.
modified: aclanom_match_profile in aclanom.c
diff --git a/ldap/servers/plugins/acl/aclanom.c b/ldap/servers/plugins/acl/aclanom.c
index d46b498..118f95f 100644
--- a/ldap/servers/plugins/acl/aclanom.c
+++ b/ldap/servers/plugins/acl/aclanom.c
@@ -537,43 +537,49 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
if ( slapi_is_loglevel_set(loglevel) ) {
char *ndn = NULL;
Slapi_Operation *op = NULL;
-
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
+
ndn = slapi_entry_get_ndn ( e ) ;
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
if ( result == LDAP_SUCCESS) {
const char *aci_ndn;
aci_ndn = slapi_sdn_get_ndn (acl_anom_profile->anom_targetinfo[i].anom_target);
- if (access & SLAPI_ACL_MODDN) {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn,
- attr ? attr:"NULL",
- aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL",
- aci_ndn);
-
- } else {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn,
- attr ? attr:"NULL",
- aci_ndn);
- }
+ if (access & SLAPI_ACL_MODDN) {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
+ o_connid, o_opid,
+ ndn,
+ attr ? attr:"NULL",
+ aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL",
+ aci_ndn);
+
+ } else {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
+ o_connid, o_opid,
+ ndn,
+ attr ? attr:"NULL",
+ aci_ndn);
+ }
} else {
- if (access & SLAPI_ACL_MODDN) {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn, attr ? attr:"NULL" ,
- aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL");
- } else {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn, attr ? attr:"NULL" );
- }
+ if (access & SLAPI_ACL_MODDN) {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
+ o_connid, o_opid,
+ ndn, attr ? attr:"NULL" ,
+ aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL");
+ } else {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
+ o_connid, o_opid,
+ ndn, attr ? attr:"NULL" );
+ }
}
}
@@ -582,8 +588,8 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
return -1;
else
return result;
-
}
+
int
aclanom_is_client_anonymous ( Slapi_PBlock *pb )
{
commit 1acdd9bae6d3fad2d76aa427074e7fd9c3ad4a74
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:31:52 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13048 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for operation.
modified: modify_schema_dse in schema.c
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index af52081..9309547 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -2089,6 +2089,14 @@ modify_schema_dse (Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry *entr
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
slapi_pblock_get( pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ *returncode = LDAP_OPERATIONS_ERROR;
+ schema_create_errormsg( returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ schema_errprefix_generic, "Generic",
+ "operation is null" );
+ return (SLAPI_DSE_CALLBACK_ERROR);
+ }
+
is_internal_operation = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
/* In case we receive a schema from a supplier, check if we can accept it
commit 29260b7878f74284312abd031e08d4682f7a6e4f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:20:35 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13049 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: retrocl_postob in retrocl_po.c
diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c
index 9128fef..bcf53cd 100644
--- a/ldap/servers/plugins/retrocl/retrocl_po.c
+++ b/ldap/servers/plugins/retrocl/retrocl_po.c
@@ -597,6 +597,10 @@ int retrocl_postob (Slapi_PBlock *pb, int optype)
*/
(void)slapi_pblock_get( pb, SLAPI_BACKEND, &be );
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "retrocl_postob: backend is not set\n");
+ return SLAPI_PLUGIN_FAILURE;
+ }
if (slapi_be_logchanges(be) == 0) {
LDAPDebug0Args(LDAP_DEBUG_TRACE,"not applying change if not logging\n");
commit c080567a883cfd348e0c27b8b1f9419b581bb9ee
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:11:20 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13050 - Resource leak
Description: Free s_attrName when returning for "Invalid syntax".
modified: DS_LASGroupDnAttrEval in acllas.c
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index e3c1778..935e5df 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -2586,7 +2586,6 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
PList_t subject, PList_t resource, PList_t auth_info,
PList_t global_auth)
{
-
char *s_attrName = NULL;
char *attrName;
char *ptr;
@@ -2731,6 +2730,7 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
"DS_LASGroupDnAttrEval: Invalid syntax: %s\n",
attrVal->bv_val );
+ slapi_ch_free_string(&s_attrName);
return 0;
}
matched = acllas__user_ismember_of_group (
@@ -2804,37 +2804,36 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
lasinfo.clientDn, ACLLAS_CACHE_ALL_GROUPS,
lasinfo.aclpb->aclpb_clientcert);
if (matched == ACL_TRUE) {
- break;
- } else if ( matched == ACL_DONT_KNOW ) {
- /* record this but keep going--maybe another group will evaluate to TRUE */
- got_undefined = 1;
- }
+ break;
+ } else if ( matched == ACL_DONT_KNOW ) {
+ /* record this but keep going--maybe another group will evaluate to TRUE */
+ got_undefined = 1;
+ }
}
/* Deallocate the member array and the member struct */
for (j=0; j < info.numofGroups; j++)
slapi_ch_free ((void **) &info.member[j]);
slapi_ch_free ((void **) &info.member);
- }
- if (matched == ACL_TRUE) {
+ }
+ if (matched == ACL_TRUE) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"groupdnattr matches at level (%d)\n", levels[i]);
break;
} else if ( matched == ACL_DONT_KNOW ) {
- /* record this but keep going--maybe another group at another level
+ /* record this but keep going--maybe another group at another level
* will evaluate to TRUE.
- */
- got_undefined = 1;
- }
-
+ */
+ got_undefined = 1;
+ }
} /* NumofLevels */
}
- if (s_attrName) slapi_ch_free ((void**) &s_attrName );
+ slapi_ch_free_string(&s_attrName);
/*
* If no terms were undefined, then evaluate as normal.
* If there was an undefined term, but another one was TRUE, then we also evaluate
* as normal. Otherwise, the whole expression is UNDEFINED.
- */
+ */
if ( matched == ACL_TRUE || !got_undefined ) {
if (comparator == CMP_OP_EQ) {
rc = (matched == ACL_TRUE ? LAS_EVAL_TRUE : LAS_EVAL_FALSE);
commit 2e7ed6ab7a5e3a674f6476e2a4efb495db94f7f9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:44:47 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13051 - Other violation
Description: _pool->pl_buffer_default_pages (used for BDB DB_MULTIPLE_KEY
read) was assigned twice.
modified: clcache_set_config in cl5_clcache.c
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
index 60f288e..2c9d2bf 100644
--- a/ldap/servers/plugins/replication/cl5_clcache.c
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
@@ -217,8 +217,7 @@ clcache_set_config ()
* for DB_MULTIPLE_KEY operation.
*/
_pool->pl_buffer_default_pages = CL5_DEFAULT_CONFIG_CACHEMEMSIZE / DEFAULT_CLC_BUFFER_PAGE_SIZE + 1;
- _pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_PAGE_COUNT;
- if ( _pool->pl_buffer_default_pages <= 0 ) {
+ if ( _pool->pl_buffer_default_pages <= 0 ) { /* this never be true... */
_pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_PAGE_COUNT;
}
commit 26d795e3b6a454ae01265e8a081ba9bd7bfb52b2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:26:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13052 - Identical code for different branches
Description: Removed redundant error check and return statement.
modified: createMissingNodes in ldclt/ldapfct.c
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 2dbad40..7308951 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -2279,8 +2279,7 @@ createMissingNodes (
printf ("ldclt[%d]: T%03d: Cannot add (%s), error=%d (%s)\n",
mctx.pid, tttctx->thrdNum, nodeDN, ret, my_ldap_err2string (ret));
fflush (stdout);
- if (addErrorStat (ret) < 0)
- return (-1);
+ addErrorStat(ret);
return (-1);
}
commit 9c33372b1c8eb7e7c876d7389b0af1c77c46653e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:23:19 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13053 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_compare in cb_compare.c
diff --git a/ldap/servers/plugins/chainingdb/cb_compare.c b/ldap/servers/plugins/chainingdb/cb_compare.c
index 594c4bb..6907c42 100644
--- a/ldap/servers/plugins/chainingdb/cb_compare.c
+++ b/ldap/servers/plugins/chainingdb/cb_compare.c
@@ -85,10 +85,13 @@ chaining_back_compare ( Slapi_PBlock *pb )
return -1;
}
- slapi_pblock_get( pb, SLAPI_COMPARE_TARGET_SDN, &sdn );
slapi_pblock_get( pb, SLAPI_COMPARE_TYPE, &type );
slapi_pblock_get( pb, SLAPI_COMPARE_VALUE, &bval );
-
+ slapi_pblock_get( pb, SLAPI_COMPARE_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL );
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
/*
commit 3f7e0d45cc44bd01fc34369292819b31419346d6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:13:28 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13054 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_wire_import in import-threads.c
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 95679a0..fdc87c0 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -3449,7 +3449,10 @@ int ldbm_back_wire_import(Slapi_PBlock *pb)
int state;
slapi_pblock_get(pb, SLAPI_BACKEND, &be);
- PR_ASSERT(be != NULL);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm_back_wire_import: backend is not set\n");
+ return -1;
+ }
li = (struct ldbminfo *)(be->be_database->plg_private);
slapi_pblock_get(pb, SLAPI_BULK_IMPORT_STATE, &state);
slapi_pblock_set(pb, SLAPI_LDIF2DB_ENCRYPT, &li->li_online_import_encrypt);
commit 2b6c6869e81649a30dd9c4cfa123f34970de4d9a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:08:53 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13055 - Identical code for different branches
Description: Removed redundant error check and return statement.
modified: connectToServer in ldclt/ldapfct.c
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 110ad78..2dbad40 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -1201,8 +1201,7 @@ connectToServer (
fprintf (stderr, "ldclt[%d]: T%03d: cannot ldap_unbind(), error=%d (%s)\n",
mctx.pid, tttctx->thrdNum, ret,strerror (ret));
fflush (stderr);
- if (addErrorStat (ret) < 0)
- return (-1);
+ addErrorStat(ret);
return (-1);
}
tttctx->ldapCtx = NULL;
commit 2828f8d9bbd457e4513a028115438b9dd7e36ae1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:50:22 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13057 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mrTYPE.
modified: extensible_candidates in filterindex.c
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index c8c40c4..7054ef8 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -453,7 +453,7 @@ extensible_candidates(
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID);
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE);
- if (mrVALUES != NULL && *mrVALUES != NULL)
+ if (mrVALUES && *mrVALUES && mrTYPE)
{
/*
* Compute keys for each of the values, individually.
commit df8302286e5437e6ca186775a9980a5d62e44c9a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:44:08 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13058 - Resource leak
Description: In error cases, input_cursors leaked.
modified: import_merge_one_file in import-merge.c
diff --git a/ldap/servers/slapd/back-ldbm/import-merge.c b/ldap/servers/slapd/back-ldbm/import-merge.c
index a728165..db85a14 100644
--- a/ldap/servers/slapd/back-ldbm/import-merge.c
+++ b/ldap/servers/slapd/back-ldbm/import-merge.c
@@ -398,6 +398,7 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
int number_found = 0;
int pass_number = 0;
DB **input_files = NULL;
+ DBC **input_cursors = NULL;
PR_ASSERT(NULL != inst);
@@ -441,7 +442,6 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
} else {
/* We really need to merge */
import_merge_queue_entry *merge_queue = NULL;
- DBC **input_cursors = NULL;
DBT key = {0};
import_merge_thang thang = {0};
int i = 0;
@@ -629,13 +629,13 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
}
}
if (preclose_ret != 0) ret = preclose_ret;
- slapi_ch_free( (void**)&input_cursors);
}
if (EOF == ret) {
ret = 0;
}
error:
+ slapi_ch_free((void**)&input_cursors);
slapi_ch_free((void**)&input_files);
if (ret) {
import_log_notice(worker->job, "%s: Import merge failed. "
commit 92132539a0807af1b25f6537be36b46fa397a2e8
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:35:59 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13059 - Resource leak
Description: search_pb needs to be allocated after an error case.
modified: syntax_validate_task_thread in syntaxes/validate_task.c
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
index 71b4b7e..9f9a143 100644
--- a/ldap/servers/plugins/syntaxes/validate_task.c
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
@@ -199,7 +199,7 @@ syntax_validate_task_thread(void *arg)
int rc = 0;
Slapi_Task *task = (Slapi_Task *)arg;
task_data *td = NULL;
- Slapi_PBlock *search_pb = slapi_pblock_new();
+ Slapi_PBlock *search_pb = NULL;
if (!task) {
return; /* no task */
@@ -220,14 +220,14 @@ syntax_validate_task_thread(void *arg)
/* Perform the search and use a callback
* to validate each matching entry. */
- slapi_search_internal_set_pb(search_pb, td->dn,
- LDAP_SCOPE_SUBTREE, td->filter_str, 0, 0,
- 0, 0, syntax_validate_get_plugin_id(), 0);
+ search_pb = slapi_pblock_new();
+ slapi_search_internal_set_pb(search_pb, td->dn,
+ LDAP_SCOPE_SUBTREE, td->filter_str, 0, 0,
+ 0, 0, syntax_validate_get_plugin_id(), 0);
- rc = slapi_search_internal_callback_pb(search_pb,
- td, 0, syntax_validate_task_callback, 0);
+ rc = slapi_search_internal_callback_pb(search_pb, td, 0, syntax_validate_task_callback, 0);
- slapi_pblock_destroy(search_pb);
+ slapi_pblock_destroy(search_pb);
/* Log finished message. */
slapi_task_log_notice(task, "Syntax validate task complete. Found %" NSPRIu64
commit 8cf900095915b9173554158a80164eb7005fbae4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:26:55 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13060 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for creds.
modified: chainingdb_bind in cb_bind.c
diff --git a/ldap/servers/plugins/chainingdb/cb_bind.c b/ldap/servers/plugins/chainingdb/cb_bind.c
index 4c6a12b..4dc1a72 100644
--- a/ldap/servers/plugins/chainingdb/cb_bind.c
+++ b/ldap/servers/plugins/chainingdb/cb_bind.c
@@ -257,7 +257,7 @@ chainingdb_bind( Slapi_PBlock *pb )
cb_send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
if (ctrls)
ldap_controls_free(ctrls);
- return SLAPI_BIND_FAIL;
+ return SLAPI_BIND_FAIL;
}
if (ctrls)
ldap_controls_free(ctrls);
@@ -267,6 +267,10 @@ chainingdb_bind( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_BIND_METHOD, &method );
slapi_pblock_get( pb, SLAPI_BIND_SASLMECHANISM, &mechanism);
slapi_pblock_get( pb, SLAPI_BIND_CREDENTIALS, &creds );
+ if (NULL == creds) {
+ cb_send_ldap_result( pb, rc, NULL, "No credentials", 0, NULL );
+ return SLAPI_BIND_FAIL;
+ }
slapi_pblock_get( pb, SLAPI_REQCONTROLS, &reqctrls );
cb = cb_get_instance(be);
commit a50a176f2577ffdef2840bb7a30684dfd31cf24c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:10:00 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13061 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: bulk_import_start in import-threads.c
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 1d25f95..95679a0 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -3114,16 +3114,13 @@ static int bulk_import_start(Slapi_PBlock *pb)
PRThread *thread = NULL;
int ret = 0;
- job = CALLOC(ImportJob);
- if (job == NULL) {
- LDAPDebug(LDAP_DEBUG_ANY, "not enough memory to do import job\n",
- 0, 0, 0);
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "bulk_import_start: backend is not set\n");
return -1;
}
-
- slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ job = CALLOC(ImportJob);
slapi_pblock_get(pb, SLAPI_LDIF2DB_ENCRYPT, &job->encrypt);
- PR_ASSERT(be != NULL);
li = (struct ldbminfo *)(be->be_database->plg_private);
job->inst = (ldbm_instance *)be->be_instance_info;
commit b9cd9c96ace663cc022ba3cfec18c300817e74a0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:02:01 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13062 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for f.
modified: ldbm_compute_rewriter in ldbm_attr.c
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 7b3f664..7b01acf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -1201,10 +1201,12 @@ ldbm_compute_rewriter(Slapi_PBlock *pb)
} else {
/* So let's grok the filter in detail and try to rewrite it */
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &f );
- rc = grok_and_rewrite_filter(f);
- if (0 == rc) {
- /* he rewrote it ! fixup the string version */
- /* slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, newfstr ); */
+ if (f) {
+ rc = grok_and_rewrite_filter(f);
+ if (0 == rc) {
+ /* he rewrote it ! fixup the string version */
+ /* slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, newfstr ); */
+ }
}
}
}
commit 4014a80da64de52462de96ee97dacf0dc9ef24b1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:54:02 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13063 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: slapi_on_internal_backends in mapping_tree.c
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 4267750..a4120bc 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -733,7 +733,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
}
plugin_funct = slapi_ch_strdup(slapi_value_get_string(val));
} else if (!strcasecmp(type, "nsslapd-distribution-root-update")) {
- const char *sval;
+ const char *sval;
slapi_attr_first_value(attr, &val);
if (NULL == val) {
LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
@@ -3144,8 +3144,10 @@ slapi_on_internal_backends(const Slapi_DN *sdn)
* but default to specialized use of those operations
* e.g rootDse search, ConfigRoot searches
* cn=config, cn=schema etc
+ * Return value: 1 if reserved.
+ * 0 if not reserved.
+ * -1 in error case.
*/
-
int slapi_op_reserved(Slapi_PBlock *pb)
{
int scope=LDAP_SCOPE_BASE;
@@ -3155,6 +3157,9 @@ int slapi_op_reserved(Slapi_PBlock *pb)
Slapi_DN *target_sdn=NULL;
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ return -1;
+ }
slapi_pblock_get(pb, SLAPI_OPERATION_TYPE, &op_type);
/* Get the target for this op */
target_sdn = operation_get_target_spec (op);
@@ -3162,9 +3167,8 @@ int slapi_op_reserved(Slapi_PBlock *pb)
if( op_type == SLAPI_OPERATION_SEARCH){
slapi_pblock_get(pb, SLAPI_SEARCH_SCOPE, &scope);
if( sdn_is_nulldn(target_sdn) && (scope == LDAP_SCOPE_BASE) ){
- reservedOp = 1;
+ reservedOp = 1;
}
-
}
if(slapi_on_internal_backends(target_sdn)){
commit 7c408d3272f67c7cca60b1a3b90ed540c5bc2a39
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:37:59 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13064 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_delete in cb_delete.c
diff --git a/ldap/servers/plugins/chainingdb/cb_delete.c b/ldap/servers/plugins/chainingdb/cb_delete.c
index 1538589..7b801a5 100644
--- a/ldap/servers/plugins/chainingdb/cb_delete.c
+++ b/ldap/servers/plugins/chainingdb/cb_delete.c
@@ -84,8 +84,11 @@ chaining_back_delete ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_DELETE_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL);
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
-
/*
* Check local acls
*/
commit 5f34a0041d0de02a2dce17c5b75b769e5b031f8f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:34:41 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13065 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_modrdn in cb_modrdn.c
diff --git a/ldap/servers/plugins/chainingdb/cb_modrdn.c b/ldap/servers/plugins/chainingdb/cb_modrdn.c
index b84fe57..67d8061 100644
--- a/ldap/servers/plugins/chainingdb/cb_modrdn.c
+++ b/ldap/servers/plugins/chainingdb/cb_modrdn.c
@@ -88,6 +88,11 @@ chaining_back_modrdn ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_MODRDN_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL);
+ return -1;
+ }
+
/* newrdn is passed to ldap_rename, which does not require case-ignored
* newrdn. */
slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &newrdn );
commit 3e5066fbf69f23d11e361292326f818d6f914fc0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 10:56:26 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13042 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13066 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for filter.
modified: ldbm_back_search in ldbm_search.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index e1951a0..fe0a6ca 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -720,9 +720,12 @@ ldbm_back_search( Slapi_PBlock *pb )
IDList *idl = NULL;
Slapi_Filter *filter = NULL;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
- rc = vlv_filter_candidates(be, pb, candidates, basesdn,
- scope, filter, &idl,
- lookthrough_limit, time_up);
+ rc = LDAP_OPERATIONS_ERROR;
+ if (filter) {
+ rc = vlv_filter_candidates(be, pb, candidates, basesdn,
+ scope, filter, &idl,
+ lookthrough_limit, time_up);
+ }
switch (rc) {
case LDAP_SUCCESS: /* Everything OK */
case LDAP_TIMELIMIT_EXCEEDED: /* Timeout */
@@ -949,6 +952,11 @@ vlv_bail:
Slapi_Filter *filter = NULL;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
+ if (NULL == filter) {
+ tmp_err = LDAP_OPERATIONS_ERROR;
+ tmp_desc = "Filter is not set";
+ goto bail;
+ }
if ( can_skip_filter_test( pb, filter, scope, candidates)) {
sr->sr_flags |= SR_FLAG_CAN_SKIP_FILTER_TEST;
}
@@ -962,6 +970,11 @@ vlv_bail:
Slapi_Filter *filter= NULL;
slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &filter);
+ if (NULL == filter) {
+ tmp_err = LDAP_OPERATIONS_ERROR;
+ tmp_desc = "Filter is not set";
+ goto bail;
+ }
slapi_filter_free(sr->sr_norm_filter, 1);
sr->sr_norm_filter = slapi_filter_dup(filter);
/* step 1 - normalize all of the values used in the search filter */
@@ -979,7 +992,7 @@ vlv_bail:
}
}
}
-
+bail:
/* Fix for bugid #394184, SD, 05 Jul 00 */
/* tmp_err == LDBM_SRCH_DEFAULT_RESULT: no error */
return ldbm_back_search_cleanup(pb, li, sort_control, tmp_err, tmp_desc,
@@ -1009,6 +1022,12 @@ build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
int r= 0;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
+ if (NULL == filter) {
+ slapi_send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "No filter", 0, NULL );
+ r = SLAPI_FAIL_GENERAL;
+ goto bail;
+ }
+
slapi_pblock_get( pb, SLAPI_MANAGEDSAIT, &managedsait );
switch ( scope ) {
@@ -1037,7 +1056,7 @@ build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
if (LDBM_OS_ERR_IS_DISKFULL(err)) r = return_on_disk_full(li);
else r = SLAPI_FAIL_GENERAL;
}
-
+bail:
/*
* If requested, set a flag to indicate whether the indexed
* lookup returned an ALLIDs block. Note that this is taken care of
commit f8c78d8f0b94cbc2c6976f00f2944fdbf7c0075a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:05:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13067 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: cb_forward_operation in cb_utils.c
diff --git a/ldap/servers/plugins/chainingdb/cb_utils.c b/ldap/servers/plugins/chainingdb/cb_utils.c
index f35943b..5ab6509 100644
--- a/ldap/servers/plugins/chainingdb/cb_utils.c
+++ b/ldap/servers/plugins/chainingdb/cb_utils.c
@@ -127,21 +127,25 @@ struct berval ** referrals2berval(char ** referrals) {
** We also check max hop count for loop detection for both internal
** and external operations
*/
-
-int cb_forward_operation(Slapi_PBlock * pb ) {
-
- Slapi_Operation *op=NULL;
- Slapi_Backend *be;
- struct slapi_componentid *cid = NULL;
- char *pname;
- cb_backend_instance *cb;
- int retcode;
- LDAPControl **ctrls=NULL;
-
- slapi_pblock_get (pb, SLAPI_OPERATION, &op);
+int
+cb_forward_operation(Slapi_PBlock * pb)
+{
+ Slapi_Operation *op = NULL;
+ Slapi_Backend *be;
+ struct slapi_componentid *cid = NULL;
+ char *pname;
+ cb_backend_instance *cb;
+ int retcode;
+ LDAPControl **ctrls=NULL;
+
+ slapi_pblock_get (pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, CB_PLUGIN_SUBSYSTEM, "No operation is set.\n");
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
/* Loop detection */
- slapi_pblock_get( pb, SLAPI_REQCONTROLS, &ctrls );
+ slapi_pblock_get( pb, SLAPI_REQCONTROLS, &ctrls );
if ( NULL != ctrls ) {
struct berval *ctl_value=NULL;
commit 350dd7e0120bf71918e91c5e5ebaf162c18ba670
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:13:05 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13068 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_ldif2ldbm_deluxe in import.c
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 45ea68a..0694b62 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1596,15 +1596,12 @@ int ldbm_back_ldif2ldbm_deluxe(Slapi_PBlock *pb)
int up_flags = 0;
PRThread *thread = NULL;
- job = CALLOC(ImportJob);
- if (job == NULL) {
- LDAPDebug(LDAP_DEBUG_ANY, "not enough memory to do import job\n",
- 0, 0, 0);
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm_back_ldif2ldbm_deluxe: backend is not set\n");
return -1;
}
-
- slapi_pblock_get( pb, SLAPI_BACKEND, &be);
- PR_ASSERT(NULL != be);
+ job = CALLOC(ImportJob);
job->inst = (ldbm_instance *)be->be_instance_info;
slapi_pblock_get( pb, SLAPI_LDIF2DB_NOATTRINDEXES, &noattrindexes );
slapi_pblock_get( pb, SLAPI_LDIF2DB_FILE, &name_array );
commit 37634761be40395e27d46e73b75f62d1dcb559dc
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 13:21:54 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13069 - Resource leak
Description: If attrcrypt_crypto_op_values fails, the output Slapi_
Value array is cleaned up internally. The caller need not to free it.
modified: attrcrypt_crypto_op_values in ldbm_attrcrypt.c
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
index 41856d5..29bbbde 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
@@ -783,8 +783,11 @@ attrcrypt_crypto_op_values(attrcrypt_private *priv, backend *be, struct attrinf
Slapi_Value *encrypted_value = NULL;
ret = attrcrypt_crypto_op_value(priv,be,ai,invalues[i],&encrypted_value,encrypt);
- if (0 == ret) {
- encrypted_values[i] = encrypted_value;
+ if (ret) { /* If failed even once, free the entire Slapi_Value */
+ valuearray_free(&encrypted_values); /* encrypted_values is set to NULL */
+ break;
+ } else {
+ encrypted_values[i] = encrypted_value;
}
}
*outvalues = encrypted_values;
commit 4122156a9bc5275e6dc4ab7504262dd8b61b947c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 13:06:50 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13070 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_modify in cb_modify.c
diff --git a/ldap/servers/plugins/chainingdb/cb_modify.c b/ldap/servers/plugins/chainingdb/cb_modify.c
index db8a43c..4e28121 100644
--- a/ldap/servers/plugins/chainingdb/cb_modify.c
+++ b/ldap/servers/plugins/chainingdb/cb_modify.c
@@ -86,6 +86,10 @@ chaining_back_modify ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_MODIFY_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL );
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
if (cb_debug_on()) {
commit fcfceb286d0743e93b242e1feaae11a42938e077
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:58:57 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13071 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mrINDEX.
modified: matchrule_values_to_keys in matchrule.c
diff --git a/ldap/servers/slapd/back-ldbm/matchrule.c b/ldap/servers/slapd/back-ldbm/matchrule.c
index 7af42f4..6de6461 100644
--- a/ldap/servers/slapd/back-ldbm/matchrule.c
+++ b/ldap/servers/slapd/back-ldbm/matchrule.c
@@ -155,9 +155,13 @@ matchrule_values_to_keys(Slapi_PBlock *pb,struct berval **input_values,struct be
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_INDEX_FN, &mrINDEX);
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_VALUES, input_values);
- mrINDEX (pb);
- slapi_pblock_get (pb, SLAPI_PLUGIN_MR_KEYS, output_values);
- return 0;
+ if (mrINDEX) {
+ mrINDEX (pb);
+ slapi_pblock_get (pb, SLAPI_PLUGIN_MR_KEYS, output_values);
+ return LDAP_SUCCESS;
+ } else {
+ return LDAP_OPERATIONS_ERROR;
+ }
}
/*
commit 62c01b7e4dedad82712530bd4e89d426a0f0095d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:49:07 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13072 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for ent.
modified: deref_pre_entry in deref.c
diff --git a/ldap/servers/plugins/deref/deref.c b/ldap/servers/plugins/deref/deref.c
index 1bab0ab..e271b01 100644
--- a/ldap/servers/plugins/deref/deref.c
+++ b/ldap/servers/plugins/deref/deref.c
@@ -724,7 +724,7 @@ deref_pre_entry(Slapi_PBlock *pb)
ber_printf(ctrlber, "{"); /* begin control value */
slapi_pblock_get(pb, SLAPI_SEARCH_ENTRY_ORIG, &ent);
- for (spec = deref_get_first_spec(speclist, &ii); spec;
+ for (spec = deref_get_first_spec(speclist, &ii); ent && spec;
spec = deref_get_next_spec(speclist, &ii)) {
Slapi_Value *sv;
int idx = 0;
commit 17eb3cbe8eb236289b60d8933e9ee79bcaf13f2c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:33:38 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13074 - Dereference after null check (FORWARD_NULL)
Description: Added NULL check for entry. If NULL, continue the loop.
modified: write_replog_db in retrocl_po.c
diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c
index 4b2cdda..9128fef 100644
--- a/ldap/servers/plugins/retrocl/retrocl_po.c
+++ b/ldap/servers/plugins/retrocl/retrocl_po.c
@@ -231,7 +231,7 @@ write_replog_db(
if ( entry == NULL ) {
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &entry );
}
-
+ if ( entry == NULL ) continue;
uniqueId = slapi_entry_get_uniqueid( entry );
slapi_log_error( SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME,
commit e52e756ad8b237e91aa12a2756def173e1d7318a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 15:02:42 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and opid are
used in the accesslog.
Also, NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
modified: acl_access_allowed & print_access_control_summary in acl.c
slapi-plugin.h
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index f04e258..cd307d9 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -257,12 +257,17 @@ acl_access_allowed(
Slapi_Operation *op = NULL;
aclResultReason_t decision_reason;
int loglevel;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
slapi_pblock_get(pb, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
- TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","",
- tnf_int,access,access);
+ TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","", tnf_int,access,access);
decision_reason.deciding_aci = NULL;
decision_reason.reason = ACL_REASON_NONE;
@@ -301,8 +306,8 @@ acl_access_allowed(
if ( !privateBackend && (be_readonly || slapi_config_get_readonly () )){
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Deny %s on entry(%s)"
- ": readonly backend\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": readonly backend\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return LDAP_UNWILLING_TO_PERFORM;
@@ -314,8 +319,8 @@ acl_access_allowed(
if ( acl_skip_access_check ( pb, e )) {
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Allow %s on entry(%s)"
- ": root user\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": root user\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return(LDAP_SUCCESS);
@@ -466,7 +471,7 @@ acl_access_allowed(
slapi_log_error(loglevel, plugin_name,
"#### conn=%" NSPRIu64 " op=%d binddn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid, clientDn);
+ o_connid, o_opid, clientDn);
aclpb->aclpb_stat_total_entries++;
if (!(access & SLAPI_ACL_PROXY) &&
@@ -711,6 +716,8 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
Slapi_Operation *op = NULL;
int loglevel;
int i;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
@@ -724,6 +731,10 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
}
slapi_pblock_get(aclpb->aclpb_pblock, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
if (ret_val == LDAP_INSUFFICIENT_ACCESS) {
access_status = access_not_allowed_string;
@@ -789,7 +800,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -803,7 +814,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -818,7 +829,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -832,7 +843,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -847,7 +858,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -861,7 +872,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index bc68157..3a1203a 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -89,8 +89,13 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
/* NSPR uses the print macros a bit differently than ANSI C. We
* need to use ll for a 64-bit integer, even when a long is 64-bit.
*/
+#if defined(HAVE_LONG_LONG) && PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
+#define NSPRIu64 "lu"
+#define NSPRI64 "l"
+#else /* just assume long long is used */
#define NSPRIu64 "llu"
#define NSPRI64 "ll"
+#endif
/* OpenLDAP uses unsigned long for ber_tag_t and ber_len_t but mozldap uses unsigned int */
/* use this macro for printf statements for ber_tag_t and ber_len_t */
commit 0dec9f13896b21c686d8c9388b7dd805494aa19d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:02:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13076 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for opertion.
modified: legacy_preop in replication/repl_ops.c
diff --git a/ldap/servers/plugins/replication/repl_ops.c b/ldap/servers/plugins/replication/repl_ops.c
index 6cafc2d..89c20a1 100644
--- a/ldap/servers/plugins/replication/repl_ops.c
+++ b/ldap/servers/plugins/replication/repl_ops.c
@@ -99,15 +99,22 @@ legacy_preop(Slapi_PBlock *pb, const char *caller, int operation_type)
Slapi_Operation *operation = NULL;
consumer_operation_extension *opext = NULL;
int has_cf = 0;
- Object *r_obj;
- Replica *r;
+ Object *r_obj;
+ Replica *r;
int is_legacy_op = 0;
slapi_pblock_get( pb, SLAPI_OPERATION, &operation );
+ if (NULL == operation) {
+ slapi_send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL,
+ "Null replication operation is given", 0, NULL);
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Null replication operation is given\n");
+ return -1;
+ }
is_legacy_op = operation_is_flag_set(operation,OP_FLAG_LEGACY_REPLICATION_DN);
- r_obj = replica_get_replica_for_op (pb);
+ r_obj = replica_get_replica_for_op (pb);
- if (r_obj == NULL) { /* there is no replica configured for this operations */
+ if (r_obj == NULL) { /* there is no replica configured for this operations */
if (is_legacy_op){
/* This is a legacy replication operation but there are NO replica defined
Just refuse it */
commit 6974f19fcbd1a47a16748490e7655e74a5950a83
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:27:46 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13078 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for conn. If NULL, let sync_send_
results abort there. Also, added "return" if sync_acquire_connection
returns non success as advertised as "aborted" in the error message.
modified: sync_send_results in plugins/sync/sync_persist.c
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
index f41a10c..4bd7da8 100644
--- a/ldap/servers/plugins/sync/sync_persist.c
+++ b/ldap/servers/plugins/sync/sync_persist.c
@@ -575,12 +575,18 @@ sync_send_results( void *arg )
slapi_pblock_get(req->req_pblock, SLAPI_CONN_ID, &connid);
slapi_pblock_get(req->req_pblock, SLAPI_OPERATION_ID, &opid);
slapi_pblock_get(req->req_pblock, SLAPI_CONNECTION, &conn);
-
+ if (NULL == conn) {
+ slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
+ "conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
+ (long long unsigned int)connid, opid);
+ return;
+ }
conn_acq_flag = sync_acquire_connection (conn);
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
(long long unsigned int)connid, opid);
+ return;
}
PR_Lock( sync_request_list->sync_req_cvarlock );
commit 2a571d5ae647af29db76cffbb8f17b609a49d5df
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:17:36 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13079 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for ctx
modified: chainingdb_prev_search_results in plugins/chainingdb/cb_search.c
diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c
index 9aecd26..e763cf5 100644
--- a/ldap/servers/plugins/chainingdb/cb_search.c
+++ b/ldap/servers/plugins/chainingdb/cb_search.c
@@ -792,6 +792,8 @@ chainingdb_prev_search_results ( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &ctx );
slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_ENTRY, &entry );
- ctx->readahead = entry;
+ if (ctx) {
+ ctx->readahead = entry;
+ }
return;
}
commit 97cf7278ce28c02823a671a44ef9d6e63e862fa9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:14:13 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13080 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for attrs.
modified: ldbm_back_ldbm2index in slapd/back-ldbm/ldif2ldbm.c
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 523da09..51fa8e0 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1811,7 +1811,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
struct attrinfo *ai = NULL;
slapi_pblock_get(pb, SLAPI_DB2INDEX_ATTRS, &attrs);
- for (i = 0; attrs[i] != NULL; i++) {
+ for (i = 0; attrs && attrs[i]; i++) {
if ( g_get_shutdown() || c_get_shutdown() ) {
goto err_out;
}
8 years, 7 months
40 commits - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/acl/acl.c | 37 ++++++---
ldap/servers/plugins/acl/aclanom.c | 68 +++++++++---------
ldap/servers/plugins/acl/acllas.c | 29 +++----
ldap/servers/plugins/chainingdb/cb_bind.c | 6 +
ldap/servers/plugins/chainingdb/cb_compare.c | 7 +
ldap/servers/plugins/chainingdb/cb_delete.c | 5 +
ldap/servers/plugins/chainingdb/cb_modify.c | 4 +
ldap/servers/plugins/chainingdb/cb_modrdn.c | 5 +
ldap/servers/plugins/chainingdb/cb_search.c | 4 -
ldap/servers/plugins/chainingdb/cb_utils.c | 30 ++++---
ldap/servers/plugins/deref/deref.c | 2
ldap/servers/plugins/dna/dna.c | 40 +++++-----
ldap/servers/plugins/replication/cl5_clcache.c | 3
ldap/servers/plugins/replication/repl5_inc_protocol.c | 4 -
ldap/servers/plugins/replication/repl5_init.c | 2
ldap/servers/plugins/replication/repl5_plugins.c | 57 +++++++++------
ldap/servers/plugins/replication/repl5_replica.c | 22 +++--
ldap/servers/plugins/replication/repl5_total.c | 4 -
ldap/servers/plugins/replication/repl_connext.c | 20 ++---
ldap/servers/plugins/replication/repl_extop.c | 26 +++---
ldap/servers/plugins/replication/repl_ops.c | 15 ++-
ldap/servers/plugins/retrocl/retrocl_po.c | 6 +
ldap/servers/plugins/roles/roles_cache.c | 22 ++---
ldap/servers/plugins/sync/sync_persist.c | 12 ++-
ldap/servers/plugins/syntaxes/validate_task.c | 20 ++---
ldap/servers/plugins/usn/usn.c | 19 +++--
ldap/servers/slapd/abandon.c | 8 +-
ldap/servers/slapd/add.c | 4 -
ldap/servers/slapd/auth.c | 18 ++--
ldap/servers/slapd/back-ldbm/filterindex.c | 2
ldap/servers/slapd/back-ldbm/import-merge.c | 4 -
ldap/servers/slapd/back-ldbm/import-threads.c | 18 ++--
ldap/servers/slapd/back-ldbm/import.c | 11 +-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 10 +-
ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c | 7 +
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 4 -
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 4 -
ldap/servers/slapd/back-ldbm/ldbm_search.c | 29 ++++++-
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 2
ldap/servers/slapd/back-ldbm/matchrule.c | 10 +-
ldap/servers/slapd/back-ldbm/misc.c | 6 -
ldap/servers/slapd/back-ldbm/monitor.c | 10 +-
ldap/servers/slapd/bind.c | 8 +-
ldap/servers/slapd/compare.c | 2
ldap/servers/slapd/configdse.c | 3
ldap/servers/slapd/connection.c | 24 +++---
ldap/servers/slapd/conntable.c | 10 +-
ldap/servers/slapd/control.c | 2
ldap/servers/slapd/delete.c | 2
ldap/servers/slapd/extendop.c | 4 -
ldap/servers/slapd/filter.c | 24 ++++++
ldap/servers/slapd/mapping_tree.c | 12 ++-
ldap/servers/slapd/modify.c | 12 +--
ldap/servers/slapd/modrdn.c | 6 -
ldap/servers/slapd/monitor.c | 8 +-
ldap/servers/slapd/operation.c | 4 -
ldap/servers/slapd/opshared.c | 2
ldap/servers/slapd/psearch.c | 10 +-
ldap/servers/slapd/pw.c | 28 +++++--
ldap/servers/slapd/result.c | 10 +-
ldap/servers/slapd/sasl_io.c | 12 +--
ldap/servers/slapd/saslbind.c | 14 ++-
ldap/servers/slapd/schema.c | 8 ++
ldap/servers/slapd/search.c | 2
ldap/servers/slapd/slapi-plugin.h | 5 +
ldap/servers/slapd/snmp_collator.c | 2
ldap/servers/slapd/tools/dbscan.c | 2
ldap/servers/slapd/tools/ldclt/ldapfct.c | 6 -
ldap/servers/slapd/unbind.c | 6 -
69 files changed, 502 insertions(+), 342 deletions(-)
New commits:
commit 1f59d618b7cadc7df46c05025cf2fd93f0449654
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 16:25:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Description: Due to the changes made on NSPRIu64 and NSPRI64 along with
this fix:
> Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
> NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
casting PRUint64 to (long long unsigned int) in the log print is no longer
needed. Got rid of them.
Reviewed and advised by rmeggins(a)redhat.com (Thank you, Rich!!)
https://fedorahosted.org/389/ticket/48048
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 25123cb..7da853b 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -979,7 +979,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_NEXTVAL,
- (long long unsigned int)entry->nextval);
+ entry->nextval);
value = slapi_entry_attr_get_charptr(e, DNA_PREFIX);
if (value && value[0]) {
@@ -1108,7 +1108,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_MAXVAL,
- (long long unsigned int)entry->maxval);
+ entry->maxval);
/* get the global bind dn and password(if any) */
value = slapi_entry_attr_get_charptr(e, DNA_REMOTE_BIND_DN);
@@ -1232,7 +1232,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_THRESHOLD,
- (long long unsigned int)entry->threshold);
+ entry->threshold);
value = slapi_entry_attr_get_charptr(e, DNA_RANGE_REQUEST_TIMEOUT);
if (value) {
@@ -1244,7 +1244,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%" NSPRIu64 "]\n", DNA_RANGE_REQUEST_TIMEOUT,
- (long long unsigned int)entry->timeout);
+ entry->timeout);
value = slapi_entry_attr_get_charptr(e, DNA_NEXT_RANGE);
if (value) {
@@ -2276,8 +2276,8 @@ dna_first_free_value(struct configEntry *config_entry,
filter = slapi_ch_smprintf("(&%s(&(%s>=%" NSPRIu64 ")(%s<=%" NSPRIu64 ")))",
config_entry->filter,
- config_entry->types[0], (long long unsigned int)tmpval,
- config_entry->types[0], (long long unsigned int)config_entry->maxval);
+ config_entry->types[0], tmpval,
+ config_entry->types[0], config_entry->maxval);
}
if (NULL == filter) {
@@ -2464,7 +2464,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
if ((config_entry->maxval == -1) ||
(nextval <= (config_entry->maxval + config_entry->interval))) {
/* try to set the new next value in the config entry */
- PR_snprintf(next_value, sizeof(next_value),"%" NSPRIu64, (long long unsigned int)nextval);
+ PR_snprintf(next_value, sizeof(next_value),"%" NSPRIu64, nextval);
/* set up our replace modify operation */
replace_val[0] = next_value;
@@ -2491,7 +2491,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
if (LDAP_SUCCESS == ret) {
slapi_ch_free_string(next_value_ret);
- *next_value_ret = slapi_ch_smprintf("%" NSPRIu64, (long long unsigned int)setval);
+ *next_value_ret = slapi_ch_smprintf("%" NSPRIu64, setval);
if (NULL == *next_value_ret) {
ret = LDAP_OPERATIONS_ERROR;
goto done;
@@ -2577,7 +2577,7 @@ dna_update_shared_config(struct configEntry *config_entry)
/* We store the number of remaining assigned values
* in the shared config entry. */
PR_snprintf(remaining_vals, sizeof(remaining_vals),"%" NSPRIu64,
- (long long unsigned int)config_entry->remaining);
+ config_entry->remaining);
/* set up our replace modify operation */
replace_val[0] = remaining_vals;
@@ -2677,7 +2677,7 @@ dna_update_next_range(struct configEntry *config_entry,
/* Try to set the new next range in the config entry. */
PR_snprintf(nextrange_value, sizeof(nextrange_value), "%" NSPRIu64 "-%" NSPRIu64,
- (long long unsigned int)lower, (long long unsigned int)upper);
+ lower, upper);
/* set up our replace modify operation */
replace_val[0] = nextrange_value;
@@ -2745,8 +2745,8 @@ dna_activate_next_range(struct configEntry *config_entry)
int ret = 0;
/* Setup the modify operation for the config entry */
- PR_snprintf(maxval_val, sizeof(maxval_val),"%" NSPRIu64, (long long unsigned int)config_entry->next_range_upper);
- PR_snprintf(nextval_val, sizeof(nextval_val),"%" NSPRIu64, (long long unsigned int)config_entry->next_range_lower);
+ PR_snprintf(maxval_val, sizeof(maxval_val),"%" NSPRIu64, config_entry->next_range_upper);
+ PR_snprintf(nextval_val, sizeof(nextval_val),"%" NSPRIu64, config_entry->next_range_lower);
maxval_vals[0] = maxval_val;
maxval_vals[1] = 0;
@@ -3489,8 +3489,8 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
"dna_pre_op: Passed threshold of %"
NSPRIu64 " remaining values "
"for range %s. (%" NSPRIu64 " values remain)\n",
- (long long unsigned int)config_entry->threshold, config_entry->dn,
- (long long unsigned int)config_entry->remaining);
+ config_entry->threshold, config_entry->dn,
+ config_entry->remaining);
dna_fix_maxval(config_entry, 0);
}
@@ -3761,8 +3761,8 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods, char **e
"dna_pre_op: Passed threshold of %"
NSPRIu64 " remaining values "
"for range %s. (%" NSPRIu64 " values remain)\n",
- (long long unsigned int)config_entry->threshold, config_entry->dn,
- (long long unsigned int)config_entry->remaining);
+ config_entry->threshold, config_entry->dn,
+ config_entry->remaining);
dna_fix_maxval(config_entry, 0);
}
@@ -4335,8 +4335,8 @@ static int dna_extend_exop(Slapi_PBlock *pb)
char highstr[16];
/* Create the exop response */
- PR_snprintf(lowstr, sizeof(lowstr), "%" NSPRIu64, (long long unsigned int)lower);
- PR_snprintf(highstr, sizeof(highstr), "%" NSPRIu64, (long long unsigned int)upper);
+ PR_snprintf(lowstr, sizeof(lowstr), "%" NSPRIu64, lower);
+ PR_snprintf(highstr, sizeof(highstr), "%" NSPRIu64, upper);
range_low.bv_val = lowstr;
range_low.bv_len = strlen(range_low.bv_val);
range_high.bv_val = highstr;
@@ -4370,7 +4370,7 @@ static int dna_extend_exop(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_PLUGIN, DNA_PLUGIN_SUBSYSTEM,
"dna_extend_exop: Released range %" NSPRIu64 "-%" NSPRIu64 ".\n",
- (long long unsigned int)lower, (long long unsigned int)upper);
+ lower, upper);
}
free_and_return:
@@ -4511,7 +4511,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
*lower = *upper - release + 1;
/* try to set the new maxval in the config entry */
- PR_snprintf(max_value, sizeof(max_value),"%" NSPRIu64, (long long unsigned int)(*lower - 1));
+ PR_snprintf(max_value, sizeof(max_value),"%" NSPRIu64, (*lower - 1));
/* set up our replace modify operation */
replace_val[0] = max_value;
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 5cf170c..f18fde5 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -1982,8 +1982,8 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
/* Isn't listening. Do something drastic. */
return_value = -1;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "%s: repl5_inc_stop: protocol does not stop after %llu seconds\n",
- agmt_get_long_name(prp->agmt), (long long unsigned int)timeout);
+ "%s: repl5_inc_stop: protocol does not stop after %" NSPRIu64 " seconds\n",
+ agmt_get_long_name(prp->agmt), timeout);
}
else
{
diff --git a/ldap/servers/plugins/replication/repl5_init.c b/ldap/servers/plugins/replication/repl5_init.c
index 56f01a1..8e2f114 100644
--- a/ldap/servers/plugins/replication/repl5_init.c
+++ b/ldap/servers/plugins/replication/repl5_init.c
@@ -227,7 +227,7 @@ get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
if (opid) {
slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" NSPRIu64 " op=%d",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
slapi_pblock_get ( pb, SLAPI_OPERATION, &op );
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 61ae7ec..c184178 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -474,7 +474,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica in use locking_purl=%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root),
r->locking_purl ? r->locking_purl : "unknown");
rval = PR_FALSE;
@@ -487,7 +487,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Acquired replica\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root));
r->repl_state_flags |= REPLICA_IN_USE;
if (isInc && *isInc)
@@ -528,13 +528,13 @@ replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica not in use\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root));
} else {
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Released replica held by locking_purl=%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
slapi_sdn_get_dn(r->repl_root),
r->locking_purl);
@@ -3411,7 +3411,6 @@ abort_csn_callback(const CSN *csn, void *data)
Replica *r = (Replica *)data;
Object *ruv_obj;
RUV *ruv;
- int rc;
PR_ASSERT(NULL != csn);
PR_ASSERT(NULL != data);
@@ -3423,11 +3422,14 @@ abort_csn_callback(const CSN *csn, void *data)
replica_lock(r->repl_lock);
- if (NULL != r->min_csn_pl)
- {
- rc = csnplRemove(r->min_csn_pl, csn);
- PR_ASSERT(rc == 0);
- }
+ if (NULL != r->min_csn_pl)
+ {
+ int rc = csnplRemove(r->min_csn_pl, csn);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "csnplRemove failed");
+ return;
+ }
+ }
ruv_cancel_csn_inprogress (ruv, csn);
replica_unlock(r->repl_lock);
diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c
index 45cdbae..f22246d 100644
--- a/ldap/servers/plugins/replication/repl5_total.c
+++ b/ldap/servers/plugins/replication/repl5_total.c
@@ -882,7 +882,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not import entry dn %s "
"for total update operation conn=%" NSPRIu64 " op=%d\n",
- rc, dn, (long long unsigned int)connid, opid);
+ rc, dn, connid, opid);
rc = -1;
}
@@ -892,7 +892,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Error %d: could not decode the total update extop "
"for total update operation conn=%" NSPRIu64 " op=%d\n",
- rc, (long long unsigned int)connid, opid);
+ rc, connid, opid);
}
if (rc != 0)
diff --git a/ldap/servers/plugins/replication/repl_connext.c b/ldap/servers/plugins/replication/repl_connext.c
index a591898..9da2cbb 100644
--- a/ldap/servers/plugins/replication/repl_connext.c
+++ b/ldap/servers/plugins/replication/repl_connext.c
@@ -111,7 +111,7 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Aborting total update in progress for replicated "
"area %s connid=%" NSPRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn),
- (long long unsigned int)connid);
+ connid);
slapi_stop_bulk_import(pb);
}
else
@@ -183,20 +183,20 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
ret = connext;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Acquired consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
else if (opid == connext->in_use_opid)
{
ret = connext;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Reacquired consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
else
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not acquire consumer connection extension; it is in use by op=%d\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
}
/* step 5, drop the lock */
@@ -206,7 +206,7 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not acquire consumer extension, it is NULL!\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
return ret;
@@ -244,7 +244,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Consumer connection extension is not in use\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
ret = 2;
}
else if (opid == connext->in_use_opid)
@@ -252,7 +252,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
/* step 4, relinquish it (normal) */
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Relinquishing consumer connection extension\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
connext->in_use_opid = -1;
ret = 1;
}
@@ -261,7 +261,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
/* step 4, relinquish it (forced) */
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Forced to relinquish consumer connection extension held by op=%d\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
connext->in_use_opid = -1;
ret = 1;
}
@@ -269,7 +269,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Not relinquishing consumer connection extension, it is held by op=%d!\n",
- (long long unsigned int)connid, opid, connext->in_use_opid);
+ connid, opid, connext->in_use_opid);
}
/* step 5, drop the lock */
@@ -279,7 +279,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d Could not relinquish consumer extension, it is NULL!\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
}
return ret;
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 4fefe9f..583d2cc 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -697,7 +697,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_TRUE;
}
else if (strcmp(protocol_oid, REPL_NSDS50_TOTAL_PROTOCOL_OID) == 0)
@@ -723,7 +723,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_FALSE;
}
else if (strcmp(protocol_oid, REPL_NSDS71_INCREMENTAL_PROTOCOL_OID) == 0)
@@ -732,7 +732,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_TRUE;
}
else if (strcmp(protocol_oid, REPL_NSDS71_TOTAL_PROTOCOL_OID) == 0)
@@ -744,7 +744,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
isInc = PR_FALSE;
}
else
@@ -767,7 +767,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d replica=\"%s\": "
"Replica is being configured: try again later\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
response = NSDS50_REPL_REPLICA_BUSY;
goto send_response;
}
@@ -838,7 +838,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Excessive clock skew from supplier RUV\n",
- (long long unsigned int)connid, opid, repl_root);
+ connid, opid, repl_root);
response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
goto send_response;
}
@@ -875,7 +875,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Replica has same replicaID %d as supplier\n",
- (long long unsigned int)connid, opid, repl_root, replica_get_rid(replica));
+ connid, opid, repl_root, replica_get_rid(replica));
response = NSDS50_REPL_REPLICAID_ERROR;
goto send_response;
}
@@ -887,7 +887,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
*/
/* junkrc = ruv_get_first_id_and_purl(supplier_ruv, &junkrid, &locking_purl); */
PR_snprintf(locking_session, sizeof(locking_session), "conn=%" NSPRIu64 " id=%d",
- (long long unsigned int)connid, opid);
+ connid, opid);
locking_purl = &locking_session[0];
if (replica_get_exclusive_access(replica, &isInc, connid, opid,
locking_purl,
@@ -914,7 +914,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"374 - Starting sleep: connext->repl_protocol_version == %d\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
while (REPL_PROTOCOL_50_INCREMENTAL == connext->repl_protocol_version && i++ < max) {
usleep(200000);
@@ -923,7 +923,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"374 - Finished sleep: connext->repl_protocol_version == %d\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
}
#endif
@@ -1018,7 +1018,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"Unexpected update protocol received: %d. "
"Expected incremental or total.\n",
- (long long unsigned int)connid, opid, repl_root, connext->repl_protocol_version);
+ connid, opid, repl_root, connext->repl_protocol_version);
goto send_response;
}
@@ -1057,7 +1057,7 @@ send_response:
slapi_log_error (resp_log_level, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d replica=\"%s\": "
"Unable to acquire replica: error: %s%s\n",
- (long long unsigned int)connid, opid,
+ connid, opid,
(replica ? slapi_sdn_get_dn(replica_get_root(replica)) : "unknown"),
protocol_response2string (response), purlstr);
@@ -1109,7 +1109,7 @@ send_response:
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
"%s: response=%d rc=%d\n",
- (long long unsigned int)connid, opid, repl_root,
+ connid, opid, repl_root,
is90 ? "StartNSDS90ReplicationRequest" :
"StartNSDS50ReplicationRequest", response, rc);
slapi_send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
index 4bd7da8..53b2d13 100644
--- a/ldap/servers/plugins/sync/sync_persist.c
+++ b/ldap/servers/plugins/sync/sync_persist.c
@@ -578,14 +578,14 @@ sync_send_results( void *arg )
if (NULL == conn) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
return;
}
conn_acq_flag = sync_acquire_connection (conn);
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
return;
}
@@ -596,7 +596,7 @@ sync_send_results( void *arg )
if ( op == NULL || slapi_is_operation_abandoned( op ) ) {
slapi_log_error(SLAPI_LOG_PLUGIN, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Operation no longer active - terminating\n",
- (long long unsigned int)connid, opid);
+ connid, opid);
break;
}
if ( NULL == req->ps_eq_head || !req->req_active) {
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
index 9f9a143..d730dc7 100644
--- a/ldap/servers/plugins/syntaxes/validate_task.c
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
@@ -231,12 +231,12 @@ syntax_validate_task_thread(void *arg)
/* Log finished message. */
slapi_task_log_notice(task, "Syntax validate task complete. Found %" NSPRIu64
- " invalid entries.\n", (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ " invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
slapi_task_log_status(task, "Syntax validate task complete. Found %" NSPRIu64
- " invalid entries.\n", (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ " invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
slapi_log_error(SLAPI_LOG_FATAL, SYNTAX_PLUGIN_SUBSYSTEM, "Syntax validate task complete."
" Found %" NSPRIu64 " invalid entries.\n",
- (long long unsigned int)slapi_counter_get_value(td->invalid_entries));
+ slapi_counter_get_value(td->invalid_entries));
slapi_task_inc_progress(task);
/* this will queue the destruction of the task */
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 55ab5f7..7a12abe 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -350,7 +350,7 @@ _usn_add_next_usn(Slapi_Entry *e, Slapi_Backend *be)
/* add next USN to the entry; "be" contains the usn counter */
usn_berval.bv_val = slapi_ch_smprintf("%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
usn_berval.bv_len = strlen(usn_berval.bv_val);
slapi_entry_attr_find(e, SLAPI_ATTR_ENTRYUSN, &attr);
if (NULL == attr) { /* ENTRYUSN does not exist; add it */
@@ -390,7 +390,7 @@ _usn_mod_next_usn(LDAPMod ***mods, Slapi_Backend *be)
/* add next USN to the mods; "be" contains the usn counter */
usn_berval.bv_val = counter_buf;
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
usn_berval.bv_len = strlen(usn_berval.bv_val);
bvals[0] = &usn_berval;
bvals[1] = NULL;
@@ -528,7 +528,7 @@ usn_bepostop (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -566,7 +566,7 @@ usn_bepostop_modify (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -617,7 +617,7 @@ usn_bepostop_delete (Slapi_PBlock *pb)
/* if op is not successful, don't increment the counter */
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (LDAP_SUCCESS != rc) {
- /* no plugin failure */
+ /* no plugin failure */
rc = SLAPI_PLUGIN_SUCCESS;
goto bail;
}
@@ -711,7 +711,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
* then minus 1 from it (except if be_usn_counter has value 0) */
if (slapi_counter_get_value(be->be_usn_counter)) {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter)-1);
+ slapi_counter_get_value(be->be_usn_counter)-1);
} else {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
}
@@ -734,7 +734,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
* then minus 1 from it (except if be_usn_counter has value 0) */
if (slapi_counter_get_value(be->be_usn_counter)) {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter)-1);
+ slapi_counter_get_value(be->be_usn_counter)-1);
} else {
PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
}
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 6b4bbf2..43158a8 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/ldap/servers/slapd/abandon.c
@@ -155,19 +155,19 @@ do_abandon( Slapi_PBlock *pb )
if ( 0 == pagedresults_free_one_msgid_nolock(pb->pb_conn, id) ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64
" op=%d ABANDON targetop=Simple Paged Results\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid );
} else if ( NULL == o ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=NOTFOUND msgid=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else if ( suppressed_by_plugin ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
" targetop=%d msgid=%d nentries=%d etime=%ld\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
o->o_results.r.r_search.nentries, current_time() - o->o_time );
}
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 243ef63..12b97e8 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -201,7 +201,7 @@ do_add( Slapi_PBlock *pb )
!= LDAP_SUCCESS ) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
slapi_entry_get_dn_const(e), normtype );
send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
@@ -487,7 +487,7 @@ static void op_shared_add (Slapi_PBlock *pb)
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ADD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
operation->o_opid,
slapi_entry_get_dn_const(e),
proxystr ? proxystr : "");
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 0219576..ae4af50 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -403,7 +403,7 @@ handle_bad_certificate (void* clientData, PRFileDesc *prfd)
char* issuer = issuer_of (clientCert);
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL" );
if (issuer) free (issuer);
@@ -440,7 +440,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " SSL failed to obtain channel info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
goto done;
}
if ( (slapd_ssl_getCipherSuiteInfo (channelInfo.cipherSuite, &cipherInfo, sizeof(cipherInfo)) )
@@ -449,7 +449,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " SSL failed to obtain cipher info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
- (long long unsigned int)conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
+ conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
goto done;
}
@@ -469,14 +469,14 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL" );
goto done;
}
if (clientCert == NULL) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL" );
} else {
subject = subject_of (clientCert);
@@ -485,7 +485,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s %i-bit %s; missing subject\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL");
goto done;
}
@@ -496,7 +496,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s %i-bit %s; client %s; issuer %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, keySize, cipher ? cipher : "NULL",
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL");
@@ -540,7 +540,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
sslversion, sizeof(sslversion));
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s client bound as %s\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, clientDN);
} else if (clientCert != NULL) {
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
@@ -548,7 +548,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
slapi_log_access (LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " %s failed to map client "
"certificate to LDAP DN (%s)\n",
- (long long unsigned int)conn->c_connid,
+ conn->c_connid,
sslversion, extraErrorMsg);
}
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index fdc87c0..6ad1c48 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -4031,7 +4031,7 @@ _get_import_entryusn(ImportJob *job, Slapi_Value **usn_value)
* next entryusn. */
PR_snprintf(counter_buf, USN_COUNTER_BUF_LEN,
"%" NSPRIu64,
- (long long unsigned int)slapi_counter_get_value(be->be_usn_counter));
+ slapi_counter_get_value(be->be_usn_counter));
} else {
/* import_init value is digit.
* Initialize the entryusn values with the digit */
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 3de8efa..498c3c1 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -136,7 +136,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
if ((NULL == addr) || (NULL == sdnp))
@@ -1500,7 +1500,7 @@ diskfull_return:
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
return rc;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 6a4982c..f5a404b 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -171,7 +171,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
inst = (ldbm_instance *) be->be_instance_info;
@@ -1563,7 +1563,7 @@ common_return:
if (pb->pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_modrdn", "leave conn=%" NSPRIu64 " op=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid);
+ pb->pb_conn->c_connid, operation->o_opid);
}
return retval;
}
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index d344e3c..19c7593 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -83,8 +83,8 @@ void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
return;
}
operation_id = operation->o_opid;
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
- (long long unsigned int)connection_id, operation_id, string);
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
+ connection_id, operation_id, string);
}
int return_on_disk_full(struct ldbminfo *li)
@@ -443,7 +443,7 @@ ldbm_txn_ruv_modify_context( Slapi_PBlock *pb, modify_context *mc )
bentry = find_entry2modify_only( pb, be, &bentry_addr, &txn );
if (NULL == bentry) {
- /* Uh oh, we couldn't find and lock the RUV entry! */
+ /* Uh oh, we couldn't find and lock the RUV entry! */
LDAPDebug( LDAP_DEBUG_ANY, "Error: ldbm_txn_ruv_modify_context failed to retrieve and lock RUV entry\n",
0, 0, 0 );
rc = -1;
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c
index 409c771..469778d 100644
--- a/ldap/servers/slapd/back-ldbm/monitor.c
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
@@ -130,9 +130,9 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
/* fetch cache statistics */
cache_get_stats(&(inst->inst_dncache), &hits, &tries,
&nentries, &maxentries, &size, &maxsize);
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)hits);
+ sprintf(buf, "%" NSPRIu64, hits);
MSET("dnCacheHits");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)tries);
+ sprintf(buf, "%" NSPRIu64, tries);
MSET("dnCacheTries");
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
MSET("dnCacheHitRatio");
@@ -148,11 +148,11 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
/* normalized dn cache stats */
if(ndn_cache_started()){
ndn_cache_get_stats(&hits, &tries, &size, &maxsize, &count);
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)tries);
+ sprintf(buf, "%" NSPRIu64, tries);
MSET("normalizedDnCacheTries");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)hits);
+ sprintf(buf, "%" NSPRIu64, hits);
MSET("normalizedDnCacheHits");
- sprintf(buf, "%" NSPRIu64, (long long unsigned int)(tries - hits));
+ sprintf(buf, "%" NSPRIu64, (tries - hits));
MSET("normalizedDnCacheMisses");
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
MSET("normalizedDnCacheHitRatio");
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 7acec84..70d2d19 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -899,25 +899,25 @@ log_bind_access (
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
version, saslmech, msg );
} else if (method == LDAP_AUTH_SASL && saslmech) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
version, saslmech );
} else if (msg) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=%ld version=%d, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version, msg );
} else {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
"method=%ld version=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version );
}
}
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 873d07f..5fb1d2f 100644
--- a/ldap/servers/slapd/compare.c
+++ b/ldap/servers/slapd/compare.c
@@ -144,7 +144,7 @@ do_compare( Slapi_PBlock *pb )
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, ava.ava_type );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, ava.ava_type );
/*
* We could be serving multiple database backends. Select the
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 529a3b1..9f0d9dc 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -448,7 +448,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
/* log useful stuff to our access log */
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
+ conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
/* initialize the remaining connection fields */
conn->c_ldapversion = LDAP_VERSION3;
@@ -548,7 +548,7 @@ connection_need_new_password(const Connection *conn, const Operation *op, Slapi_
{
slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
"UNPROCESSED OPERATION - need new password" );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM,
NULL, NULL, 0, NULL );
@@ -592,7 +592,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
" - Insufficient SSF (local_ssf=%d sasl_ssf=%d ssl_ssf=%d)\n",
- (long long unsigned int)conn->c_connid, op->o_opid, conn->c_local_ssf,
+ conn->c_connid, op->o_opid, conn->c_local_ssf,
conn->c_sasl_ssf, conn->c_ssl_ssf );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
"Minimum SSF not met.", 0, NULL );
@@ -620,7 +620,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
" - Anonymous access not allowed\n",
- (long long unsigned int)conn->c_connid, op->o_opid );
+ conn->c_connid, op->o_opid );
send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
"Anonymous access is not allowed.",
@@ -676,7 +676,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
int i = 1;
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",(long long unsigned int)conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
}
pop_cork = 1;
}
@@ -689,7 +689,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
int i = 0;
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",(long long unsigned int)conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
}
}
#endif
@@ -728,7 +728,7 @@ int connection_release_nolock (Connection *conn)
{
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
PR_ASSERT (PR_FALSE);
return -1;
}
@@ -749,7 +749,7 @@ int connection_acquire_nolock (Connection *conn)
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
return -1;
}
else
@@ -2966,13 +2966,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable"
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, maxbersize );
+ conn->c_connid, conn->c_sd, maxbersize );
} else {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was %" BERLEN_T " bytes, max allowable"
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
- (long long unsigned int)conn->c_connid, conn->c_sd, ber_len, maxbersize );
+ conn->c_connid, conn->c_sd, ber_len, maxbersize );
}
}
@@ -3023,13 +3023,13 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
if (error && (EPIPE != error) ) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
- (long long unsigned int)conn->c_connid, opid, conn->c_sd, error,
+ conn->c_connid, opid, conn->c_sd, error,
slapd_system_strerror(error),
slapd_pr_strerror(reason));
} else {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
- (long long unsigned int)conn->c_connid, opid, conn->c_sd,
+ conn->c_connid, opid, conn->c_sd,
slapd_pr_strerror(reason));
}
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index f1643ca..5225e11 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -440,8 +440,8 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
* by max threads.
*/
PR_snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%"NSPRIu64":%"NSPRIu64"",
- maxthreadstate, (long long unsigned int)ct->c[i].c_maxthreadscount,
- (long long unsigned int)ct->c[i].c_maxthreadsblocked);
+ maxthreadstate, ct->c[i].c_maxthreadscount,
+ ct->c[i].c_maxthreadsblocked);
if ((lendn + strlen(maxthreadbuf)) > (BUFSIZ - 46)) {
/*
@@ -475,17 +475,17 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnections", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(num_conns));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(num_conns));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "totalconnections", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(conns_in_maxthreads));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(conns_in_maxthreads));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnectionsatmaxthreads", vals );
- PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(max_threads_count));
+ PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(max_threads_count));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "maxthreadsperconnhits", vals );
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
index d97aa2f..02b88c1 100644
--- a/ldap/servers/slapd/control.c
+++ b/ldap/servers/slapd/control.c
@@ -367,7 +367,7 @@ get_ldapmessage_controls_ext(
slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
slapi_log_error(SLAPI_LOG_CONNS, "connection", "Warning: conn=%" NSPRIu64 " op=%d contains an empty list of controls\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid);
+ pb->pb_conn->c_connid, pb->pb_op->o_opid);
} else {
if ((tag != LBER_END_OF_SEQORSET) && (len != -1)) {
goto free_and_return;
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index b7fe02b..6d1a45b 100644
--- a/ldap/servers/slapd/delete.c
+++ b/ldap/servers/slapd/delete.c
@@ -294,7 +294,7 @@ static void op_shared_delete (Slapi_PBlock *pb)
if (!internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d DEL dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(sdn),
proxystr ? proxystr: "");
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index 4710c98..e5a4fcb 100644
--- a/ldap/servers/slapd/extendop.c
+++ b/ldap/servers/slapd/extendop.c
@@ -282,14 +282,14 @@ do_extended( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s)\n", extoid, 0, 0 );
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d EXT oid=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
} else {
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
extoid, name, 0 );
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
+ pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
}
/* during a bulk import, only BULK_IMPORT_DONE is allowed!
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index fb0fdde..9b2f42d 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -713,7 +713,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(sdn),
proxystr ? proxystr : "");
@@ -1245,7 +1245,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn));
}
@@ -1285,7 +1285,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
}
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn), proxystr ? proxystr : "");
}
@@ -1326,7 +1326,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
}
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
"user is not allowed to change password");
@@ -1352,7 +1352,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
@@ -1395,7 +1395,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
slapi_sdn_get_dn(&sdn),
proxystr ? proxystr : "",
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 8e7aff7..b4658c3 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -493,7 +493,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
{
slapi_log_access(LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"%s\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
dn,
newrdn ? newrdn : "(null)",
@@ -527,7 +527,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
if ( !internal_op ) {
slapi_log_error(SLAPI_LOG_ARGS, NULL,
"conn=%" NSPRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newrdn) ? "(null)" : newrdn);
} else {
@@ -560,7 +560,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
if (!internal_op) {
slapi_log_error(SLAPI_LOG_ARGS, NULL,
"conn=%" NSPRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
- (long long unsigned int)pb->pb_conn->c_connid,
+ pb->pb_conn->c_connid,
pb->pb_op->o_opid,
newsuperior ? newsuperior : "(null)");
} else {
diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c
index 5b8147a..2c15c39 100644
--- a/ldap/servers/slapd/monitor.c
+++ b/ldap/servers/slapd/monitor.c
@@ -91,19 +91,19 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
connection_table_as_entry(the_connection_table, e);
- val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(ops_initiated) );
+ val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_initiated) );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "opsinitiated", vals );
- val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)slapi_counter_get_value(ops_completed) );
+ val.bv_len = PR_snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_completed) );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "opscompleted", vals );
- val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)g_get_num_entries_sent() );
+ val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_entries_sent() );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "entriessent", vals );
- val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, (long long unsigned int)g_get_num_bytes_sent() );
+ val.bv_len = PR_snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_bytes_sent() );
val.bv_val = buf;
attrlist_replace( &e->e_attrs, "bytessent", vals );
diff --git a/ldap/servers/slapd/operation.c b/ldap/servers/slapd/operation.c
index 69f0069..f27c673 100644
--- a/ldap/servers/slapd/operation.c
+++ b/ldap/servers/slapd/operation.c
@@ -609,7 +609,7 @@ int slapi_connection_acquire(Slapi_Connection *conn)
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
rc = -1;
}
else
@@ -647,7 +647,7 @@ slapi_connection_remove_operation( Slapi_PBlock *pb, Slapi_Connection *conn, Sla
if (conn->c_refcnt <= 0) {
slapi_log_error(SLAPI_LOG_FATAL, "connection",
"conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
- (long long unsigned int)conn->c_connid, conn->c_sd);
+ conn->c_connid, conn->c_sd);
rc = -1;
} else {
conn->c_refcnt--;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index c8a5f8c..84a2bb4 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -1740,7 +1740,7 @@ void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char
}
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s dn=\"%s\"%s, %s\n",
- ( pb->pb_conn ? (long long unsigned int)pb->pb_conn->c_connid : 0),
+ ( pb->pb_conn ? pb->pb_conn->c_connid : 0),
( pb->pb_op ? pb->pb_op->o_opid : 0),
type,
dn,
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
index b059a36..25a562a 100644
--- a/ldap/servers/slapd/psearch.c
+++ b/ldap/servers/slapd/psearch.c
@@ -313,7 +313,7 @@ ps_send_results( void *arg )
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
}
PR_Lock( psearch_list->pl_cvarlock );
@@ -323,7 +323,7 @@ ps_send_results( void *arg )
if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d The operation has been abandoned\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
break;
}
if ( NULL == ps->ps_eq_head ) {
@@ -381,7 +381,7 @@ ps_send_results( void *arg )
if (rc) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Error %d sending entry %s with op status %d\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
+ ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
}
}
@@ -430,7 +430,7 @@ ps_send_results( void *arg )
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d Releasing the connection and operation\n",
- (long long unsigned int)conn->c_connid, ps->ps_pblock->pb_op->o_opid);
+ conn->c_connid, ps->ps_pblock->pb_op->o_opid);
/* Delete this op from the connection's list */
connection_remove_operation_ext( ps->ps_pblock, conn, ps->ps_pblock->pb_op );
@@ -566,7 +566,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
"conn=%" NSPRIu64 " op=%d entry %s with chgtype %d "
"matches the ps changetype %d\n",
- (long long unsigned int)ps->ps_pblock->pb_conn->c_connid,
+ ps->ps_pblock->pb_conn->c_connid,
ps->ps_pblock->pb_op->o_opid,
edn, chgtype, ps->ps_changetypes);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 45a5b4c..d5984df 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2002,7 +2002,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
", SASL bind in progress\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2034,7 +2034,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
" dn=\"%s\"\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2059,7 +2059,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s\n",
- (long long unsigned int)op->o_connid,
+ op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
@@ -2123,7 +2123,7 @@ log_entry( Operation *op, Slapi_Entry *e )
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d ENTRY dn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ op->o_connid, op->o_opid,
slapi_entry_get_dn_const(e));
}
else
@@ -2148,7 +2148,7 @@ log_referral( Operation *op )
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d REFERRAL\n",
- (long long unsigned int)op->o_connid, op->o_opid );
+ op->o_connid, op->o_opid );
}
else
{
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index 3fe9057..b522d3d 100644
--- a/ldap/servers/slapd/sasl_io.c
+++ b/ldap/servers/slapd/sasl_io.c
@@ -281,7 +281,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
ber_tag_t tag = 0;
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
- "Sent an LDAP message that was not encrypted.\n", (long long unsigned int)c->c_connid,
+ "Sent an LDAP message that was not encrypted.\n", c->c_connid,
c->c_sd);
/* Build a berval so we can get the length before reading in the entire packet */
@@ -297,7 +297,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
"conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable "
"is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in "
"cn=config to increase.\n",
- (long long unsigned int)c->c_connid, c->c_sd, maxbersize );
+ c->c_connid, c->c_sd, maxbersize );
PR_SetError(PR_IO_ERROR, 0);
return PR_FAILURE;
}
@@ -388,7 +388,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
if (*ber->ber_ptr == LDAP_REQ_UNBIND){
#endif
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
- "Received unencrypted UNBIND operation.\n", (long long unsigned int)c->c_connid,
+ "Received unencrypted UNBIND operation.\n", c->c_connid,
c->c_sd);
sp->encrypted_buffer_count = sp->encrypted_buffer_offset;
sp->encrypted_buffer_offset = 0;
@@ -398,9 +398,9 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
"Error: received an LDAP message (tag 0x%lx) that was not encrypted.\n",
#ifdef USE_OPENLDAP
- (long long unsigned int)c->c_connid, c->c_sd, (long unsigned int)tag);
+ c->c_connid, c->c_sd, (long unsigned int)tag);
#else
- (long long unsigned int)c->c_connid, c->c_sd, (long unsigned int)*ber->ber_ptr);
+ c->c_connid, c->c_sd, (long unsigned int)*ber->ber_ptr);
#endif
}
}
@@ -409,7 +409,7 @@ done:
/* If we got here we have garbage, or a denied LDAP operation */
slapi_log_error( SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
"Error: received an invalid message that was not encrypted.\n",
- (long long unsigned int)c->c_connid, c->c_sd);
+ c->c_connid, c->c_sd);
if (NULL != ber){
ber_free(ber, 1);
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 85b62cb..3ec9cd8 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -858,7 +858,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
slapi_log_error(SLAPI_LOG_CONNS, "ids_sasl_check_bind",
"cleaning up sasl IO conn=%" NSPRIu64 " op=%d complete=%d continuing=%d\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
(pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE), continuing);
/* reset flag */
pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_COMPLETE;
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index 5cdef9c..d591c1b 100644
--- a/ldap/servers/slapd/search.c
+++ b/ldap/servers/slapd/search.c
@@ -410,7 +410,7 @@ static void log_search_access (Slapi_PBlock *pb, const char *base, int scope, co
{
slapi_log_access(LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
- (long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid,
+ pb->pb_conn->c_connid, pb->pb_op->o_opid,
base, scope, fstr, msg ? msg : "");
}
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index f33202d..80fbfb1 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -794,7 +794,7 @@ static void
add_counter_to_value(Slapi_Entry *e, const char *type, PRUint64 countervalue)
{
char value[40];
- PR_snprintf(value,sizeof(value),"%" NSPRIu64, (long long unsigned int)countervalue);
+ PR_snprintf(value,sizeof(value),"%" NSPRIu64, countervalue);
slapi_entry_attr_set_charptr( e, type, value);
}
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index 1b76609..8cedeec 100644
--- a/ldap/servers/slapd/unbind.c
+++ b/ldap/servers/slapd/unbind.c
@@ -82,7 +82,7 @@ do_unbind( Slapi_PBlock *pb )
if ( ber_get_null( ber ) == LBER_ERROR ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
" decoding error: UnBindRequest not null\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid );
+ pb->pb_conn->c_connid, operation->o_opid );
/* LDAPv3 does not allow a response to an unbind... so just return. */
goto free_and_return;
}
@@ -97,7 +97,7 @@ do_unbind( Slapi_PBlock *pb )
if ( (err = get_ldapmessage_controls_ext( pb, ber, NULL, ignore_criticality )) != 0 ) {
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
" error processing controls - error %d (%s)\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid,
+ pb->pb_conn->c_connid, operation->o_opid,
err, ldap_err2string( err ));
/* LDAPv3 does not allow a response to an unbind... so just return. */
goto free_and_return;
@@ -111,7 +111,7 @@ do_unbind( Slapi_PBlock *pb )
/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND\n",
- (long long unsigned int)pb->pb_conn->c_connid, operation->o_opid );
+ pb->pb_conn->c_connid, operation->o_opid );
/* pass the unbind to all backends */
be_unbindall( pb->pb_conn, operation );
commit cd0e901f67b6ae045ba1c8a4697dd4c5506ebf19
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:28:43 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13030 - Logical vs. bitwise operator
Description: As coverity pointed out, meant to be '&' not '&&'.
modified: format_raw in dbscan.c
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index 023fade..b3d9f14 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -246,7 +246,7 @@ static char *format_raw(unsigned char *s, int len, int flags,
if ((flags & FMT_LF_OK) && (*p == '\n')) {
*o++ = '\n';
*o++ = '\t';
- } else if ((flags && FMT_SP_OK) && (*p == ' ')) {
+ } else if ((flags & FMT_SP_OK) && (*p == ' ')) {
*o++ = ' ';
} else {
*o++ = '%';
commit 52d2f9aae4c8ad8e910dbd7dc1e2ca00ea233796
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:22:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13031 - Logically dead code
Description: load_plugin_entry is not allowed to return failure.
If failed, the server does not run.
modified: load_plugin_entry in configdse.c
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index e70e340..5f26e6b 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -369,8 +369,7 @@ load_plugin_entry(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *r
}
*returncode = retval;
- return (retval == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK
- : SLAPI_DSE_CALLBACK_ERROR;
+ return SLAPI_DSE_CALLBACK_OK;
}
int
commit c1a8ba4adb798619045c83c4f9cb4a6fe0e5999d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 12:14:24 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13032 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13033 - Explicit null dereferenced (FORWARD_NULL)
4overity defect 13034 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for operation and e.
modified: pw_send_ldap_result, update_pw_info, and check_pw_syntax_ext in pw.c
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index c781adc..b5a75d9 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -99,6 +99,10 @@ pw_send_ldap_result(
Slapi_Operation *operation = NULL;
slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "pw_send_ldap_result: no operation\n");
+ return;
+ }
internal_op= operation_is_flag_set(operation, OP_FLAG_INTERNAL);
if (internal_op) {
@@ -203,7 +207,7 @@ char* slapi_encode_ext (Slapi_PBlock *pb, const Slapi_DN *sdn, char *value, char
if (pws_enc == NULL)
{
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: no server scheme\n" );
return NULL;
}
@@ -215,12 +219,12 @@ char* slapi_encode_ext (Slapi_PBlock *pb, const Slapi_DN *sdn, char *value, char
{
char * scheme_list = plugin_get_pwd_storage_scheme_list(PLUGIN_LIST_PWD_STORAGE_SCHEME);
if ( scheme_list != NULL ) {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: invalid scheme - %s\n"
"Valid values are: %s\n", alg, scheme_list );
slapi_ch_free((void **)&scheme_list);
} else {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_encode: invalid scheme - %s\n"
"no pwdstorage scheme plugin loaded", alg);
}
@@ -632,6 +636,10 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw)
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
slapi_pblock_get( pb, SLAPI_REQUESTOR_NDN, &bind_dn);
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &e);
+ if (NULL == e) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "update_pw_info: no password entry \n");
+ return -1;
+ }
internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
target_dn = slapi_sdn_get_ndn(sdn);
pwpolicy = new_passwdPolicy(pb, target_dn);
@@ -834,7 +842,7 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
return 0;
}
if (NULL == vals) {
- slapi_log_error( SLAPI_LOG_FATAL, NULL,
+ slapi_log_error( SLAPI_LOG_FATAL, "pwdpolicy",
"check_pw_syntax_ext: no passwords to check\n" );
return -1;
}
@@ -844,6 +852,10 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replication);
slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy", "check_pw_syntax_ext: no operation\n");
+ return -1;
+ }
internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
/*
@@ -2527,9 +2539,9 @@ pw_entry_constructor(void *object, void *parent)
struct slapi_pw_entry_ext *pw_extp = NULL;
Slapi_RWLock *rwlock;
if ((rwlock = slapi_new_rwlock()) == NULL) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"pw_entry_constructor: slapi_new_rwlock() failed\n");
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"WARNING: the server cannot handle unhashed password.\n");
return NULL;
}
@@ -2569,7 +2581,7 @@ pw_exp_init ( void )
pw_entry_destructor,
&pw_entry_objtype,
&pw_entry_handle) != 0) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"pw_init: slapi_register_object_extension failed; "
"unhashed password is not able to access\n");
}
@@ -2585,7 +2597,7 @@ slapi_pw_get_entry_ext(Slapi_Entry *entry, Slapi_Value ***vals)
struct slapi_pw_entry_ext *extp = NULL;
if (NULL == vals) {
- slapi_log_error(SLAPI_LOG_FATAL, NULL,
+ slapi_log_error(SLAPI_LOG_FATAL, "pwdpolicy",
"slapi_pw_get_entry_ext: output param vals is NULL.\n");
return LDAP_PARAM_ERROR;
}
commit 9ae878c2ff6475cabb01a035902addd8816c93fe
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:45:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13035 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: usn_preop_delete in usn.c
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index 6b34bf4..55ab5f7 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -321,6 +321,11 @@ usn_preop_delete(Slapi_PBlock *pb)
"--> usn_preop_delete\n");
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,
+ "<-- usn_preop_delete failed; no operation.\n");
+ return SLAPI_PLUGIN_FAILURE;
+ }
slapi_operation_set_replica_attr_handler(op, (void *)usn_get_attr);
slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
commit c1fa27dfefd460cf9f911c25b3c44de2663edea5
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:38:50 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13036 - Explicit null dereferenced (FORWARD_NULL)
Description: Modified slapi_filter_join_ex to accept NULL filter.
modified: slapi_filter_join_ex in ldap/servers/slapd/filter.c
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 5fd0347..5bebefe 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -856,6 +856,30 @@ slapi_filter_join_ex( int ftype, struct slapi_filter *f1, struct slapi_filter *f
struct slapi_filter *return_this;
int insert = 0;
+ if ((NULL == f1) || (NULL == f2)) {
+ switch(ftype) {
+ case LDAP_FILTER_AND:
+ return NULL;
+ case LDAP_FILTER_OR:
+ return f1?f1:f2;
+ default:
+ if (NULL == f1) {
+ if (NULL == f2) {
+ return NULL;
+ } else {
+ add_this = f2;
+ }
+ } else {
+ add_this = f1;
+ }
+ fjoin = (struct slapi_filter *)slapi_ch_calloc(1, sizeof(struct slapi_filter));
+ fjoin->f_choice = ftype;
+ fjoin->f_list = add_this;
+ filter_compute_hash(fjoin);
+ return fjoin;
+ }
+ }
+
if(!recurse_always)
{
/* try to optimise the filter join */
commit 3e3ed4869d6b10c0d8459d400c06603f3d0f337e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:14:45 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13038 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for pb_operation.
modified: roles_cache_change_notify in roles_cache.c
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c
index 16e450f..3f9b4d9 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -815,21 +815,21 @@ void roles_cache_change_notify(Slapi_PBlock *pb)
return;
}
- /* Don't update local cache when remote entries are updated */
- slapi_pblock_get( pb, SLAPI_BACKEND, &be );
- if ( ( be==NULL ) ||
- ( slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA)) )
- {
+ /* Don't update local cache when remote entries are updated */
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if ((be == NULL) || (slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA))) {
return;
}
- slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
- if( sdn == NULL )
- {
- return;
- }
+ slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
+ if(sdn == NULL) {
+ return;
+ }
- slapi_pblock_get (pb, SLAPI_OPERATION, &pb_operation);
+ slapi_pblock_get(pb, SLAPI_OPERATION, &pb_operation);
+ if (NULL == pb_operation) {
+ return;
+ }
operation = operation_get_type(pb_operation);
switch (operation)
commit c703a2b994b3c9b0014e75cadcd8ed1a55ae03b7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 11:07:21 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13040 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mech and cred.
modified: ids_sasl_check_bind in saslbind.c
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 6f53aea..85b62cb 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -800,10 +800,16 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
}
slapi_pblock_get(pb, SLAPI_BIND_SASLMECHANISM, &mech);
+ if (NULL == mech) {
+ rc = SASL_NOMECH;
+ goto sasl_check_result;
+ }
slapi_pblock_get(pb, SLAPI_BIND_CREDENTIALS, &cred);
+ if (NULL == cred) {
+ rc = SASL_BADPARAM;
+ goto sasl_check_result;
+ }
slapi_pblock_get(pb, SLAPI_PWPOLICY, &pwresponse_requested);
- PR_ASSERT(mech);
- PR_ASSERT(cred);
/* Work around a bug in the sasl library. We've told the
* library that CRAM-MD5 is disabled, but it gives us a
@@ -877,7 +883,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
cred->bv_val, cred->bv_len,
&sdata, &slen);
- sasl_check_result:
+sasl_check_result:
switch (rc) {
case SASL_OK: /* complete */
commit f0d49d2d517186af406e07cd9e9d4c0bcff31160
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 18:24:31 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 11895 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13037 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13039 - Dereference after null check (FORWARD_NULL)
Coverity defect 13043 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13044 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op, e, and op_params.
modified: copy_operation_parameters, write_changelog_and_ruv,
and cancel_opcsn in repl5_plugins.c
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
index 43b9d2e..495afeb 100644
--- a/ldap/servers/plugins/replication/repl5_plugins.c
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
@@ -987,11 +987,17 @@ copy_operation_parameters(Slapi_PBlock *pb)
/* we only save the original operation parameters for replicated operations
since client operations don't go through urp engine and pblock data can be logged */
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
- PR_ASSERT (op);
-
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM,
+ "copy_operation_parameters: operation is null.\n");
+ return;
+ }
replica = (Replica*)object_get_data (repl_obj);
- PR_ASSERT (replica);
-
+ if (NULL == replica) {
+ slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM,
+ "copy_operation_parameters: replica is null.\n");
+ return;
+ }
opext = (supplier_operation_extension*) repl_sup_get_ext (REPL_SUP_EXT_OP, op);
if (operation_is_flag_set(op,OP_FLAG_REPLICATED) &&
!operation_is_flag_set(op, OP_FLAG_REPL_FIXUP))
@@ -1054,7 +1060,7 @@ update_ruv_component(Replica *replica, CSN *opcsn, Slapi_PBlock *pb)
*/
static int
write_changelog_and_ruv (Slapi_PBlock *pb)
-{
+{
Slapi_Operation *op = NULL;
int rc;
slapi_operation_parameters *op_params = NULL;
@@ -1066,6 +1072,9 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
/* we just let fixup operations through */
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
+ if (NULL == op) {
+ return return_value;
+ }
if ((operation_is_flag_set(op, OP_FLAG_REPL_FIXUP)) ||
(operation_is_flag_set(op, OP_FLAG_TOMBSTONE_ENTRY)))
{
@@ -1125,7 +1134,9 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
const char *uniqueid = NULL;
slapi_pblock_get (pb, SLAPI_OPERATION_PARAMETERS, &op_params);
- PR_ASSERT (op_params);
+ if (NULL == op_params) {
+ return return_value;
+ }
/* need to set uniqueid operation parameter */
/* we try to use the appropriate entry (pre op or post op)
@@ -1142,12 +1153,13 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
{
slapi_pblock_get (pb, SLAPI_ENTRY_PRE_OP, &e);
}
-
- PR_ASSERT (e);
-
+ if (NULL == e) {
+ return return_value;
+ }
uniqueid = slapi_entry_get_uniqueid (e);
- PR_ASSERT (uniqueid);
-
+ if (NULL == uniqueid) {
+ return return_value;
+ }
op_params->target_address.uniqueid = slapi_ch_strdup (uniqueid);
}
@@ -1343,17 +1355,20 @@ cancel_opcsn (Slapi_PBlock *pb)
Object *repl_obj;
Slapi_Operation *op = NULL;
- PR_ASSERT (pb);
-
+ if (NULL == pb) {
+ return SLAPI_PLUGIN_SUCCESS;
+ }
repl_obj = replica_get_replica_for_op (pb);
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
- PR_ASSERT (op);
- if (repl_obj)
+ if (NULL == op) {
+ return SLAPI_PLUGIN_SUCCESS;
+ }
+ if (repl_obj)
{
Replica *r;
Object *gen_obj;
CSNGen *gen;
- CSN *opcsn;
+ CSN *opcsn;
r = (Replica*)object_get_data (repl_obj);
PR_ASSERT (r);
@@ -1365,11 +1380,11 @@ cancel_opcsn (Slapi_PBlock *pb)
gen_obj = replica_get_csngen (r);
PR_ASSERT (gen_obj);
gen = (CSNGen*)object_get_data (gen_obj);
-
- if (NULL != opcsn)
- {
- csngen_abort_csn (gen, operation_get_csn(op));
- }
+
+ if (NULL != opcsn)
+ {
+ csngen_abort_csn (gen, operation_get_csn(op));
+ }
object_release (gen_obj);
}
commit b9723db9e5ff82712e46738fa810f728b2b6a333
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 15:31:28 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13046 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and
opid are used in the accesslog.
modified: aclanom_match_profile in aclanom.c
diff --git a/ldap/servers/plugins/acl/aclanom.c b/ldap/servers/plugins/acl/aclanom.c
index d46b498..118f95f 100644
--- a/ldap/servers/plugins/acl/aclanom.c
+++ b/ldap/servers/plugins/acl/aclanom.c
@@ -537,43 +537,49 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
if ( slapi_is_loglevel_set(loglevel) ) {
char *ndn = NULL;
Slapi_Operation *op = NULL;
-
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
+
ndn = slapi_entry_get_ndn ( e ) ;
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
if ( result == LDAP_SUCCESS) {
const char *aci_ndn;
aci_ndn = slapi_sdn_get_ndn (acl_anom_profile->anom_targetinfo[i].anom_target);
- if (access & SLAPI_ACL_MODDN) {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn,
- attr ? attr:"NULL",
- aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL",
- aci_ndn);
-
- } else {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn,
- attr ? attr:"NULL",
- aci_ndn);
- }
+ if (access & SLAPI_ACL_MODDN) {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
+ o_connid, o_opid,
+ ndn,
+ attr ? attr:"NULL",
+ aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL",
+ aci_ndn);
+
+ } else {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
+ o_connid, o_opid,
+ ndn,
+ attr ? attr:"NULL",
+ aci_ndn);
+ }
} else {
- if (access & SLAPI_ACL_MODDN) {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn, attr ? attr:"NULL" ,
- aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL");
- } else {
- slapi_log_error(loglevel, plugin_name,
- "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
- (long long unsigned int)op->o_connid, op->o_opid,
- ndn, attr ? attr:"NULL" );
- }
+ if (access & SLAPI_ACL_MODDN) {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
+ o_connid, o_opid,
+ ndn, attr ? attr:"NULL" ,
+ aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL");
+ } else {
+ slapi_log_error(loglevel, plugin_name,
+ "conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
+ o_connid, o_opid,
+ ndn, attr ? attr:"NULL" );
+ }
}
}
@@ -582,8 +588,8 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
return -1;
else
return result;
-
}
+
int
aclanom_is_client_anonymous ( Slapi_PBlock *pb )
{
commit 26f1ba532699af601cca4bee4cffcdd75c2c8fd7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:31:52 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13048 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for operation.
modified: modify_schema_dse in schema.c
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index af52081..9309547 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -2089,6 +2089,14 @@ modify_schema_dse (Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry *entr
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
slapi_pblock_get( pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
+ if (NULL == operation) {
+ *returncode = LDAP_OPERATIONS_ERROR;
+ schema_create_errormsg( returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ schema_errprefix_generic, "Generic",
+ "operation is null" );
+ return (SLAPI_DSE_CALLBACK_ERROR);
+ }
+
is_internal_operation = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
/* In case we receive a schema from a supplier, check if we can accept it
commit 500e8be08158634526a92791f283c3ee210a279a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:20:35 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13049 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: retrocl_postob in retrocl_po.c
diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c
index 9128fef..bcf53cd 100644
--- a/ldap/servers/plugins/retrocl/retrocl_po.c
+++ b/ldap/servers/plugins/retrocl/retrocl_po.c
@@ -597,6 +597,10 @@ int retrocl_postob (Slapi_PBlock *pb, int optype)
*/
(void)slapi_pblock_get( pb, SLAPI_BACKEND, &be );
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "retrocl_postob: backend is not set\n");
+ return SLAPI_PLUGIN_FAILURE;
+ }
if (slapi_be_logchanges(be) == 0) {
LDAPDebug0Args(LDAP_DEBUG_TRACE,"not applying change if not logging\n");
commit 13184ae13da8594b85efc7fff5317bbe2791c848
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 17:11:20 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13050 - Resource leak
Description: Free s_attrName when returning for "Invalid syntax".
modified: DS_LASGroupDnAttrEval in acllas.c
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index e3c1778..935e5df 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -2586,7 +2586,6 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
PList_t subject, PList_t resource, PList_t auth_info,
PList_t global_auth)
{
-
char *s_attrName = NULL;
char *attrName;
char *ptr;
@@ -2731,6 +2730,7 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
"DS_LASGroupDnAttrEval: Invalid syntax: %s\n",
attrVal->bv_val );
+ slapi_ch_free_string(&s_attrName);
return 0;
}
matched = acllas__user_ismember_of_group (
@@ -2804,37 +2804,36 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
lasinfo.clientDn, ACLLAS_CACHE_ALL_GROUPS,
lasinfo.aclpb->aclpb_clientcert);
if (matched == ACL_TRUE) {
- break;
- } else if ( matched == ACL_DONT_KNOW ) {
- /* record this but keep going--maybe another group will evaluate to TRUE */
- got_undefined = 1;
- }
+ break;
+ } else if ( matched == ACL_DONT_KNOW ) {
+ /* record this but keep going--maybe another group will evaluate to TRUE */
+ got_undefined = 1;
+ }
}
/* Deallocate the member array and the member struct */
for (j=0; j < info.numofGroups; j++)
slapi_ch_free ((void **) &info.member[j]);
slapi_ch_free ((void **) &info.member);
- }
- if (matched == ACL_TRUE) {
+ }
+ if (matched == ACL_TRUE) {
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"groupdnattr matches at level (%d)\n", levels[i]);
break;
} else if ( matched == ACL_DONT_KNOW ) {
- /* record this but keep going--maybe another group at another level
+ /* record this but keep going--maybe another group at another level
* will evaluate to TRUE.
- */
- got_undefined = 1;
- }
-
+ */
+ got_undefined = 1;
+ }
} /* NumofLevels */
}
- if (s_attrName) slapi_ch_free ((void**) &s_attrName );
+ slapi_ch_free_string(&s_attrName);
/*
* If no terms were undefined, then evaluate as normal.
* If there was an undefined term, but another one was TRUE, then we also evaluate
* as normal. Otherwise, the whole expression is UNDEFINED.
- */
+ */
if ( matched == ACL_TRUE || !got_undefined ) {
if (comparator == CMP_OP_EQ) {
rc = (matched == ACL_TRUE ? LAS_EVAL_TRUE : LAS_EVAL_FALSE);
commit bbf65209fa15dce7b452ebac0d5ea66bd9466625
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:44:47 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13051 - Other violation
Description: _pool->pl_buffer_default_pages (used for BDB DB_MULTIPLE_KEY
read) was assigned twice.
modified: clcache_set_config in cl5_clcache.c
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
index 60f288e..2c9d2bf 100644
--- a/ldap/servers/plugins/replication/cl5_clcache.c
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
@@ -217,8 +217,7 @@ clcache_set_config ()
* for DB_MULTIPLE_KEY operation.
*/
_pool->pl_buffer_default_pages = CL5_DEFAULT_CONFIG_CACHEMEMSIZE / DEFAULT_CLC_BUFFER_PAGE_SIZE + 1;
- _pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_PAGE_COUNT;
- if ( _pool->pl_buffer_default_pages <= 0 ) {
+ if ( _pool->pl_buffer_default_pages <= 0 ) { /* this never be true... */
_pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_PAGE_COUNT;
}
commit f3b463fb3aeb7bc493b361033ed2fabf56b478e2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:26:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13052 - Identical code for different branches
Description: Removed redundant error check and return statement.
modified: createMissingNodes in ldclt/ldapfct.c
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 2dbad40..7308951 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -2279,8 +2279,7 @@ createMissingNodes (
printf ("ldclt[%d]: T%03d: Cannot add (%s), error=%d (%s)\n",
mctx.pid, tttctx->thrdNum, nodeDN, ret, my_ldap_err2string (ret));
fflush (stdout);
- if (addErrorStat (ret) < 0)
- return (-1);
+ addErrorStat(ret);
return (-1);
}
commit deaac70c61f8c4df44635035627d550f04ea3a7d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:23:19 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13053 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_compare in cb_compare.c
diff --git a/ldap/servers/plugins/chainingdb/cb_compare.c b/ldap/servers/plugins/chainingdb/cb_compare.c
index 594c4bb..6907c42 100644
--- a/ldap/servers/plugins/chainingdb/cb_compare.c
+++ b/ldap/servers/plugins/chainingdb/cb_compare.c
@@ -85,10 +85,13 @@ chaining_back_compare ( Slapi_PBlock *pb )
return -1;
}
- slapi_pblock_get( pb, SLAPI_COMPARE_TARGET_SDN, &sdn );
slapi_pblock_get( pb, SLAPI_COMPARE_TYPE, &type );
slapi_pblock_get( pb, SLAPI_COMPARE_VALUE, &bval );
-
+ slapi_pblock_get( pb, SLAPI_COMPARE_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL );
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
/*
commit acc0a2919b31b32383de90a17b7bdc5caa43939b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:13:28 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13054 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_wire_import in import-threads.c
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 95679a0..fdc87c0 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -3449,7 +3449,10 @@ int ldbm_back_wire_import(Slapi_PBlock *pb)
int state;
slapi_pblock_get(pb, SLAPI_BACKEND, &be);
- PR_ASSERT(be != NULL);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm_back_wire_import: backend is not set\n");
+ return -1;
+ }
li = (struct ldbminfo *)(be->be_database->plg_private);
slapi_pblock_get(pb, SLAPI_BULK_IMPORT_STATE, &state);
slapi_pblock_set(pb, SLAPI_LDIF2DB_ENCRYPT, &li->li_online_import_encrypt);
commit c88c7273a411b88d26370536792530df882524d7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 16:08:53 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13055 - Identical code for different branches
Description: Removed redundant error check and return statement.
modified: connectToServer in ldclt/ldapfct.c
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 110ad78..2dbad40 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -1201,8 +1201,7 @@ connectToServer (
fprintf (stderr, "ldclt[%d]: T%03d: cannot ldap_unbind(), error=%d (%s)\n",
mctx.pid, tttctx->thrdNum, ret,strerror (ret));
fflush (stderr);
- if (addErrorStat (ret) < 0)
- return (-1);
+ addErrorStat(ret);
return (-1);
}
tttctx->ldapCtx = NULL;
commit 2263bd9fab124dbd84a58a2b7d4ab8e3ee84e2d4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:50:22 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13057 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mrTYPE.
modified: extensible_candidates in filterindex.c
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index c8c40c4..7054ef8 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -453,7 +453,7 @@ extensible_candidates(
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID);
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE);
- if (mrVALUES != NULL && *mrVALUES != NULL)
+ if (mrVALUES && *mrVALUES && mrTYPE)
{
/*
* Compute keys for each of the values, individually.
commit b6d259dfeca81ab8f0e443b6981131d0eee38bb0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:44:08 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13058 - Resource leak
Description: In error cases, input_cursors leaked.
modified: import_merge_one_file in import-merge.c
diff --git a/ldap/servers/slapd/back-ldbm/import-merge.c b/ldap/servers/slapd/back-ldbm/import-merge.c
index a728165..db85a14 100644
--- a/ldap/servers/slapd/back-ldbm/import-merge.c
+++ b/ldap/servers/slapd/back-ldbm/import-merge.c
@@ -398,6 +398,7 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
int number_found = 0;
int pass_number = 0;
DB **input_files = NULL;
+ DBC **input_cursors = NULL;
PR_ASSERT(NULL != inst);
@@ -441,7 +442,6 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
} else {
/* We really need to merge */
import_merge_queue_entry *merge_queue = NULL;
- DBC **input_cursors = NULL;
DBT key = {0};
import_merge_thang thang = {0};
int i = 0;
@@ -629,13 +629,13 @@ static int import_merge_one_file(ImportWorkerInfo *worker, int passes,
}
}
if (preclose_ret != 0) ret = preclose_ret;
- slapi_ch_free( (void**)&input_cursors);
}
if (EOF == ret) {
ret = 0;
}
error:
+ slapi_ch_free((void**)&input_cursors);
slapi_ch_free((void**)&input_files);
if (ret) {
import_log_notice(worker->job, "%s: Import merge failed. "
commit 0cbd5bde9afafb0e8a1ee727c5962b4e9d4cc84f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:35:59 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13059 - Resource leak
Description: search_pb needs to be allocated after an error case.
modified: syntax_validate_task_thread in syntaxes/validate_task.c
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
index 71b4b7e..9f9a143 100644
--- a/ldap/servers/plugins/syntaxes/validate_task.c
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
@@ -199,7 +199,7 @@ syntax_validate_task_thread(void *arg)
int rc = 0;
Slapi_Task *task = (Slapi_Task *)arg;
task_data *td = NULL;
- Slapi_PBlock *search_pb = slapi_pblock_new();
+ Slapi_PBlock *search_pb = NULL;
if (!task) {
return; /* no task */
@@ -220,14 +220,14 @@ syntax_validate_task_thread(void *arg)
/* Perform the search and use a callback
* to validate each matching entry. */
- slapi_search_internal_set_pb(search_pb, td->dn,
- LDAP_SCOPE_SUBTREE, td->filter_str, 0, 0,
- 0, 0, syntax_validate_get_plugin_id(), 0);
+ search_pb = slapi_pblock_new();
+ slapi_search_internal_set_pb(search_pb, td->dn,
+ LDAP_SCOPE_SUBTREE, td->filter_str, 0, 0,
+ 0, 0, syntax_validate_get_plugin_id(), 0);
- rc = slapi_search_internal_callback_pb(search_pb,
- td, 0, syntax_validate_task_callback, 0);
+ rc = slapi_search_internal_callback_pb(search_pb, td, 0, syntax_validate_task_callback, 0);
- slapi_pblock_destroy(search_pb);
+ slapi_pblock_destroy(search_pb);
/* Log finished message. */
slapi_task_log_notice(task, "Syntax validate task complete. Found %" NSPRIu64
commit 4d60b688b286673ac4613c03b07e56deee3e0fa4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:26:55 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13060 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for creds.
modified: chainingdb_bind in cb_bind.c
diff --git a/ldap/servers/plugins/chainingdb/cb_bind.c b/ldap/servers/plugins/chainingdb/cb_bind.c
index 4c6a12b..4dc1a72 100644
--- a/ldap/servers/plugins/chainingdb/cb_bind.c
+++ b/ldap/servers/plugins/chainingdb/cb_bind.c
@@ -257,7 +257,7 @@ chainingdb_bind( Slapi_PBlock *pb )
cb_send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
if (ctrls)
ldap_controls_free(ctrls);
- return SLAPI_BIND_FAIL;
+ return SLAPI_BIND_FAIL;
}
if (ctrls)
ldap_controls_free(ctrls);
@@ -267,6 +267,10 @@ chainingdb_bind( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_BIND_METHOD, &method );
slapi_pblock_get( pb, SLAPI_BIND_SASLMECHANISM, &mechanism);
slapi_pblock_get( pb, SLAPI_BIND_CREDENTIALS, &creds );
+ if (NULL == creds) {
+ cb_send_ldap_result( pb, rc, NULL, "No credentials", 0, NULL );
+ return SLAPI_BIND_FAIL;
+ }
slapi_pblock_get( pb, SLAPI_REQCONTROLS, &reqctrls );
cb = cb_get_instance(be);
commit 18b44d139ad882193cd092b595dd34c6606d553f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:10:00 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13061 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: bulk_import_start in import-threads.c
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 1d25f95..95679a0 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -3114,16 +3114,13 @@ static int bulk_import_start(Slapi_PBlock *pb)
PRThread *thread = NULL;
int ret = 0;
- job = CALLOC(ImportJob);
- if (job == NULL) {
- LDAPDebug(LDAP_DEBUG_ANY, "not enough memory to do import job\n",
- 0, 0, 0);
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "bulk_import_start: backend is not set\n");
return -1;
}
-
- slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ job = CALLOC(ImportJob);
slapi_pblock_get(pb, SLAPI_LDIF2DB_ENCRYPT, &job->encrypt);
- PR_ASSERT(be != NULL);
li = (struct ldbminfo *)(be->be_database->plg_private);
job->inst = (ldbm_instance *)be->be_instance_info;
commit 76b34e121b23956d9f29a01d3713e6f89b10a5a6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:02:01 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13062 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for f.
modified: ldbm_compute_rewriter in ldbm_attr.c
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 7b3f664..7b01acf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -1201,10 +1201,12 @@ ldbm_compute_rewriter(Slapi_PBlock *pb)
} else {
/* So let's grok the filter in detail and try to rewrite it */
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &f );
- rc = grok_and_rewrite_filter(f);
- if (0 == rc) {
- /* he rewrote it ! fixup the string version */
- /* slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, newfstr ); */
+ if (f) {
+ rc = grok_and_rewrite_filter(f);
+ if (0 == rc) {
+ /* he rewrote it ! fixup the string version */
+ /* slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, newfstr ); */
+ }
}
}
}
commit a7eb4e049ffa3f76e29faa7d01611ee23028d581
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:54:02 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13063 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: slapi_on_internal_backends in mapping_tree.c
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 4267750..a4120bc 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -733,7 +733,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
}
plugin_funct = slapi_ch_strdup(slapi_value_get_string(val));
} else if (!strcasecmp(type, "nsslapd-distribution-root-update")) {
- const char *sval;
+ const char *sval;
slapi_attr_first_value(attr, &val);
if (NULL == val) {
LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
@@ -3144,8 +3144,10 @@ slapi_on_internal_backends(const Slapi_DN *sdn)
* but default to specialized use of those operations
* e.g rootDse search, ConfigRoot searches
* cn=config, cn=schema etc
+ * Return value: 1 if reserved.
+ * 0 if not reserved.
+ * -1 in error case.
*/
-
int slapi_op_reserved(Slapi_PBlock *pb)
{
int scope=LDAP_SCOPE_BASE;
@@ -3155,6 +3157,9 @@ int slapi_op_reserved(Slapi_PBlock *pb)
Slapi_DN *target_sdn=NULL;
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ return -1;
+ }
slapi_pblock_get(pb, SLAPI_OPERATION_TYPE, &op_type);
/* Get the target for this op */
target_sdn = operation_get_target_spec (op);
@@ -3162,9 +3167,8 @@ int slapi_op_reserved(Slapi_PBlock *pb)
if( op_type == SLAPI_OPERATION_SEARCH){
slapi_pblock_get(pb, SLAPI_SEARCH_SCOPE, &scope);
if( sdn_is_nulldn(target_sdn) && (scope == LDAP_SCOPE_BASE) ){
- reservedOp = 1;
+ reservedOp = 1;
}
-
}
if(slapi_on_internal_backends(target_sdn)){
commit 1b0d58a5983b0b6a3b8b5ba6b7b4796782b75be1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:37:59 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13064 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_delete in cb_delete.c
diff --git a/ldap/servers/plugins/chainingdb/cb_delete.c b/ldap/servers/plugins/chainingdb/cb_delete.c
index 1538589..7b801a5 100644
--- a/ldap/servers/plugins/chainingdb/cb_delete.c
+++ b/ldap/servers/plugins/chainingdb/cb_delete.c
@@ -84,8 +84,11 @@ chaining_back_delete ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_DELETE_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL);
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
-
/*
* Check local acls
*/
commit 588ea1ff3aaf45bb28c2d928bd4a6b877a3a4a09
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:34:41 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13065 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_modrdn in cb_modrdn.c
diff --git a/ldap/servers/plugins/chainingdb/cb_modrdn.c b/ldap/servers/plugins/chainingdb/cb_modrdn.c
index b84fe57..67d8061 100644
--- a/ldap/servers/plugins/chainingdb/cb_modrdn.c
+++ b/ldap/servers/plugins/chainingdb/cb_modrdn.c
@@ -88,6 +88,11 @@ chaining_back_modrdn ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_MODRDN_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL);
+ return -1;
+ }
+
/* newrdn is passed to ldap_rename, which does not require case-ignored
* newrdn. */
slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &newrdn );
commit 7348992c874b05f4b39a49d48920563e73d82054
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 10:56:26 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13042 - Explicit null dereferenced (FORWARD_NULL)
Coverity defect 13066 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for filter.
modified: ldbm_back_search in ldbm_search.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index e1951a0..fe0a6ca 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -720,9 +720,12 @@ ldbm_back_search( Slapi_PBlock *pb )
IDList *idl = NULL;
Slapi_Filter *filter = NULL;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
- rc = vlv_filter_candidates(be, pb, candidates, basesdn,
- scope, filter, &idl,
- lookthrough_limit, time_up);
+ rc = LDAP_OPERATIONS_ERROR;
+ if (filter) {
+ rc = vlv_filter_candidates(be, pb, candidates, basesdn,
+ scope, filter, &idl,
+ lookthrough_limit, time_up);
+ }
switch (rc) {
case LDAP_SUCCESS: /* Everything OK */
case LDAP_TIMELIMIT_EXCEEDED: /* Timeout */
@@ -949,6 +952,11 @@ vlv_bail:
Slapi_Filter *filter = NULL;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
+ if (NULL == filter) {
+ tmp_err = LDAP_OPERATIONS_ERROR;
+ tmp_desc = "Filter is not set";
+ goto bail;
+ }
if ( can_skip_filter_test( pb, filter, scope, candidates)) {
sr->sr_flags |= SR_FLAG_CAN_SKIP_FILTER_TEST;
}
@@ -962,6 +970,11 @@ vlv_bail:
Slapi_Filter *filter= NULL;
slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &filter);
+ if (NULL == filter) {
+ tmp_err = LDAP_OPERATIONS_ERROR;
+ tmp_desc = "Filter is not set";
+ goto bail;
+ }
slapi_filter_free(sr->sr_norm_filter, 1);
sr->sr_norm_filter = slapi_filter_dup(filter);
/* step 1 - normalize all of the values used in the search filter */
@@ -979,7 +992,7 @@ vlv_bail:
}
}
}
-
+bail:
/* Fix for bugid #394184, SD, 05 Jul 00 */
/* tmp_err == LDBM_SRCH_DEFAULT_RESULT: no error */
return ldbm_back_search_cleanup(pb, li, sort_control, tmp_err, tmp_desc,
@@ -1009,6 +1022,12 @@ build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
int r= 0;
slapi_pblock_get( pb, SLAPI_SEARCH_FILTER, &filter );
+ if (NULL == filter) {
+ slapi_send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "No filter", 0, NULL );
+ r = SLAPI_FAIL_GENERAL;
+ goto bail;
+ }
+
slapi_pblock_get( pb, SLAPI_MANAGEDSAIT, &managedsait );
switch ( scope ) {
@@ -1037,7 +1056,7 @@ build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
if (LDBM_OS_ERR_IS_DISKFULL(err)) r = return_on_disk_full(li);
else r = SLAPI_FAIL_GENERAL;
}
-
+bail:
/*
* If requested, set a flag to indicate whether the indexed
* lookup returned an ALLIDs block. Note that this is taken care of
commit f91b5826a57304011f7a027d05a20a0ed05bf3ea
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 14:05:25 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13067 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op.
modified: cb_forward_operation in cb_utils.c
diff --git a/ldap/servers/plugins/chainingdb/cb_utils.c b/ldap/servers/plugins/chainingdb/cb_utils.c
index f35943b..5ab6509 100644
--- a/ldap/servers/plugins/chainingdb/cb_utils.c
+++ b/ldap/servers/plugins/chainingdb/cb_utils.c
@@ -127,21 +127,25 @@ struct berval ** referrals2berval(char ** referrals) {
** We also check max hop count for loop detection for both internal
** and external operations
*/
-
-int cb_forward_operation(Slapi_PBlock * pb ) {
-
- Slapi_Operation *op=NULL;
- Slapi_Backend *be;
- struct slapi_componentid *cid = NULL;
- char *pname;
- cb_backend_instance *cb;
- int retcode;
- LDAPControl **ctrls=NULL;
-
- slapi_pblock_get (pb, SLAPI_OPERATION, &op);
+int
+cb_forward_operation(Slapi_PBlock * pb)
+{
+ Slapi_Operation *op = NULL;
+ Slapi_Backend *be;
+ struct slapi_componentid *cid = NULL;
+ char *pname;
+ cb_backend_instance *cb;
+ int retcode;
+ LDAPControl **ctrls=NULL;
+
+ slapi_pblock_get (pb, SLAPI_OPERATION, &op);
+ if (NULL == op) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, CB_PLUGIN_SUBSYSTEM, "No operation is set.\n");
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
/* Loop detection */
- slapi_pblock_get( pb, SLAPI_REQCONTROLS, &ctrls );
+ slapi_pblock_get( pb, SLAPI_REQCONTROLS, &ctrls );
if ( NULL != ctrls ) {
struct berval *ctl_value=NULL;
commit 6cb6ef1308e1676cf132e312a45eef3716150dff
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 15:13:05 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13068 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_ldif2ldbm_deluxe in import.c
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 45ea68a..0694b62 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1596,15 +1596,12 @@ int ldbm_back_ldif2ldbm_deluxe(Slapi_PBlock *pb)
int up_flags = 0;
PRThread *thread = NULL;
- job = CALLOC(ImportJob);
- if (job == NULL) {
- LDAPDebug(LDAP_DEBUG_ANY, "not enough memory to do import job\n",
- 0, 0, 0);
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm_back_ldif2ldbm_deluxe: backend is not set\n");
return -1;
}
-
- slapi_pblock_get( pb, SLAPI_BACKEND, &be);
- PR_ASSERT(NULL != be);
+ job = CALLOC(ImportJob);
job->inst = (ldbm_instance *)be->be_instance_info;
slapi_pblock_get( pb, SLAPI_LDIF2DB_NOATTRINDEXES, &noattrindexes );
slapi_pblock_get( pb, SLAPI_LDIF2DB_FILE, &name_array );
commit bb5b5be69acf72429e824e304c5b39c16764f8d1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 13:21:54 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13069 - Resource leak
Description: If attrcrypt_crypto_op_values fails, the output Slapi_
Value array is cleaned up internally. The caller need not to free it.
modified: attrcrypt_crypto_op_values in ldbm_attrcrypt.c
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
index 41856d5..29bbbde 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
@@ -783,8 +783,11 @@ attrcrypt_crypto_op_values(attrcrypt_private *priv, backend *be, struct attrinf
Slapi_Value *encrypted_value = NULL;
ret = attrcrypt_crypto_op_value(priv,be,ai,invalues[i],&encrypted_value,encrypt);
- if (0 == ret) {
- encrypted_values[i] = encrypted_value;
+ if (ret) { /* If failed even once, free the entire Slapi_Value */
+ valuearray_free(&encrypted_values); /* encrypted_values is set to NULL */
+ break;
+ } else {
+ encrypted_values[i] = encrypted_value;
}
}
*outvalues = encrypted_values;
commit 6be713c0efe4a100cd86150b53c9edc5b0ac875d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 13:06:50 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13070 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for sdn.
modified: chaining_back_modify in cb_modify.c
diff --git a/ldap/servers/plugins/chainingdb/cb_modify.c b/ldap/servers/plugins/chainingdb/cb_modify.c
index db8a43c..4e28121 100644
--- a/ldap/servers/plugins/chainingdb/cb_modify.c
+++ b/ldap/servers/plugins/chainingdb/cb_modify.c
@@ -86,6 +86,10 @@ chaining_back_modify ( Slapi_PBlock *pb )
}
slapi_pblock_get( pb, SLAPI_MODIFY_TARGET_SDN, &sdn );
+ if (NULL == sdn) {
+ cb_send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX, NULL, "Null target DN", 0, NULL );
+ return -1;
+ }
dn = slapi_sdn_get_dn(sdn);
if (cb_debug_on()) {
commit c097f15b940d4192bc05f1b43cdca35697f96fd3
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:58:57 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13071 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for mrINDEX.
modified: matchrule_values_to_keys in matchrule.c
diff --git a/ldap/servers/slapd/back-ldbm/matchrule.c b/ldap/servers/slapd/back-ldbm/matchrule.c
index 7af42f4..6de6461 100644
--- a/ldap/servers/slapd/back-ldbm/matchrule.c
+++ b/ldap/servers/slapd/back-ldbm/matchrule.c
@@ -155,9 +155,13 @@ matchrule_values_to_keys(Slapi_PBlock *pb,struct berval **input_values,struct be
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_INDEX_FN, &mrINDEX);
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_VALUES, input_values);
- mrINDEX (pb);
- slapi_pblock_get (pb, SLAPI_PLUGIN_MR_KEYS, output_values);
- return 0;
+ if (mrINDEX) {
+ mrINDEX (pb);
+ slapi_pblock_get (pb, SLAPI_PLUGIN_MR_KEYS, output_values);
+ return LDAP_SUCCESS;
+ } else {
+ return LDAP_OPERATIONS_ERROR;
+ }
}
/*
commit d1574aa713ead993f224609cec135f4bc8ff716e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:49:07 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13072 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for ent.
modified: deref_pre_entry in deref.c
diff --git a/ldap/servers/plugins/deref/deref.c b/ldap/servers/plugins/deref/deref.c
index 1bab0ab..e271b01 100644
--- a/ldap/servers/plugins/deref/deref.c
+++ b/ldap/servers/plugins/deref/deref.c
@@ -724,7 +724,7 @@ deref_pre_entry(Slapi_PBlock *pb)
ber_printf(ctrlber, "{"); /* begin control value */
slapi_pblock_get(pb, SLAPI_SEARCH_ENTRY_ORIG, &ent);
- for (spec = deref_get_first_spec(speclist, &ii); spec;
+ for (spec = deref_get_first_spec(speclist, &ii); ent && spec;
spec = deref_get_next_spec(speclist, &ii)) {
Slapi_Value *sv;
int idx = 0;
commit 3bf2d596dec57d3ba1496bc1c45bb9d1fc1f815f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:33:38 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13074 - Dereference after null check (FORWARD_NULL)
Description: Added NULL check for entry. If NULL, continue the loop.
modified: write_replog_db in retrocl_po.c
diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c
index 4b2cdda..9128fef 100644
--- a/ldap/servers/plugins/retrocl/retrocl_po.c
+++ b/ldap/servers/plugins/retrocl/retrocl_po.c
@@ -231,7 +231,7 @@ write_replog_db(
if ( entry == NULL ) {
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &entry );
}
-
+ if ( entry == NULL ) continue;
uniqueId = slapi_entry_get_uniqueid( entry );
slapi_log_error( SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME,
commit fc0036e2d35e189c2a34f4722fbebda548cf94b9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Feb 27 15:02:42 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and opid are
used in the accesslog.
Also, NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
modified: acl_access_allowed & print_access_control_summary in acl.c
slapi-plugin.h
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index f04e258..cd307d9 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -257,12 +257,17 @@ acl_access_allowed(
Slapi_Operation *op = NULL;
aclResultReason_t decision_reason;
int loglevel;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
slapi_pblock_get(pb, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
- TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","",
- tnf_int,access,access);
+ TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","", tnf_int,access,access);
decision_reason.deciding_aci = NULL;
decision_reason.reason = ACL_REASON_NONE;
@@ -301,8 +306,8 @@ acl_access_allowed(
if ( !privateBackend && (be_readonly || slapi_config_get_readonly () )){
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Deny %s on entry(%s)"
- ": readonly backend\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": readonly backend\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return LDAP_UNWILLING_TO_PERFORM;
@@ -314,8 +319,8 @@ acl_access_allowed(
if ( acl_skip_access_check ( pb, e )) {
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Allow %s on entry(%s)"
- ": root user\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": root user\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return(LDAP_SUCCESS);
@@ -466,7 +471,7 @@ acl_access_allowed(
slapi_log_error(loglevel, plugin_name,
"#### conn=%" NSPRIu64 " op=%d binddn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid, clientDn);
+ o_connid, o_opid, clientDn);
aclpb->aclpb_stat_total_entries++;
if (!(access & SLAPI_ACL_PROXY) &&
@@ -711,6 +716,8 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
Slapi_Operation *op = NULL;
int loglevel;
int i;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
@@ -724,6 +731,10 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
}
slapi_pblock_get(aclpb->aclpb_pblock, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
if (ret_val == LDAP_INSUFFICIENT_ACCESS) {
access_status = access_not_allowed_string;
@@ -789,7 +800,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -803,7 +814,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -818,7 +829,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -832,7 +843,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -847,7 +858,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -861,7 +872,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index bc68157..3a1203a 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -89,8 +89,13 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
/* NSPR uses the print macros a bit differently than ANSI C. We
* need to use ll for a 64-bit integer, even when a long is 64-bit.
*/
+#if defined(HAVE_LONG_LONG) && PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
+#define NSPRIu64 "lu"
+#define NSPRI64 "l"
+#else /* just assume long long is used */
#define NSPRIu64 "llu"
#define NSPRI64 "ll"
+#endif
/* OpenLDAP uses unsigned long for ber_tag_t and ber_len_t but mozldap uses unsigned int */
/* use this macro for printf statements for ber_tag_t and ber_len_t */
commit 7039bca37ebfe565ff3f3a1077d3a70e35061986
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 12:02:27 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13076 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for opertion.
modified: legacy_preop in replication/repl_ops.c
diff --git a/ldap/servers/plugins/replication/repl_ops.c b/ldap/servers/plugins/replication/repl_ops.c
index 6cafc2d..89c20a1 100644
--- a/ldap/servers/plugins/replication/repl_ops.c
+++ b/ldap/servers/plugins/replication/repl_ops.c
@@ -99,15 +99,22 @@ legacy_preop(Slapi_PBlock *pb, const char *caller, int operation_type)
Slapi_Operation *operation = NULL;
consumer_operation_extension *opext = NULL;
int has_cf = 0;
- Object *r_obj;
- Replica *r;
+ Object *r_obj;
+ Replica *r;
int is_legacy_op = 0;
slapi_pblock_get( pb, SLAPI_OPERATION, &operation );
+ if (NULL == operation) {
+ slapi_send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL,
+ "Null replication operation is given", 0, NULL);
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Null replication operation is given\n");
+ return -1;
+ }
is_legacy_op = operation_is_flag_set(operation,OP_FLAG_LEGACY_REPLICATION_DN);
- r_obj = replica_get_replica_for_op (pb);
+ r_obj = replica_get_replica_for_op (pb);
- if (r_obj == NULL) { /* there is no replica configured for this operations */
+ if (r_obj == NULL) { /* there is no replica configured for this operations */
if (is_legacy_op){
/* This is a legacy replication operation but there are NO replica defined
Just refuse it */
commit 94d4b10ea12e063e78c03ef64ba5c8cfb71286e1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:27:46 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13078 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for conn. If NULL, let sync_send_
results abort there. Also, added "return" if sync_acquire_connection
returns non success as advertised as "aborted" in the error message.
modified: sync_send_results in plugins/sync/sync_persist.c
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
index f41a10c..4bd7da8 100644
--- a/ldap/servers/plugins/sync/sync_persist.c
+++ b/ldap/servers/plugins/sync/sync_persist.c
@@ -575,12 +575,18 @@ sync_send_results( void *arg )
slapi_pblock_get(req->req_pblock, SLAPI_CONN_ID, &connid);
slapi_pblock_get(req->req_pblock, SLAPI_OPERATION_ID, &opid);
slapi_pblock_get(req->req_pblock, SLAPI_CONNECTION, &conn);
-
+ if (NULL == conn) {
+ slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
+ "conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
+ (long long unsigned int)connid, opid);
+ return;
+ }
conn_acq_flag = sync_acquire_connection (conn);
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_FATAL, "Content Synchronization Search",
"conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
(long long unsigned int)connid, opid);
+ return;
}
PR_Lock( sync_request_list->sync_req_cvarlock );
commit a10a1de9f1b9510c12356f1608819fbe8d76fa35
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:17:36 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13079 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for ctx
modified: chainingdb_prev_search_results in plugins/chainingdb/cb_search.c
diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c
index 9aecd26..e763cf5 100644
--- a/ldap/servers/plugins/chainingdb/cb_search.c
+++ b/ldap/servers/plugins/chainingdb/cb_search.c
@@ -792,6 +792,8 @@ chainingdb_prev_search_results ( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &ctx );
slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_ENTRY, &entry );
- ctx->readahead = entry;
+ if (ctx) {
+ ctx->readahead = entry;
+ }
return;
}
commit 5ce33c406aa22ef13701dee508744bfdf23c6d4a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:14:13 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13080 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for attrs.
modified: ldbm_back_ldbm2index in slapd/back-ldbm/ldif2ldbm.c
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 523da09..51fa8e0 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1811,7 +1811,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
struct attrinfo *ai = NULL;
slapi_pblock_get(pb, SLAPI_DB2INDEX_ATTRS, &attrs);
- for (i = 0; attrs[i] != NULL; i++) {
+ for (i = 0; attrs && attrs[i]; i++) {
if ( g_get_shutdown() || c_get_shutdown() ) {
goto err_out;
}
8 years, 7 months
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/uiduniq/uid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1aeaf342ff5050cfda23e05ae66b180a56a70e0e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 24 11:00:30 2015 -0800
Ticket #48026 - Support for uniqueness plugin to enforce uniqueness on a set of attributes.
Coverity defect 13088 - Wrong sized argument
Introduced by commit 430410d75446cdf58e6f020e1463b590abd870ab
Description: allocated the size of pointer instead of the size of
character times attribute length. The unit was fixed.
https://fedorahosted.org/389/ticket/48026
Reviewed and tested by William B <william.e.brown(a)adelaide.edu.au>.
Thank you, William!!
diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c
index 282f618..b9c4e72 100644
--- a/ldap/servers/plugins/uiduniq/uid.c
+++ b/ldap/servers/plugins/uiduniq/uid.c
@@ -367,7 +367,7 @@ uniqueness_entry_to_config(Slapi_PBlock *pb, Slapi_Entry *config_entry)
for (i = 0; tmp_config->attrs && (tmp_config->attrs)[i]; i++) {
attrLen += strlen((tmp_config->attrs)[i]) + 1;
}
- tmp_config->attr_friendly = (char *) slapi_ch_calloc(attrLen, sizeof(char *));
+ tmp_config->attr_friendly = (char *) slapi_ch_calloc(attrLen, sizeof(char));
fp = tmp_config->attr_friendly;
for (i = 0; tmp_config->attrs && (tmp_config->attrs)[i]; i++) {
strcpy(fp, (tmp_config->attrs)[i] );
8 years, 7 months
Branch '389-ds-base-1.3.3' - rpm/389-ds-base.spec.in
by Noriko Hosoi
rpm/389-ds-base.spec.in | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
New commits:
commit 79a889882ae6ec57dbc2ffa5aeeac648ca045ec3
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 18:39:45 2015 -0800
Ticket #48030 - spec file should run "systemctl stop" against each running instance instead of dirsrv.target
A patch was provided by lkrispen(a)redhat.com (Thank you, Ludwig!!)
https://fedorahosted.org/389/ticket/48030
(cherry picked from commit 24c303d3e6c91358fc645268d582144f377e3902)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index af9244a..17a1f86 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -227,35 +227,44 @@ ninst=0 # number of instances found in total
if [ -n "$DEBUGPOSTTRANS" ] ; then
output=$DEBUGPOSTTRANS
fi
-echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || :
+echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* >> $output 2>&1 || :
for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do
if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'`
- echo found instance $inst - getting status > $output 2>&1 || :
+ echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
- echo instance $inst is running > $output 2>&1 || :
+ echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
else
- echo instance $inst is not running > $output 2>&1 || :
+ echo instance $inst is not running >> $output 2>&1 || :
fi
ninst=`expr $ninst + 1`
done
if [ $ninst -eq 0 ] ; then
- echo no instances to upgrade > $output 2>&1 || :
+ echo no instances to upgrade >> $output 2>&1 || :
exit 0 # have no instances to upgrade - just skip the rest
fi
# shutdown all instances
-echo shutting down all instances . . . > $output 2>&1 || :
-/bin/systemctl stop %{groupname} > $output 2>&1 || :
-echo remove pid files . . . > $output 2>&1 || :
+echo shutting down all instances . . . >> $output 2>&1 || :
+for inst in $instances ; do
+ echo stopping instance $inst >> $output 2>&1 || :
+ /bin/systemctl stop $inst >> $output 2>&1 || :
+done
+echo remove pid files . . . >> $output 2>&1 || :
/bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid
# do the upgrade
-echo upgrading instances . . . > $output 2>&1 || :
-%{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || :
+echo upgrading instances . . . >> $output 2>&1 || :
+DEBUGPOSTSETUPOPT=`/usr/bin/echo $DEBUGPOSTSETUP | /usr/bin/sed -e "s/[^d]//g"`
+if [ -n "$DEBUGPOSTSETUPOPT" ] ; then
+ %{_sbindir}/setup-ds.pl -l $output -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
+else
+ %{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline >> $output 2>&1 || :
+fi
+
# restart instances that require it
for inst in $instances ; do
- echo restarting instance $inst > $output 2>&1 || :
- /bin/systemctl start $inst > $output 2>&1 || :
+ echo restarting instance $inst >> $output 2>&1 || :
+ /bin/systemctl start $inst >> $output 2>&1 || :
done
exit 0
@@ -316,6 +325,10 @@ fi
%{_libdir}/%{pkgname}/libns-dshttpd.so*
%changelog
+* Wed Feb 25 2015 Noriko Hosoi <nhosoi(a)redhat.com> - 1.3.3.8-2
+- Ticket 48030 - DNS errors after IPA upgrade due to broken ReplSync
+ Fixes spec file to make sure all the server instances are stopped before upgrade
+
* Sat Jun 15 2013 Noriko Hosoi <nhosoi(a)redhat.com> - 1.3.1.2-1
- bump version to 1.3.1.2
- Ticket 47391 - deleting and adding userpassword fails to update the password
8 years, 7 months
rpm/389-ds-base.spec.in
by Noriko Hosoi
rpm/389-ds-base.spec.in | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
New commits:
commit 24c303d3e6c91358fc645268d582144f377e3902
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 25 18:39:45 2015 -0800
Ticket #48030 - spec file should run "systemctl stop" against each running instance instead of dirsrv.target
A patch was provided by lkrispen(a)redhat.com (Thank you, Ludwig!!)
https://fedorahosted.org/389/ticket/48030
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index af9244a..17a1f86 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -227,35 +227,44 @@ ninst=0 # number of instances found in total
if [ -n "$DEBUGPOSTTRANS" ] ; then
output=$DEBUGPOSTTRANS
fi
-echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || :
+echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* >> $output 2>&1 || :
for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do
if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'`
- echo found instance $inst - getting status > $output 2>&1 || :
+ echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
- echo instance $inst is running > $output 2>&1 || :
+ echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
else
- echo instance $inst is not running > $output 2>&1 || :
+ echo instance $inst is not running >> $output 2>&1 || :
fi
ninst=`expr $ninst + 1`
done
if [ $ninst -eq 0 ] ; then
- echo no instances to upgrade > $output 2>&1 || :
+ echo no instances to upgrade >> $output 2>&1 || :
exit 0 # have no instances to upgrade - just skip the rest
fi
# shutdown all instances
-echo shutting down all instances . . . > $output 2>&1 || :
-/bin/systemctl stop %{groupname} > $output 2>&1 || :
-echo remove pid files . . . > $output 2>&1 || :
+echo shutting down all instances . . . >> $output 2>&1 || :
+for inst in $instances ; do
+ echo stopping instance $inst >> $output 2>&1 || :
+ /bin/systemctl stop $inst >> $output 2>&1 || :
+done
+echo remove pid files . . . >> $output 2>&1 || :
/bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid
# do the upgrade
-echo upgrading instances . . . > $output 2>&1 || :
-%{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || :
+echo upgrading instances . . . >> $output 2>&1 || :
+DEBUGPOSTSETUPOPT=`/usr/bin/echo $DEBUGPOSTSETUP | /usr/bin/sed -e "s/[^d]//g"`
+if [ -n "$DEBUGPOSTSETUPOPT" ] ; then
+ %{_sbindir}/setup-ds.pl -l $output -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
+else
+ %{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline >> $output 2>&1 || :
+fi
+
# restart instances that require it
for inst in $instances ; do
- echo restarting instance $inst > $output 2>&1 || :
- /bin/systemctl start $inst > $output 2>&1 || :
+ echo restarting instance $inst >> $output 2>&1 || :
+ /bin/systemctl start $inst >> $output 2>&1 || :
done
exit 0
@@ -316,6 +325,10 @@ fi
%{_libdir}/%{pkgname}/libns-dshttpd.so*
%changelog
+* Wed Feb 25 2015 Noriko Hosoi <nhosoi(a)redhat.com> - 1.3.3.8-2
+- Ticket 48030 - DNS errors after IPA upgrade due to broken ReplSync
+ Fixes spec file to make sure all the server instances are stopped before upgrade
+
* Sat Jun 15 2013 Noriko Hosoi <nhosoi(a)redhat.com> - 1.3.1.2-1
- bump version to 1.3.1.2
- Ticket 47391 - deleting and adding userpassword fails to update the password
8 years, 7 months
Branch '389-ds-base-1.3.3' - dirsrvtests/tickets ldap/schema ldap/servers
by thierry bordaz
dirsrvtests/tickets/ticket47828_test.py | 721 ++++++++++++++++++++++++++++++++
ldap/schema/10dna-plugin.ldif | 8
ldap/servers/plugins/dna/dna.c | 73 +++
3 files changed, 801 insertions(+), 1 deletion(-)
New commits:
commit 74834a2e5e0b85cf4f1e085d963a9e4cbacfc6fb
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Sep 1 11:30:05 2014 +0200
Ticket 47828: DNA scope: allow to exlude some subtrees
Bug Description:
DNA plugin generates attributes values to any added entry
in the scope of the plugin (and filter).
For ULC (http://www.freeipa.org/page/V3/User_Life-Cycle_Management),
the provisioning container must be excluded.
Fix Description:
Add the ability to define multivalued attribute: "dnaExcludeScope"
in the config entry.
DNA will not generate attributes values for entries added
under one of the excluded DIT
http://fedorahosted.org/389/ticket/47828ticket URL>
Platforms tested: F17/F20
Reviewed by : Noriko (many thanks)
Flag Day: no
Doc impact: yes (adding a config attribute)
diff --git a/dirsrvtests/tickets/ticket47828_test.py b/dirsrvtests/tickets/ticket47828_test.py
new file mode 100644
index 0000000..b9fb288
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47828_test.py
@@ -0,0 +1,721 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import pytest
+import shutil
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY
+ACCT_POLICY_DN = 'cn=Account Inactivation Pplicy,%s' % SUFFIX
+INACTIVITY_LIMIT = '9'
+SEARCHFILTER = '(objectclass=*)'
+
+DUMMY_CONTAINER = 'cn=dummy container,%s' % SUFFIX
+PROVISIONING = 'cn=provisioning,%s' % SUFFIX
+ACTIVE_USER1_CN = 'active user1'
+ACTIVE_USER1_DN = 'cn=%s,%s' % (ACTIVE_USER1_CN, SUFFIX)
+STAGED_USER1_CN = 'staged user1'
+STAGED_USER1_DN = 'cn=%s,%s' % (STAGED_USER1_CN, PROVISIONING)
+DUMMY_USER1_CN = 'dummy user1'
+DUMMY_USER1_DN = 'cn=%s,%s' % (DUMMY_USER1_CN, DUMMY_CONTAINER)
+
+ALLOCATED_ATTR = 'employeeNumber'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ try:
+ standalone.start(timeout=10)
+ except ldap.SERVER_DOWN:
+ pass
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def test_ticket47828_init(topology):
+ """
+ Enable DNA
+ """
+ topology.standalone.plugins.enable(name=PLUGIN_DNA)
+
+ topology.standalone.add_s(Entry((PROVISIONING,{'objectclass': "top nscontainer".split(),
+ 'cn': 'provisioning'})))
+ topology.standalone.add_s(Entry((DUMMY_CONTAINER,{'objectclass': "top nscontainer".split(),
+ 'cn': 'dummy container'})))
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ topology.standalone.add_s(Entry((dn_config, {'objectclass': "top extensibleObject".split(),
+ 'cn': 'excluded scope',
+ 'dnaType': ALLOCATED_ATTR,
+ 'dnaNextValue': str(1000),
+ 'dnaMaxValue': str(2000),
+ 'dnaMagicRegen': str(-1),
+ 'dnaFilter': '(&(objectClass=person)(objectClass=organizationalPerson)(objectClass=inetOrgPerson))',
+ 'dnaScope': SUFFIX})))
+ topology.standalone.restart(timeout=10)
+
+
+
+def test_ticket47828_run_0(topology):
+ """
+ NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_1(topology):
+ """
+ NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_2(topology):
+ """
+ NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_3(topology):
+ """
+ NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_4(topology):
+ '''
+ Exclude the provisioning container
+ '''
+ _header(topology, 'Exclude the provisioning container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
+ topology.standalone.modify_s(dn_config, mod)
+
+def test_ticket47828_run_5(topology):
+ """
+ Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_6(topology):
+ """
+ Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_7(topology):
+ """
+ Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_8(topology):
+ """
+ Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_9(topology):
+ """
+ Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_10(topology):
+ """
+ Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_11(topology):
+ '''
+ Exclude (in addition) the dummy container
+ '''
+ _header(topology, 'Exclude (in addition) the dummy container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_ADD, 'dnaExcludeScope', DUMMY_CONTAINER)]
+ topology.standalone.modify_s(dn_config, mod)
+
+def test_ticket47828_run_12(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_13(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_14(topology):
+ """
+ Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_15(topology):
+ """
+ Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_16(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR not is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_17(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+
+def test_ticket47828_run_18(topology):
+ '''
+ Exclude PROVISIONING and a wrong container
+ '''
+ _header(topology, 'Exclude PROVISIONING and a wrong container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
+ topology.standalone.modify_s(dn_config, mod)
+ try:
+ mod = [(ldap.MOD_ADD, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]
+ topology.standalone.modify_s(dn_config, mod)
+ raise ValueError("invalid dnaExcludeScope value (not a DN)")
+ except ldap.INVALID_SYNTAX:
+ pass
+
+def test_ticket47828_run_19(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_20(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_21(topology):
+ """
+ Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_22(topology):
+ """
+ Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_23(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_24(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_25(topology):
+ '''
+ Exclude a wrong container
+ '''
+ _header(topology, 'Exclude a wrong container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+
+ try:
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]
+ topology.standalone.modify_s(dn_config, mod)
+ raise ValueError("invalid dnaExcludeScope value (not a DN)")
+ except ldap.INVALID_SYNTAX:
+ pass
+
+def test_ticket47828_run_26(topology):
+ """
+ Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_27(topology):
+ """
+ Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_28(topology):
+ """
+ Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_29(topology):
+ """
+ Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_30(topology):
+ """
+ Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_31(topology):
+ """
+ Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_final(topology):
+ topology.standalone.plugins.disable(name=PLUGIN_DNA)
+ topology.standalone.stop(timeout=10)
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47828_init(topo)
+
+ test_ticket47828_run_0(topo)
+ test_ticket47828_run_1(topo)
+ test_ticket47828_run_2(topo)
+ test_ticket47828_run_3(topo)
+ test_ticket47828_run_4(topo)
+ test_ticket47828_run_5(topo)
+ test_ticket47828_run_6(topo)
+ test_ticket47828_run_7(topo)
+ test_ticket47828_run_8(topo)
+ test_ticket47828_run_9(topo)
+ test_ticket47828_run_10(topo)
+ test_ticket47828_run_11(topo)
+ test_ticket47828_run_12(topo)
+ test_ticket47828_run_13(topo)
+ test_ticket47828_run_14(topo)
+ test_ticket47828_run_15(topo)
+ test_ticket47828_run_16(topo)
+ test_ticket47828_run_17(topo)
+ test_ticket47828_run_18(topo)
+ test_ticket47828_run_19(topo)
+ test_ticket47828_run_20(topo)
+ test_ticket47828_run_21(topo)
+ test_ticket47828_run_22(topo)
+ test_ticket47828_run_23(topo)
+ test_ticket47828_run_24(topo)
+ test_ticket47828_run_25(topo)
+ test_ticket47828_run_26(topo)
+ test_ticket47828_run_27(topo)
+ test_ticket47828_run_28(topo)
+ test_ticket47828_run_29(topo)
+ test_ticket47828_run_30(topo)
+ test_ticket47828_run_31(topo)
+
+ test_ticket47828_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
diff --git a/ldap/schema/10dna-plugin.ldif b/ldap/schema/10dna-plugin.ldif
index 74f5f8b..3143904 100644
--- a/ldap/schema/10dna-plugin.ldif
+++ b/ldap/schema/10dna-plugin.ldif
@@ -202,6 +202,13 @@ attributeTypes: ( 2.16.840.1.113730.3.1.2160 NAME 'dnaRemoteBindMethod'
#
################################################################################
#
+attributeTypes: ( 2.16.840.1.113730.3.1.2312 NAME 'dnaExcludeScope'
+ DESC 'DN of a subtree excluded from DNA plugin scope'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
+ X-ORIGIN '389 Directory Server' )
+#
+################################################################################
+#
objectClasses: ( 2.16.840.1.113730.3.2.324 NAME 'dnaPluginConfig'
DESC 'DNA plugin configuration'
SUP top
@@ -214,6 +221,7 @@ objectClasses: ( 2.16.840.1.113730.3.2.324 NAME 'dnaPluginConfig'
dnaMagicRegen $
dnaFilter $
dnaScope $
+ dnaExcludeScope $
dnaSharedCfgDN $
dnaThreshold $
dnaNextRange $
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index f4a36f0..25123cb 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -87,6 +87,7 @@
#define DNA_GENERATE "dnaMagicRegen"
#define DNA_FILTER "dnaFilter"
#define DNA_SCOPE "dnaScope"
+#define DNA_EXCLUDE_SCOPE "dnaExcludeScope"
#define DNA_REMOTE_BIND_DN "dnaRemoteBindDN"
#define DNA_REMOTE_BIND_PW "dnaRemoteBindCred"
@@ -164,6 +165,7 @@ struct configEntry {
Slapi_Filter *slapi_filter;
char *generate;
char *scope;
+ Slapi_DN **excludescope;
PRUint64 interval;
PRUint64 threshold;
char *shared_cfg_base;
@@ -356,6 +358,17 @@ dna_config_copy()
new_entry->slapi_filter = slapi_filter_dup(config_entry->slapi_filter);
new_entry->generate = slapi_ch_strdup(config_entry->generate);
new_entry->scope = slapi_ch_strdup(config_entry->scope);
+ if (config_entry->excludescope == NULL) {
+ new_entry->excludescope = NULL;
+ } else {
+ int i;
+
+ for (i = 0; config_entry->excludescope[i]; i++);
+ new_entry->excludescope = (Slapi_DN **) slapi_ch_calloc(sizeof (Slapi_DN *), i + 1);
+ for (i = 0; new_entry->excludescope[i]; i++) {
+ new_entry->excludescope[i] = slapi_sdn_dup(config_entry->excludescope[i]);
+ }
+ }
new_entry->shared_cfg_base = slapi_ch_strdup(config_entry->shared_cfg_base);
new_entry->shared_cfg_dn = slapi_ch_strdup(config_entry->shared_cfg_dn);
new_entry->remote_binddn = slapi_ch_strdup(config_entry->remote_binddn);
@@ -906,6 +919,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
int entry_added = 0;
int i = 0;
int ret = DNA_SUCCESS;
+ char **plugin_attr_values;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"--> dna_parse_config_entry\n");
@@ -1056,6 +1070,31 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%s]\n", DNA_SCOPE, entry->scope);
+
+ plugin_attr_values = slapi_entry_attr_get_charray(e, DNA_EXCLUDE_SCOPE);
+ if (plugin_attr_values) {
+ int j = 0;
+
+ /* Allocate the array of excluded scopes */
+ for (i = 0; plugin_attr_values[i]; i++);
+ entry->excludescope = (Slapi_DN **) slapi_ch_calloc(sizeof (Slapi_DN *), i + 1);
+
+ /* Copy them in the config at the condition they are valid DN */
+ for (i = 0; plugin_attr_values[i]; i++) {
+ if (slapi_dn_syntax_check(NULL, plugin_attr_values[i], 1) == 1) {
+ slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
+ "Error: Ignoring invalid DN used as excluded scope: [%s]\n", plugin_attr_values[i]);
+ slapi_ch_free_string(&plugin_attr_values[i]);
+ } else {
+ entry->excludescope[j++] = slapi_sdn_new_dn_passin(plugin_attr_values[i]);
+ }
+ }
+ slapi_ch_free((void**) &plugin_attr_values);
+ }
+ for (i = 0; entry->excludescope && entry->excludescope[i]; i++) {
+ slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
+ "----------> %s[%d] [%s]\n", DNA_EXCLUDE_SCOPE, i, slapi_sdn_get_dn(entry->excludescope[i]));
+ }
/* optional, if not specified set -1 which is converted to the max unsigned
* value */
@@ -1381,6 +1420,14 @@ dna_free_config_entry(struct configEntry ** entry)
slapi_filter_free(e->slapi_filter, 1);
slapi_ch_free_string(&e->generate);
slapi_ch_free_string(&e->scope);
+ if (e->excludescope) {
+ int i;
+
+ for (i = 0; e->excludescope[i]; i++) {
+ slapi_sdn_free(&e->excludescope[i]);
+ }
+ slapi_ch_free((void **)&e->excludescope);
+ }
slapi_ch_free_string(&e->shared_cfg_base);
slapi_ch_free_string(&e->shared_cfg_dn);
slapi_ch_free_string(&e->remote_binddn);
@@ -3311,6 +3358,13 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
goto next;
}
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
ret = slapi_vattr_filter_test(pb, e, config_entry->slapi_filter, 0);
@@ -3509,7 +3563,14 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods, char **e
!slapi_dn_issuffix(dn, config_entry->scope)) {
goto next;
}
-
+
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
ret = slapi_vattr_filter_test(pb, e,
@@ -3955,6 +4016,13 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
goto next;
}
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
if(LDAP_SUCCESS != slapi_vattr_filter_test(pb,e,config_entry->slapi_filter, 0))
@@ -4562,6 +4630,9 @@ void dna_dump_config_entry(struct configEntry * entry)
printf("<---- filter ---------> %s\n", entry->filter);
printf("<---- prefix ---------> %s\n", entry->prefix);
printf("<---- scope ----------> %s\n", entry->scope);
+ for (i = 0; entry->excludescope && entry->excludescope[i]; i++) {
+ printf("<---- excluded scope -> %s\n", slapi_sdn_get_dn(entry->excludescope[i]));
+ }
printf("<---- next value -----> %" PRIu64 "\n", entry->nextval);
printf("<---- max value ------> %" PRIu64 "\n", entry->maxval);
printf("<---- interval -------> %" PRIu64 "\n", entry->interval);
8 years, 7 months
dirsrvtests/tickets ldap/schema ldap/servers
by thierry bordaz
dirsrvtests/tickets/ticket47828_test.py | 721 ++++++++++++++++++++++++++++++++
ldap/schema/10dna-plugin.ldif | 8
ldap/servers/plugins/dna/dna.c | 73 +++
3 files changed, 801 insertions(+), 1 deletion(-)
New commits:
commit b43e899454351274065ecf76cdf31ae2a84645bf
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Sep 1 11:30:05 2014 +0200
Ticket 47828: DNA scope: allow to exlude some subtrees
Bug Description:
DNA plugin generates attributes values to any added entry
in the scope of the plugin (and filter).
For ULC (http://www.freeipa.org/page/V3/User_Life-Cycle_Management),
the provisioning container must be excluded.
Fix Description:
Add the ability to define multivalued attribute: "dnaExcludeScope"
in the config entry.
DNA will not generate attributes values for entries added
under one of the excluded DIT
http://fedorahosted.org/389/ticket/47828ticket URL>
Platforms tested: F17/F20
Reviewed by : Noriko (many thanks)
Flag Day: no
Doc impact: yes (adding a config attribute)
diff --git a/dirsrvtests/tickets/ticket47828_test.py b/dirsrvtests/tickets/ticket47828_test.py
new file mode 100644
index 0000000..b9fb288
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47828_test.py
@@ -0,0 +1,721 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import pytest
+import shutil
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+ACCT_POLICY_CONFIG_DN = 'cn=config,cn=%s,cn=plugins,cn=config' % PLUGIN_ACCT_POLICY
+ACCT_POLICY_DN = 'cn=Account Inactivation Pplicy,%s' % SUFFIX
+INACTIVITY_LIMIT = '9'
+SEARCHFILTER = '(objectclass=*)'
+
+DUMMY_CONTAINER = 'cn=dummy container,%s' % SUFFIX
+PROVISIONING = 'cn=provisioning,%s' % SUFFIX
+ACTIVE_USER1_CN = 'active user1'
+ACTIVE_USER1_DN = 'cn=%s,%s' % (ACTIVE_USER1_CN, SUFFIX)
+STAGED_USER1_CN = 'staged user1'
+STAGED_USER1_DN = 'cn=%s,%s' % (STAGED_USER1_CN, PROVISIONING)
+DUMMY_USER1_CN = 'dummy user1'
+DUMMY_USER1_DN = 'cn=%s,%s' % (DUMMY_USER1_CN, DUMMY_CONTAINER)
+
+ALLOCATED_ATTR = 'employeeNumber'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ try:
+ standalone.start(timeout=10)
+ except ldap.SERVER_DOWN:
+ pass
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def test_ticket47828_init(topology):
+ """
+ Enable DNA
+ """
+ topology.standalone.plugins.enable(name=PLUGIN_DNA)
+
+ topology.standalone.add_s(Entry((PROVISIONING,{'objectclass': "top nscontainer".split(),
+ 'cn': 'provisioning'})))
+ topology.standalone.add_s(Entry((DUMMY_CONTAINER,{'objectclass': "top nscontainer".split(),
+ 'cn': 'dummy container'})))
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ topology.standalone.add_s(Entry((dn_config, {'objectclass': "top extensibleObject".split(),
+ 'cn': 'excluded scope',
+ 'dnaType': ALLOCATED_ATTR,
+ 'dnaNextValue': str(1000),
+ 'dnaMaxValue': str(2000),
+ 'dnaMagicRegen': str(-1),
+ 'dnaFilter': '(&(objectClass=person)(objectClass=organizationalPerson)(objectClass=inetOrgPerson))',
+ 'dnaScope': SUFFIX})))
+ topology.standalone.restart(timeout=10)
+
+
+
+def test_ticket47828_run_0(topology):
+ """
+ NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_1(topology):
+ """
+ NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'NO exclude scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_2(topology):
+ """
+ NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_3(topology):
+ """
+ NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'NO exclude scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_4(topology):
+ '''
+ Exclude the provisioning container
+ '''
+ _header(topology, 'Exclude the provisioning container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
+ topology.standalone.modify_s(dn_config, mod)
+
+def test_ticket47828_run_5(topology):
+ """
+ Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_6(topology):
+ """
+ Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_7(topology):
+ """
+ Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_8(topology):
+ """
+ Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_9(topology):
+ """
+ Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_10(topology):
+ """
+ Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_11(topology):
+ '''
+ Exclude (in addition) the dummy container
+ '''
+ _header(topology, 'Exclude (in addition) the dummy container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_ADD, 'dnaExcludeScope', DUMMY_CONTAINER)]
+ topology.standalone.modify_s(dn_config, mod)
+
+def test_ticket47828_run_12(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_13(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_14(topology):
+ """
+ Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_15(topology):
+ """
+ Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_16(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR not is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_17(topology):
+ """
+ Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning/Dummy excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+
+def test_ticket47828_run_18(topology):
+ '''
+ Exclude PROVISIONING and a wrong container
+ '''
+ _header(topology, 'Exclude PROVISIONING and a wrong container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]
+ topology.standalone.modify_s(dn_config, mod)
+ try:
+ mod = [(ldap.MOD_ADD, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]
+ topology.standalone.modify_s(dn_config, mod)
+ raise ValueError("invalid dnaExcludeScope value (not a DN)")
+ except ldap.INVALID_SYNTAX:
+ pass
+
+def test_ticket47828_run_19(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_20(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_21(topology):
+ """
+ Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_22(topology):
+ """
+ Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_23(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_24(topology):
+ """
+ Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Provisioning+wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_25(topology):
+ '''
+ Exclude a wrong container
+ '''
+ _header(topology, 'Exclude a wrong container')
+
+ dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)
+
+ try:
+ mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]
+ topology.standalone.modify_s(dn_config, mod)
+ raise ValueError("invalid dnaExcludeScope value (not a DN)")
+ except ldap.INVALID_SYNTAX:
+ pass
+
+def test_ticket47828_run_26(topology):
+ """
+ Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_27(topology):
+ """
+ Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add an active entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': ACTIVE_USER1_CN,
+ 'sn': ACTIVE_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(ACTIVE_USER1_DN)
+
+def test_ticket47828_run_28(topology):
+ """
+ Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set
+ """
+ _header(topology, 'Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is not set')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_29(topology):
+ """
+ Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add a staged entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((STAGED_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': STAGED_USER1_CN,
+ 'sn': STAGED_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(STAGED_USER1_DN)
+
+def test_ticket47828_run_30(topology):
+ """
+ Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set
+ """
+ _header(topology, 'Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is set')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(-1)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) != str(-1)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_run_31(topology):
+ """
+ Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)
+ """
+ _header(topology, 'Wrong container excluded scope: Add an dummy entry and check its ALLOCATED_ATTR is unchanged (!= magic)')
+
+ topology.standalone.add_s(Entry((DUMMY_USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': DUMMY_USER1_CN,
+ 'sn': DUMMY_USER1_CN,
+ ALLOCATED_ATTR: str(20)})))
+ ent = topology.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ assert ent.hasAttr(ALLOCATED_ATTR)
+ assert ent.getValue(ALLOCATED_ATTR) == str(20)
+ topology.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))
+ topology.standalone.delete_s(DUMMY_USER1_DN)
+
+def test_ticket47828_final(topology):
+ topology.standalone.plugins.disable(name=PLUGIN_DNA)
+ topology.standalone.stop(timeout=10)
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47828_init(topo)
+
+ test_ticket47828_run_0(topo)
+ test_ticket47828_run_1(topo)
+ test_ticket47828_run_2(topo)
+ test_ticket47828_run_3(topo)
+ test_ticket47828_run_4(topo)
+ test_ticket47828_run_5(topo)
+ test_ticket47828_run_6(topo)
+ test_ticket47828_run_7(topo)
+ test_ticket47828_run_8(topo)
+ test_ticket47828_run_9(topo)
+ test_ticket47828_run_10(topo)
+ test_ticket47828_run_11(topo)
+ test_ticket47828_run_12(topo)
+ test_ticket47828_run_13(topo)
+ test_ticket47828_run_14(topo)
+ test_ticket47828_run_15(topo)
+ test_ticket47828_run_16(topo)
+ test_ticket47828_run_17(topo)
+ test_ticket47828_run_18(topo)
+ test_ticket47828_run_19(topo)
+ test_ticket47828_run_20(topo)
+ test_ticket47828_run_21(topo)
+ test_ticket47828_run_22(topo)
+ test_ticket47828_run_23(topo)
+ test_ticket47828_run_24(topo)
+ test_ticket47828_run_25(topo)
+ test_ticket47828_run_26(topo)
+ test_ticket47828_run_27(topo)
+ test_ticket47828_run_28(topo)
+ test_ticket47828_run_29(topo)
+ test_ticket47828_run_30(topo)
+ test_ticket47828_run_31(topo)
+
+ test_ticket47828_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
diff --git a/ldap/schema/10dna-plugin.ldif b/ldap/schema/10dna-plugin.ldif
index 74f5f8b..3143904 100644
--- a/ldap/schema/10dna-plugin.ldif
+++ b/ldap/schema/10dna-plugin.ldif
@@ -202,6 +202,13 @@ attributeTypes: ( 2.16.840.1.113730.3.1.2160 NAME 'dnaRemoteBindMethod'
#
################################################################################
#
+attributeTypes: ( 2.16.840.1.113730.3.1.2312 NAME 'dnaExcludeScope'
+ DESC 'DN of a subtree excluded from DNA plugin scope'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
+ X-ORIGIN '389 Directory Server' )
+#
+################################################################################
+#
objectClasses: ( 2.16.840.1.113730.3.2.324 NAME 'dnaPluginConfig'
DESC 'DNA plugin configuration'
SUP top
@@ -214,6 +221,7 @@ objectClasses: ( 2.16.840.1.113730.3.2.324 NAME 'dnaPluginConfig'
dnaMagicRegen $
dnaFilter $
dnaScope $
+ dnaExcludeScope $
dnaSharedCfgDN $
dnaThreshold $
dnaNextRange $
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index f4a36f0..25123cb 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -87,6 +87,7 @@
#define DNA_GENERATE "dnaMagicRegen"
#define DNA_FILTER "dnaFilter"
#define DNA_SCOPE "dnaScope"
+#define DNA_EXCLUDE_SCOPE "dnaExcludeScope"
#define DNA_REMOTE_BIND_DN "dnaRemoteBindDN"
#define DNA_REMOTE_BIND_PW "dnaRemoteBindCred"
@@ -164,6 +165,7 @@ struct configEntry {
Slapi_Filter *slapi_filter;
char *generate;
char *scope;
+ Slapi_DN **excludescope;
PRUint64 interval;
PRUint64 threshold;
char *shared_cfg_base;
@@ -356,6 +358,17 @@ dna_config_copy()
new_entry->slapi_filter = slapi_filter_dup(config_entry->slapi_filter);
new_entry->generate = slapi_ch_strdup(config_entry->generate);
new_entry->scope = slapi_ch_strdup(config_entry->scope);
+ if (config_entry->excludescope == NULL) {
+ new_entry->excludescope = NULL;
+ } else {
+ int i;
+
+ for (i = 0; config_entry->excludescope[i]; i++);
+ new_entry->excludescope = (Slapi_DN **) slapi_ch_calloc(sizeof (Slapi_DN *), i + 1);
+ for (i = 0; new_entry->excludescope[i]; i++) {
+ new_entry->excludescope[i] = slapi_sdn_dup(config_entry->excludescope[i]);
+ }
+ }
new_entry->shared_cfg_base = slapi_ch_strdup(config_entry->shared_cfg_base);
new_entry->shared_cfg_dn = slapi_ch_strdup(config_entry->shared_cfg_dn);
new_entry->remote_binddn = slapi_ch_strdup(config_entry->remote_binddn);
@@ -906,6 +919,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
int entry_added = 0;
int i = 0;
int ret = DNA_SUCCESS;
+ char **plugin_attr_values;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"--> dna_parse_config_entry\n");
@@ -1056,6 +1070,31 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%s]\n", DNA_SCOPE, entry->scope);
+
+ plugin_attr_values = slapi_entry_attr_get_charray(e, DNA_EXCLUDE_SCOPE);
+ if (plugin_attr_values) {
+ int j = 0;
+
+ /* Allocate the array of excluded scopes */
+ for (i = 0; plugin_attr_values[i]; i++);
+ entry->excludescope = (Slapi_DN **) slapi_ch_calloc(sizeof (Slapi_DN *), i + 1);
+
+ /* Copy them in the config at the condition they are valid DN */
+ for (i = 0; plugin_attr_values[i]; i++) {
+ if (slapi_dn_syntax_check(NULL, plugin_attr_values[i], 1) == 1) {
+ slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
+ "Error: Ignoring invalid DN used as excluded scope: [%s]\n", plugin_attr_values[i]);
+ slapi_ch_free_string(&plugin_attr_values[i]);
+ } else {
+ entry->excludescope[j++] = slapi_sdn_new_dn_passin(plugin_attr_values[i]);
+ }
+ }
+ slapi_ch_free((void**) &plugin_attr_values);
+ }
+ for (i = 0; entry->excludescope && entry->excludescope[i]; i++) {
+ slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
+ "----------> %s[%d] [%s]\n", DNA_EXCLUDE_SCOPE, i, slapi_sdn_get_dn(entry->excludescope[i]));
+ }
/* optional, if not specified set -1 which is converted to the max unsigned
* value */
@@ -1381,6 +1420,14 @@ dna_free_config_entry(struct configEntry ** entry)
slapi_filter_free(e->slapi_filter, 1);
slapi_ch_free_string(&e->generate);
slapi_ch_free_string(&e->scope);
+ if (e->excludescope) {
+ int i;
+
+ for (i = 0; e->excludescope[i]; i++) {
+ slapi_sdn_free(&e->excludescope[i]);
+ }
+ slapi_ch_free((void **)&e->excludescope);
+ }
slapi_ch_free_string(&e->shared_cfg_base);
slapi_ch_free_string(&e->shared_cfg_dn);
slapi_ch_free_string(&e->remote_binddn);
@@ -3311,6 +3358,13 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
goto next;
}
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
ret = slapi_vattr_filter_test(pb, e, config_entry->slapi_filter, 0);
@@ -3509,7 +3563,14 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods, char **e
!slapi_dn_issuffix(dn, config_entry->scope)) {
goto next;
}
-
+
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
ret = slapi_vattr_filter_test(pb, e,
@@ -3955,6 +4016,13 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
goto next;
}
+ /* is this entry in an excluded scope? */
+ for (i = 0; config_entry->excludescope && config_entry->excludescope[i]; i++) {
+ if (slapi_dn_issuffix(dn, slapi_sdn_get_dn(config_entry->excludescope[i]))) {
+ goto next;
+ }
+ }
+
/* does the entry match the filter? */
if (config_entry->slapi_filter) {
if(LDAP_SUCCESS != slapi_vattr_filter_test(pb,e,config_entry->slapi_filter, 0))
@@ -4562,6 +4630,9 @@ void dna_dump_config_entry(struct configEntry * entry)
printf("<---- filter ---------> %s\n", entry->filter);
printf("<---- prefix ---------> %s\n", entry->prefix);
printf("<---- scope ----------> %s\n", entry->scope);
+ for (i = 0; entry->excludescope && entry->excludescope[i]; i++) {
+ printf("<---- excluded scope -> %s\n", slapi_sdn_get_dn(entry->excludescope[i]));
+ }
printf("<---- next value -----> %" PRIu64 "\n", entry->nextval);
printf("<---- max value ------> %" PRIu64 "\n", entry->maxval);
printf("<---- interval -------> %" PRIu64 "\n", entry->interval);
8 years, 7 months
Branch '389-ds-base-1.3.3' - dirsrvtests/data dirsrvtests/tickets
by thierry bordaz
dirsrvtests/data/ticket47988/schema_ipa3.3.tar.gz |binary
dirsrvtests/data/ticket47988/schema_ipa4.1.tar.gz |binary
dirsrvtests/tickets/ticket47988_test.py | 576 ++++++++++++++++++++++
3 files changed, 576 insertions(+)
New commits:
commit 50f3f5ac245f3021873e8abc248fe389370d723d
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Jan 26 11:15:56 2015 +0100
Ticket 47988: test case
diff --git a/dirsrvtests/data/ticket47988/schema_ipa3.3.tar.gz b/dirsrvtests/data/ticket47988/schema_ipa3.3.tar.gz
new file mode 100644
index 0000000..2b309a0
Binary files /dev/null and b/dirsrvtests/data/ticket47988/schema_ipa3.3.tar.gz differ
diff --git a/dirsrvtests/data/ticket47988/schema_ipa4.1.tar.gz b/dirsrvtests/data/ticket47988/schema_ipa4.1.tar.gz
new file mode 100644
index 0000000..84de0e9
Binary files /dev/null and b/dirsrvtests/data/ticket47988/schema_ipa4.1.tar.gz differ
diff --git a/dirsrvtests/tickets/ticket47988_test.py b/dirsrvtests/tickets/ticket47988_test.py
new file mode 100644
index 0000000..2e5e6fd
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47988_test.py
@@ -0,0 +1,576 @@
+'''
+Created on Nov 7, 2013
+
+@author: tbordaz
+'''
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import time
+import logging
+import pytest
+import re
+import tarfile
+import stat
+import shutil
+from random import randint
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389._constants import *
+from constants import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+#
+# important part. We can deploy Master1 and Master2 on different versions
+#
+installation1_prefix = None
+installation2_prefix = None
+
+TEST_REPL_DN = "cn=test_repl, %s" % SUFFIX
+OC_NAME = 'OCticket47988'
+MUST = "(postalAddress $ postalCode)"
+MAY = "(member $ street)"
+
+OTHER_NAME = 'other_entry'
+MAX_OTHERS = 10
+
+BIND_NAME = 'bind_entry'
+BIND_DN = 'cn=%s, %s' % (BIND_NAME, SUFFIX)
+BIND_PW = 'password'
+
+ENTRY_NAME = 'test_entry'
+ENTRY_DN = 'cn=%s, %s' % (ENTRY_NAME, SUFFIX)
+ENTRY_OC = "top person %s" % OC_NAME
+
+def _oc_definition(oid_ext, name, must=None, may=None):
+ oid = "1.2.3.4.5.6.7.8.9.10.%d" % oid_ext
+ desc = 'To test ticket 47490'
+ sup = 'person'
+ if not must:
+ must = MUST
+ if not may:
+ may = MAY
+
+ new_oc = "( %s NAME '%s' DESC '%s' SUP %s AUXILIARY MUST %s MAY %s )" % (oid, name, desc, sup, must, may)
+ return new_oc
+class TopologyMaster1Master2(object):
+ def __init__(self, master1, master2):
+ master1.open()
+ self.master1 = master1
+
+ master2.open()
+ self.master2 = master2
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to create a replicated topology for the 'module'.
+ The replicated topology is MASTER1 <-> Master2.
+ At the beginning, It may exists a master2 instance and/or a master2 instance.
+ It may also exists a backup for the master1 and/or the master2.
+
+ Principle:
+ If master1 instance exists:
+ restart it
+ If master2 instance exists:
+ restart it
+ If backup of master1 AND backup of master2 exists:
+ create or rebind to master1
+ create or rebind to master2
+
+ restore master1 from backup
+ restore master2 from backup
+ else:
+ Cleanup everything
+ remove instances
+ remove backups
+ Create instances
+ Initialize replication
+ Create backups
+ '''
+ global installation1_prefix
+ global installation2_prefix
+
+ #os.environ['USE_VALGRIND'] = '1'
+
+ # allocate master1 on a given deployement
+ master1 = DirSrv(verbose=False)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Args for the master1 instance
+ args_instance[SER_HOST] = HOST_MASTER_1
+ args_instance[SER_PORT] = PORT_MASTER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
+ args_master = args_instance.copy()
+ master1.allocate(args_master)
+
+ # allocate master1 on a given deployement
+ master2 = DirSrv(verbose=False)
+ if installation2_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation2_prefix
+
+ # Args for the consumer instance
+ args_instance[SER_HOST] = HOST_MASTER_2
+ args_instance[SER_PORT] = PORT_MASTER_2
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
+ args_master = args_instance.copy()
+ master2.allocate(args_master)
+
+
+ # Get the status of the backups
+ backup_master1 = master1.checkBackupFS()
+ backup_master2 = master2.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_master1 = master1.exists()
+ if instance_master1:
+ master1.stop(timeout=10)
+ master1.start(timeout=10)
+
+ instance_master2 = master2.exists()
+ if instance_master2:
+ master2.stop(timeout=10)
+ master2.start(timeout=10)
+
+ if backup_master1 and backup_master2:
+ # The backups exist, assuming they are correct
+ # we just re-init the instances with them
+ if not instance_master1:
+ master1.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ master1.open()
+
+ if not instance_master2:
+ master2.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ master2.open()
+
+ # restore master1 from backup
+ master1.stop(timeout=10)
+ master1.restoreFS(backup_master1)
+ master1.start(timeout=10)
+
+ # restore master2 from backup
+ master2.stop(timeout=10)
+ master2.restoreFS(backup_master2)
+ master2.start(timeout=10)
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve master-consumer
+ # so we need to create everything
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove all the backups. So even if we have a specific backup file
+ # (e.g backup_master) we clear all backups that an instance my have created
+ if backup_master1:
+ master1.clearBackupFS()
+ if backup_master2:
+ master2.clearBackupFS()
+
+ # Remove all the instances
+ if instance_master1:
+ master1.delete()
+ if instance_master2:
+ master2.delete()
+
+ # Create the instances
+ master1.create()
+ master1.open()
+ master2.create()
+ master2.open()
+
+ #
+ # Now prepare the Master-Consumer topology
+ #
+ # First Enable replication
+ master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)
+ master2.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_2)
+
+ # Initialize the supplier->consumer
+
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ repl_agreement = master1.agreement.create(suffix=SUFFIX, host=master2.host, port=master2.port, properties=properties)
+
+ if not repl_agreement:
+ log.fatal("Fail to create a replica agreement")
+ sys.exit(1)
+
+ log.debug("%s created" % repl_agreement)
+
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ master2.agreement.create(suffix=SUFFIX, host=master1.host, port=master1.port, properties=properties)
+
+ master1.agreement.init(SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ master1.waitForReplInit(repl_agreement)
+
+ # Check replication is working fine
+ master1.add_s(Entry((TEST_REPL_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': 'test_repl',
+ 'cn': 'test_repl'})))
+ loop = 0
+ while loop <= 10:
+ try:
+ ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ break
+ except ldap.NO_SUCH_OBJECT:
+ time.sleep(1)
+ loop += 1
+
+ # Time to create the backups
+ master1.stop(timeout=10)
+ master1.backupfile = master1.backupFS()
+ master1.start(timeout=10)
+
+ master2.stop(timeout=10)
+ master2.backupfile = master2.backupFS()
+ master2.start(timeout=10)
+
+ #
+ # Here we have two instances master and consumer
+ # with replication working. Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyMaster1Master2(master1, master2)
+
+def _header(topology, label):
+ topology.master1.log.info("\n\n###############################################")
+ topology.master1.log.info("#######")
+ topology.master1.log.info("####### %s" % label)
+ topology.master1.log.info("#######")
+ topology.master1.log.info("###################################################")
+
+def _install_schema(server, tarFile):
+ server.stop(timeout=10)
+
+ here = os.getcwd()
+
+ tmpSchema = '/tmp/schema_47988'
+ if not os.path.isdir(tmpSchema):
+ os.mkdir(tmpSchema)
+
+ for the_file in os.listdir(tmpSchema):
+ file_path = os.path.join(tmpSchema, the_file)
+ if os.path.isfile(file_path):
+ os.unlink(file_path)
+
+ os.chdir(tmpSchema)
+ tar = tarfile.open(tarFile, 'r:gz')
+ for member in tar.getmembers():
+ tar.extract(member.name)
+
+ tar.close()
+
+ st = os.stat(server.schemadir)
+ os.chmod(server.schemadir, st.st_mode | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR )
+ for the_file in os.listdir(tmpSchema):
+ schemaFile = os.path.join(server.schemadir, the_file)
+ if os.path.isfile(schemaFile):
+ if the_file.startswith('99user.ldif'):
+ # only replace 99user.ldif, the other standard definition are kept
+ os.chmod(schemaFile, stat.S_IWUSR | stat.S_IRUSR)
+ server.log.info("replace %s" % schemaFile)
+ shutil.copy(the_file, schemaFile)
+
+ else:
+ server.log.info("add %s" % schemaFile)
+ shutil.copy(the_file, schemaFile)
+ os.chmod(schemaFile, stat.S_IRUSR | stat.S_IRGRP)
+ os.chmod(server.schemadir, st.st_mode | stat.S_IRUSR | stat.S_IRGRP)
+
+
+def test_ticket47988_init(topology):
+ """
+ It adds
+ - Objectclass with MAY 'member'
+ - an entry ('bind_entry') with which we bind to test the 'SELFDN' operation
+ It deletes the anonymous aci
+
+ """
+
+ _header(topology, 'test_ticket47988_init')
+
+ # enable acl error logging
+ mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(8192))] # REPL
+ topology.master1.modify_s(DN_CONFIG, mod)
+ topology.master2.modify_s(DN_CONFIG, mod)
+
+ mod = [(ldap.MOD_REPLACE, 'nsslapd-accesslog-level', str(260))] # Internal op
+ topology.master1.modify_s(DN_CONFIG, mod)
+ topology.master2.modify_s(DN_CONFIG, mod)
+
+ # add dummy entries
+ for cpt in range(MAX_OTHERS):
+ name = "%s%d" % (OTHER_NAME, cpt)
+ topology.master1.add_s(Entry(("cn=%s,%s" % (name, SUFFIX), {
+ 'objectclass': "top person".split(),
+ 'sn': name,
+ 'cn': name})))
+
+ # check that entry 0 is replicated before
+ loop = 0
+ entryDN = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)
+ while loop <= 10:
+ try:
+ ent = topology.master2.getEntry(entryDN, ldap.SCOPE_BASE, "(objectclass=*)", ['telephonenumber'])
+ break
+ except ldap.NO_SUCH_OBJECT:
+ time.sleep(1)
+ loop += 1
+ assert (loop <= 10)
+
+ topology.master1.stop(timeout=10)
+ topology.master2.stop(timeout=10)
+
+ #install the specific schema M1: ipa3.3, M2: ipa4.1
+ schema_file = os.path.join(topology.master1.getDir(__file__, DATA_DIR), "ticket47988/schema_ipa3.3.tar.gz")
+ _install_schema(topology.master1, schema_file)
+ schema_file = os.path.join(topology.master1.getDir(__file__, DATA_DIR), "ticket47988/schema_ipa4.1.tar.gz")
+ _install_schema(topology.master2, schema_file)
+
+ topology.master1.start(timeout=10)
+ topology.master2.start(timeout=10)
+
+def _do_update_schema(server, range=3999):
+ '''
+ Update the schema of the M2 (IPA4.1). to generate a nsSchemaCSN
+ '''
+ postfix = str(randint(range, range+1000))
+ OID = '2.16.840.1.113730.3.8.12.%s' % postfix
+ NAME = 'thierry%s' % postfix
+ value = '( %s NAME \'%s\' DESC \'Override for Group Attributes\' STRUCTURAL MUST ( cn ) MAY sn X-ORIGIN ( \'IPA v4.1.2\' \'user defined\' ) )' % (OID, NAME)
+ mod = [(ldap.MOD_ADD, 'objectclasses', value)]
+ server.modify_s('cn=schema', mod)
+
+def _do_update_entry(supplier=None, consumer=None, attempts=10):
+ '''
+ This is doing an update on M2 (IPA4.1) and checks the update has been
+ propagated to M1 (IPA3.3)
+ '''
+ assert(supplier)
+ assert(consumer)
+ entryDN = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)
+ value = str(randint(100,200))
+ mod = [(ldap.MOD_REPLACE, 'telephonenumber', value)]
+ supplier.modify_s(entryDN, mod)
+
+ loop = 0
+ while loop <= attempts:
+ ent = consumer.getEntry(entryDN, ldap.SCOPE_BASE, "(objectclass=*)", ['telephonenumber'])
+ read_val = ent.telephonenumber or "0"
+ if read_val == value:
+ break
+ # the expected value is not yet replicated. try again
+ time.sleep(5)
+ loop += 1
+ supplier.log.debug("test_do_update: receive %s (expected %s)" % (read_val, value))
+ assert (loop <= attempts)
+
+def _pause_M2_to_M1(topology):
+ topology.master1.log.info("\n\n######################### Pause RA M2->M1 ######################\n")
+ ents = topology.master2.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 1
+ topology.master2.agreement.pause(ents[0].dn)
+
+
+def _resume_M1_to_M2(topology):
+ topology.master1.log.info("\n\n######################### resume RA M1->M2 ######################\n")
+ ents = topology.master1.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 1
+ topology.master1.agreement.resume(ents[0].dn)
+
+def _pause_M1_to_M2(topology):
+ topology.master1.log.info("\n\n######################### Pause RA M1->M2 ######################\n")
+ ents = topology.master1.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 1
+ topology.master1.agreement.pause(ents[0].dn)
+
+
+def _resume_M2_to_M1(topology):
+ topology.master1.log.info("\n\n######################### resume RA M2->M1 ######################\n")
+ ents = topology.master2.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 1
+ topology.master2.agreement.resume(ents[0].dn)
+
+def test_ticket47988_1(topology):
+ '''
+ Check that replication is working and pause replication M2->M1
+ '''
+ _header(topology, 'test_ticket47988_1')
+
+ topology.master1.log.debug("\n\nCheck that replication is working and pause replication M2->M1\n")
+ _do_update_entry(supplier=topology.master2, consumer=topology.master1, attempts=5)
+ _pause_M2_to_M1(topology)
+
+def test_ticket47988_2(topology):
+ '''
+ Update M1 schema and trigger update M1->M2
+ So M1 should learn new/extended definitions that are in M2 schema
+ '''
+ _header(topology, 'test_ticket47988_2')
+
+ topology.master1.log.debug("\n\nUpdate M1 schema and an entry on M1\n")
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nBefore updating the schema on M1\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+
+ # Here M1 should no, should check M2 schema and learn
+ _do_update_schema(topology.master1)
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nAfter updating the schema on M1\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+
+ # to avoid linger effect where a replication session is reused without checking the schema
+ _pause_M1_to_M2(topology)
+ _resume_M1_to_M2(topology)
+
+ #topo.master1.log.debug("\n\nSleep.... attach the debugger dse_modify")
+ #time.sleep(60)
+ _do_update_entry(supplier=topology.master1, consumer=topology.master2, attempts=15)
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nAfter a full replication session\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+ assert (master2_schema_csn)
+
+def test_ticket47988_3(topology):
+ '''
+ Resume replication M2->M1 and check replication is still working
+ '''
+ _header(topology, 'test_ticket47988_3')
+
+ _resume_M2_to_M1(topology)
+ _do_update_entry(supplier=topology.master1, consumer=topology.master2, attempts=5)
+ _do_update_entry(supplier=topology.master2, consumer=topology.master1, attempts=5)
+
+def test_ticket47988_4(topology):
+ '''
+ Check schemaCSN is identical on both server
+ And save the nsschemaCSN to later check they do not change unexpectedly
+ '''
+ _header(topology, 'test_ticket47988_4')
+
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\n\nMaster1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("\n\nMaster2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+ assert (master2_schema_csn)
+ assert (master1_schema_csn == master2_schema_csn)
+
+ topology.master1.saved_schema_csn = master1_schema_csn
+ topology.master2.saved_schema_csn = master2_schema_csn
+
+def test_ticket47988_5(topology):
+ '''
+ Check schemaCSN do not change unexpectedly
+ '''
+ _header(topology, 'test_ticket47988_5')
+
+ _do_update_entry(supplier=topology.master1, consumer=topology.master2, attempts=5)
+ _do_update_entry(supplier=topology.master2, consumer=topology.master1, attempts=5)
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\n\nMaster1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("\n\nMaster2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+ assert (master2_schema_csn)
+ assert (master1_schema_csn == master2_schema_csn)
+
+ assert (topology.master1.saved_schema_csn == master1_schema_csn)
+ assert (topology.master2.saved_schema_csn == master2_schema_csn)
+
+def test_ticket47988_6(topology):
+ '''
+ Update M1 schema and trigger update M2->M1
+ So M2 should learn new/extended definitions that are in M1 schema
+ '''
+
+ _header(topology, 'test_ticket47988_6')
+
+ topology.master1.log.debug("\n\nUpdate M1 schema and an entry on M1\n")
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nBefore updating the schema on M1\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+
+ # Here M1 should no, should check M2 schema and learn
+ _do_update_schema(topology.master1, range=5999)
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nAfter updating the schema on M1\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+
+ # to avoid linger effect where a replication session is reused without checking the schema
+ _pause_M1_to_M2(topology)
+ _resume_M1_to_M2(topology)
+
+ #topo.master1.log.debug("\n\nSleep.... attach the debugger dse_modify")
+ #time.sleep(60)
+ _do_update_entry(supplier=topology.master2, consumer=topology.master1, attempts=15)
+ master1_schema_csn = topology.master1.schema.get_schema_csn()
+ master2_schema_csn = topology.master2.schema.get_schema_csn()
+ topology.master1.log.debug("\nAfter a full replication session\n")
+ topology.master1.log.debug("Master1 nsschemaCSN: %s" % master1_schema_csn)
+ topology.master1.log.debug("Master2 nsschemaCSN: %s" % master2_schema_csn)
+ assert (master1_schema_csn)
+ assert (master2_schema_csn)
+
+def test_ticket47988_final(topology):
+ topology.master1.delete()
+ topology.master2.delete()
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation1_prefix
+ global installation2_prefix
+ installation1_prefix = None
+ installation2_prefix = None
+
+ topo = topology(True)
+ test_ticket47988_init(topo)
+ test_ticket47988_1(topo)
+ test_ticket47988_2(topo)
+ test_ticket47988_3(topo)
+ test_ticket47988_4(topo)
+ test_ticket47988_5(topo)
+ test_ticket47988_6(topo)
+ test_ticket47988_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
+
8 years, 7 months