ldap/servers/plugins/acl/acl.c | 2
ldap/servers/plugins/acl/acllas.c | 12 -
ldap/servers/plugins/chainingdb/cb_bind.c | 2
ldap/servers/plugins/cos/cos_cache.c | 5
ldap/servers/plugins/dna/dna.c | 6
ldap/servers/plugins/replication/cl5_api.c | 33 +---
ldap/servers/plugins/replication/cl5_clcache.c | 7 -
ldap/servers/plugins/replication/repl5_agmt.c | 42 ++----
ldap/servers/plugins/replication/repl5_init.c | 16 --
ldap/servers/plugins/replication/repl5_replica.c | 6
ldap/servers/plugins/replication/repl5_total.c | 5
ldap/servers/plugins/replication/repl_objset.c | 2
ldap/servers/plugins/replication/windows_connection.c | 2
ldap/servers/plugins/syntaxes/string.c | 10 -
ldap/servers/plugins/syntaxes/validate.c | 4
ldap/servers/plugins/uiduniq/7bit.c | 1
ldap/servers/plugins/uiduniq/uid.c | 1
ldap/servers/slapd/agtmmap.c | 4
ldap/servers/slapd/back-ldbm/idl_new.c | 3
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 9 -
ldap/servers/slapd/back-ldbm/ldbm_search.c | 2
ldap/servers/slapd/back-ldbm/misc.c | 4
ldap/servers/slapd/back-ldbm/start.c | 18 +-
ldap/servers/slapd/bind.c | 126 ++++++++----------
ldap/servers/slapd/daemon.c | 17 +-
ldap/servers/slapd/ldaputil.c | 4
ldap/servers/slapd/libglobs.c | 21 +--
ldap/servers/slapd/modrdn.c | 6
ldap/servers/slapd/plugin_syntax.c | 2
ldap/servers/slapd/sasl_map.c | 53 ++++++-
ldap/servers/slapd/tools/mmldif.c | 2
31 files changed, 199 insertions(+), 228 deletions(-)
New commits:
commit 5ae0c1b445f17f402ecf25cb7d4aa31ae6612570
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 13:25:07 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11958 NO_EFFECT Triaged Unassigned Bug Moderate Fix Required
do_bind() ds/ldap/servers/slapd/bind.c
Comment:
slapi_dn_normalize_ext() may return a negative value but rc is of type ber_tag_t which
is an unsigned int. Introducing "ber_tag_t ber_rc" just for ber functions and
"int rc" for the rest.
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index c22d195..5f4ab03 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -127,7 +127,8 @@ do_bind( Slapi_PBlock *pb )
char *dn = NULL, *saslmech = NULL;
struct berval cred = {0};
Slapi_Backend *be = NULL;
- ber_tag_t rc;
+ ber_tag_t ber_rc;
+ int rc = 0;
Slapi_DN sdn;
Slapi_Entry *referral;
char errorbuf[BUFSIZ];
@@ -161,8 +162,8 @@ do_bind( Slapi_PBlock *pb )
* }
*/
- rc = ber_scanf( ber, "{iat", &version, &rawdn, &method );
- if ( rc == LBER_ERROR ) {
+ ber_rc = ber_scanf( ber, "{iat", &version, &rawdn, &method );
+ if ( ber_rc == LBER_ERROR ) {
LDAPDebug( LDAP_DEBUG_ANY,
"ber_scanf failed (op=Bind; params=Version,DN,Method)\n",
0, 0, 0 );
@@ -219,18 +220,18 @@ do_bind( Slapi_PBlock *pb )
goto free_and_return;
}
/* Get the SASL mechanism */
- rc = ber_scanf( ber, "{a", &saslmech );
+ ber_rc = ber_scanf( ber, "{a", &saslmech );
/* Get the (optional) SASL credentials */
- if ( rc != LBER_ERROR ) {
+ if ( ber_rc != LBER_ERROR ) {
/* Credentials are optional in SASL bind */
ber_len_t clen;
if (( ber_peek_tag( ber, &clen )) == LBER_OCTETSTRING ) {
- rc = ber_scanf( ber, "o}}", &cred );
+ ber_rc = ber_scanf( ber, "o}}", &cred );
if (cred.bv_len == 0) {
slapi_ch_free_string(&cred.bv_val);
}
} else {
- rc = ber_scanf( ber, "}}" );
+ ber_rc = ber_scanf( ber, "}}" );
}
}
break;
@@ -249,7 +250,7 @@ do_bind( Slapi_PBlock *pb )
}
/* FALLTHROUGH */
case LDAP_AUTH_SIMPLE:
- rc = ber_scanf( ber, "o}", &cred );
+ ber_rc = ber_scanf( ber, "o}", &cred );
if (cred.bv_len == 0) {
slapi_ch_free_string(&cred.bv_val);
}
@@ -260,7 +261,7 @@ do_bind( Slapi_PBlock *pb )
"Unknown bind method", 0, NULL );
goto free_and_return;
}
- if ( rc == LBER_ERROR ) {
+ if ( ber_rc == LBER_ERROR ) {
LDAPDebug( LDAP_DEBUG_ANY,
"ber_scanf failed (op=Bind; params=Credentials)\n",
0, 0, 0 );
@@ -660,7 +661,7 @@ do_bind( Slapi_PBlock *pb )
*/
if ( plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN )
== 0 ) {
- int rc = 0;
+ rc = 0;
/*
* Is this account locked ?
@@ -673,82 +674,78 @@ do_bind( Slapi_PBlock *pb )
* deal with it.
*
*/
-
- /* get the entry now, so that we can give it to slapi_check_account_lock and
reslimit_update_from_dn */
+
+ /* get the entry now, so that we can give it to slapi_check_account_lock and
reslimit_update_from_dn */
if (! slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
- bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(&sdn));
- rc = slapi_check_account_lock ( pb, bind_target_entry, pw_response_requested, 1, 1);
+ bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(&sdn));
+ rc = slapi_check_account_lock ( pb, bind_target_entry,
pw_response_requested, 1, 1);
}
slapi_pblock_set( pb, SLAPI_PLUGIN, be->be_database );
set_db_default_result_handlers(pb);
- if ( (rc != 1) && (auto_bind || (((rc = (*be->be_bind)( pb ))
- == SLAPI_BIND_SUCCESS ) || rc
- == SLAPI_BIND_ANONYMOUS ))) {
+ if ( (rc != 1) &&
+ (auto_bind ||
+ (((rc = (*be->be_bind)( pb )) == SLAPI_BIND_SUCCESS) ||
+ (rc == SLAPI_BIND_ANONYMOUS))) ) {
long t;
- {
- char* authtype = NULL;
+ char* authtype = NULL;
- if(auto_bind)
- rc = SLAPI_BIND_SUCCESS;
+ if(auto_bind)
+ rc = SLAPI_BIND_SUCCESS;
- switch ( method ) {
- case LDAP_AUTH_SIMPLE:
- if (cred.bv_len != 0) {
- authtype = SLAPD_AUTH_SIMPLE;
- }
+ switch ( method ) {
+ case LDAP_AUTH_SIMPLE:
+ if (cred.bv_len != 0) {
+ authtype = SLAPD_AUTH_SIMPLE;
+ }
#if defined(ENABLE_AUTOBIND)
- else if(auto_bind) {
- authtype = SLAPD_AUTH_OS;
- }
+ else if(auto_bind) {
+ authtype = SLAPD_AUTH_OS;
+ }
#endif /* ENABLE_AUTOBIND */
- else {
- authtype = SLAPD_AUTH_NONE;
- }
- break;
- case LDAP_AUTH_SASL:
- /* authtype = SLAPD_AUTH_SASL && saslmech: */
- PR_snprintf(authtypebuf, sizeof(authtypebuf), "%s%s",
SLAPD_AUTH_SASL, saslmech);
- authtype = authtypebuf;
- break;
- default: /* ??? */
- break;
+ else {
+ authtype = SLAPD_AUTH_NONE;
}
+ break;
+ case LDAP_AUTH_SASL:
+ /* authtype = SLAPD_AUTH_SASL && saslmech: */
+ PR_snprintf(authtypebuf, sizeof(authtypebuf), "%s%s",
SLAPD_AUTH_SASL, saslmech);
+ authtype = authtypebuf;
+ break;
+ default: /* ??? */
+ break;
+ }
- if ( rc == SLAPI_BIND_SUCCESS ) {
- if(!auto_bind)
- bind_credentials_set( pb->pb_conn,
- authtype, slapi_ch_strdup(
- slapi_sdn_get_ndn(&sdn)),
- NULL, NULL, NULL, bind_target_entry );
- if ( auth_response_requested ) {
- slapi_add_auth_response_control( pb,
- slapi_sdn_get_ndn(&sdn));
- }
- } else { /* anonymous */
- /* set bind creds here so anonymous limits are set */
- bind_credentials_set( pb->pb_conn, authtype, NULL,
- NULL, NULL, NULL, NULL );
-
- if ( auth_response_requested ) {
- slapi_add_auth_response_control( pb,
- "" );
- }
+ if ( rc == SLAPI_BIND_SUCCESS ) {
+ if(!auto_bind)
+ bind_credentials_set( pb->pb_conn,
+ authtype, slapi_ch_strdup(
+ slapi_sdn_get_ndn(&sdn)),
+ NULL, NULL, NULL, bind_target_entry );
+ if ( auth_response_requested ) {
+ slapi_add_auth_response_control( pb,
+ slapi_sdn_get_ndn(&sdn));
+ }
+ } else { /* anonymous */
+ /* set bind creds here so anonymous limits are set */
+ bind_credentials_set( pb->pb_conn, authtype, NULL,
+ NULL, NULL, NULL, NULL );
+
+ if ( auth_response_requested ) {
+ slapi_add_auth_response_control( pb,
+ "" );
}
}
- if ( 0 == auto_bind && rc != SLAPI_BIND_ANONYMOUS &&
- ! slapi_be_is_flag_set(be,
- SLAPI_BE_FLAG_REMOTE_DATA)) {
+ if ( 0 == auto_bind && (rc != SLAPI_BIND_ANONYMOUS) &&
+ ! slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
/* check if need new password before sending
the bind success result */
switch ( need_new_pw (pb, &t, bind_target_entry,
pw_response_requested )) {
-
case 1:
(void)slapi_add_pwd_control ( pb,
LDAP_CONTROL_PWEXPIRED, 0);
break;
-
case 2:
(void)slapi_add_pwd_control ( pb,
LDAP_CONTROL_PWEXPIRING, t);
@@ -769,7 +766,6 @@ do_bind( Slapi_PBlock *pb )
/* increment BindSecurityError count */
slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
}
-
}
/*
commit 921e51777d72ee7508fd95bbc6d3aa4ca4bdc44b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 12:21:46 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11843 DEADCODE Triaged Unassigned Bug Minor Fix Required
mm_init() ds/ldap/servers/slapd/tools/mmldif.c
Comment:
A variable tailorfile is not used.
Remove it.
diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c
index 409ce3e..291702a 100644
--- a/ldap/servers/slapd/tools/mmldif.c
+++ b/ldap/servers/slapd/tools/mmldif.c
@@ -639,7 +639,6 @@ int mm_init(int argc, char * argv[])
int c;
char *ofn = NULL;
char *prog = argv[0];
- char *tailorfile = NULL;
time(&tl);
seed = (char)tl;
@@ -712,7 +711,6 @@ int mm_init(int argc, char * argv[])
hashmask = 0xfff;
hashtable = (entry_t **)calloc(0x1000, sizeof(entry_t*));
- if (tailorfile) free(tailorfile);
return 0;
}
commit f502808c028286d69ab1205619e232e18ae56795
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 12:11:18 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11841 DEADCODE Triaged Unassigned Bug Minor Fix Required
sasl_map_new_private() ds/ldap/servers/slapd/sasl_map.c
Comment:
This new_lock NULL checking is not needed.
On this path, the condition "NULL == new_lock" cannot be true.
97 if (NULL == new_lock) {
Execution cannot reach this statement "slapi_ch_free((void**)new_p...".
98 slapi_ch_free((void**)new_priv);
99 return NULL;
100 }
11842 DEADCODE Triaged Unassigned Bug Minor Fix Required
sasl_map_insert_list_entry() ds/ldap/servers/slapd/sasl_map.c
Comment:
In sasl_map_insert_list_entry, /* Check to see if it's here
already */ was not implemented. The variable ishere pointed
by coverity should have been prepared for the purpose.
Implementing a helper function sasl_map_cmp_data.
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index d6a84a7..e934b11 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -94,10 +94,6 @@ sasl_map_private *sasl_map_new_private()
}
new_priv = (sasl_map_private *)slapi_ch_calloc(1,sizeof(sasl_map_private));
new_priv->lock = new_lock;
- if (NULL == new_lock) {
- slapi_ch_free((void**)new_priv);
- return NULL;
- }
return new_priv;
}
@@ -172,16 +168,61 @@ sasl_map_remove_list_entry(sasl_map_private *priv, char *removeme)
}
static int
+sasl_map_cmp_data(sasl_map_data *dp0, sasl_map_data *dp1)
+{
+ int rc = 0;
+ if (NULL == dp0) {
+ if (NULL == dp1) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else {
+ if (NULL == dp1) {
+ return 1;
+ }
+ }
+
+ rc = PL_strcmp(dp0->name, dp1->name);
+ if (0 != rc) {
+ /* did not match */
+ return rc;
+ }
+ rc = PL_strcmp(dp0->regular_expression, dp1->regular_expression);
+ if (0 != rc) {
+ /* did not match */
+ return rc;
+ }
+ rc = PL_strcmp(dp0->template_base_dn, dp1->template_base_dn);
+ if (0 != rc) {
+ /* did not match */
+ return rc;
+ }
+ rc = PL_strcmp(dp0->template_search_filter, dp1->template_search_filter);
+ return rc;
+}
+
+static int
sasl_map_insert_list_entry(sasl_map_private *priv, sasl_map_data *dp)
{
int ret = 0;
int ishere = 0;
sasl_map_data *current = NULL;
+ if (NULL == dp) {
+ return ret;
+ }
PR_Lock(priv->lock);
/* Check to see if it's here already */
current = priv->map_data_list;
- while (current && current->next) {
- current = current->next;
+ while (current) {
+ if (0 == sasl_map_cmp_data(current, dp)) {
+ ishere = 1;
+ }
+ if (current->next) {
+ current = current->next;
+ } else {
+ break;
+ }
}
if (ishere) {
return -1;
commit 25dfa7cf81554e8795c8cb260f7493a94f59e6fb
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 11:28:42 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11834 DEADCODE Triaged Unassigned Bug Minor Fix Required
write_function() ds/ldap/servers/slapd/daemon.c
Comment:
The location of checking for sentbytes is not correct.
Execution cannot reach this statement "if (sentbytes < count){ {...".
1724 } else if (sentbytes < count) {
1725 LDAPDebug(LDAP_DEBUG_CONNS,
It should not be "else" of checking for "bytes".
Moving the check after "else if (sentbytes > count)".
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index b523138..783aaae 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1693,7 +1693,7 @@ write_function( int ignore, const void *buffer, int count, struct
lextiof_socket
int fd = PR_FileDesc2NativeHandle((PRFileDesc *)handle);
if (handle == SLAPD_INVALID_SOCKET) {
- PR_SetError(PR_NOT_SOCKET_ERROR, EBADF);
+ PR_SetError(PR_NOT_SOCKET_ERROR, EBADF);
} else {
while (1) {
if (slapd_poll(handle, SLAPD_POLLOUT) < 0) { /* error */
@@ -1721,13 +1721,8 @@ write_function( int ignore, const void *buffer, int count, struct
lextiof_socket
fd, prerr, slapd_pr_strerror(prerr));
PR_SetError(PR_PIPE_ERROR, EPIPE);
break;
- } else if (sentbytes < count) {
- LDAPDebug(LDAP_DEBUG_CONNS,
- "PR_Write(%d) - wrote only %d bytes (expected %d bytes) -
0 (EOF)\n", /* disconnected */
- fd, sentbytes, count);
- PR_SetError(PR_PIPE_ERROR, EPIPE);
- break;
- }
+ }
+
if (sentbytes == count) { /* success */
return count;
} else if (sentbytes > count) { /* too many bytes */
@@ -1736,6 +1731,12 @@ write_function( int ignore, const void *buffer, int count, struct
lextiof_socket
fd, sentbytes, count);
PR_SetError(PR_BUFFER_OVERFLOW_ERROR, EMSGSIZE);
break;
+ } else if (sentbytes < count) {
+ LDAPDebug(LDAP_DEBUG_CONNS,
+ "PR_Write(%d) - wrote only %d bytes (expected %d bytes) -
0 (EOF)\n", /* disconnected */
+ fd, sentbytes, count);
+ PR_SetError(PR_PIPE_ERROR, EPIPE);
+ break;
}
}
}
commit 00b81fed600b1ccef6bc87fcdaf562283e183002
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 11:03:36 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11832 DEADCODE Triaged Unassigned Bug Minor Fix Required
do_modrdn() ds/ldap/servers/slapd/modrdn.c
Comment:
At the line 201 and 212, the condition "rawnewsuperior" cannot be false.
201 rawnewsuperior?rawnewsuperior:"",
212 rawnewsuperior?rawnewsuperior:"",
This patch is removing the checks.
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 6951fb0..b721fc7 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -197,8 +197,7 @@ do_modrdn( Slapi_PBlock *pb )
/* check that the dn is formatted correctly */
err = slapi_dn_syntax_check(pb, rawnewsuperior, 1);
if (err) { /* syntax check failed */
- op_shared_log_error_access(pb, "MODRDN",
- rawnewsuperior?rawnewsuperior:"",
+ op_shared_log_error_access(pb, "MODRDN", rawnewsuperior,
"strict: invalid new superior");
send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX,
NULL, "invalid new superior", 0, NULL);
@@ -208,8 +207,7 @@ do_modrdn( Slapi_PBlock *pb )
}
err = slapi_dn_normalize_ext(rawnewsuperior, 0, &newsuperior, &dnlen);
if (err < 0) {
- op_shared_log_error_access(pb, "MODRDN",
- rawnewsuperior?rawnewsuperior:"",
+ op_shared_log_error_access(pb, "MODRDN", rawnewsuperior,
"invalid new superior");
send_ldap_result(pb, LDAP_INVALID_DN_SYNTAX,
NULL, "invalid new superior", 0, NULL);
commit 603c5fcc52201d9eca690c5bef29e4e39e340f56
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 10:52:25 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11831 DEADCODE Triaged Unassigned Bug Minor Fix Required
config_set_value() ds/ldap/servers/slapd/libglobs.c
Comment:
The config_set_value meant to set various values (e.g. "off"
and "unknown") depending upon the config_var_type, but this
code overrides the spec and set the empty string to all cases.
- /* for null values, just set the attr value to the empty
- string */
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- return;
- }
This patch removes the above blind empty string setting and
relies on the values in each config_var_type case. Plus, adding
the NULL value check to CONFIG_CHARRAY.
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index b8e26d1..d10466d 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -5604,13 +5604,6 @@ config_set_value(
int ival = 0;
uintptr_t pval;
- /* for null values, just set the attr value to the empty
- string */
- if (!value) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
- return;
- }
-
switch (cgas->config_var_type) {
case CONFIG_ON_OFF: /* convert 0,1 to "off","on" */
slapi_entry_attr_set_charptr(e, cgas->attr_name,
@@ -5638,12 +5631,16 @@ config_set_value(
break;
case CONFIG_CHARRAY:
- values = strarray2bervalarray((const char **)*((char ***)value));
- if (!values) {
- slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
+ if (value) {
+ values = strarray2bervalarray((const char **)*((char ***)value));
+ if (!values) {
+ slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
+ } else {
+ slapi_entry_attr_replace(e, cgas->attr_name, values);
+ bervalarray_free(values);
+ }
} else {
- slapi_entry_attr_replace(e, cgas->attr_name, values);
- bervalarray_free(values);
+ slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
}
break;
commit 2d69093cf71107b36a58b7d7359abc9ca93071f1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 8 10:11:02 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11829 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_start() ds/ldap/servers/slapd/back-ldbm/start.c
Comment:
The code meant the autosized cache should be reduced 25%
if the calculated size was less than 500MB for the overhead
of libdb. If larger than 500MB, the overhead is relatively
small and can be ignored. The code should have calculated
the size before comparing it to 500MB.
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 06bf7de..8ea44aa 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -91,12 +91,11 @@ ldbm_back_start( Slapi_PBlock *pb )
/* sanity check the autosizing values,
no value or sum of values larger than 100.
*/
- if ( (li->li_cache_autosize > 100) ||
- (li->li_cache_autosize_split > 100) ||
- (li->li_import_cache_autosize > 100) ||
- ((li->li_cache_autosize > 0) && (li->li_import_cache_autosize >
0) &&
- (li->li_cache_autosize + li->li_import_cache_autosize > 100)) )
- {
+ if ((li->li_cache_autosize > 100) ||
+ (li->li_cache_autosize_split > 100) ||
+ (li->li_import_cache_autosize > 100) ||
+ ((li->li_cache_autosize > 0) && (li->li_import_cache_autosize >
0) &&
+ (li->li_cache_autosize + li->li_import_cache_autosize > 100))) {
LDAPDebug( LDAP_DEBUG_ANY, "cache autosizing: bad settings, "
"value or sum of values can not larger than 100.\n", 0, 0, 0 );
} else
@@ -126,11 +125,12 @@ ldbm_back_start( Slapi_PBlock *pb )
db_pages*(pagesize/1024), objset_size(li->li_instance_set),
entry_pages*(pagesize/1024));
- /* libdb allocates 1.25x the amount we tell it to, but only for values <
500Meg */
+ /* libdb allocates 1.25x the amount we tell it to,
+ * but only for values < 500Meg
+ * For the larger memory, the overhead is relatively small. */
+ cache_size_to_configure = (unsigned long)(db_pages * pagesize);
if (cache_size_to_configure < (500 * MEGABYTE)) {
cache_size_to_configure = (unsigned long)((db_pages * pagesize) /
1.25);
- } else {
- cache_size_to_configure = (unsigned long)(db_pages * pagesize);
}
sprintf(s, "%lu", cache_size_to_configure);
ldbm_config_internal_set(li, CONFIG_DBCACHESIZE, s);
commit f66b608d3880b251a35c32c0d6eeb2a6c23dea2b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jul 7 18:19:28 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11826 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_search() ds/ldap/servers/slapd/back-ldbm/ldbm_search.c
Comment:
On this path, the condition "abandoned" cannot be true.
504 return ldbm_back_search_cleanup(pb, li, sort_control,
505 (abandoned?-1:LDAP_PROTOCOL_ERROR),
506 "Sort Response Control", -1,
507 &basesdn, &vlv_request_control);
Line 505 should be
505 LDAP_PROTOCOL_ERROR,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c
b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 9a4925f..72ceeb7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -502,7 +502,7 @@ ldbm_back_search( Slapi_PBlock *pb )
sort_make_sort_response_control( pb, LDAP_SUCCESS, NULL ))
{
return ldbm_back_search_cleanup(pb, li, sort_control,
- (abandoned?-1:LDAP_PROTOCOL_ERROR),
+ LDAP_PROTOCOL_ERROR,
"Sort Response Control", -1,
&basesdn, &vlv_request_control);
}
commit f4748c127cb3c8c9bc49322ec5104c3cd2d09d71
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jul 7 18:07:11 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11825 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_modrdn() ds/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
Comment:
It was checking if (parententry && parententry->ep_entry) in the
if ( parententry == NULL ) clause. Removed the unnecessary code.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 8c88377..dbe53e5 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -421,14 +421,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if(!(slapi_dn_isbesuffix(pb,slapi_sdn_get_ndn(&dn_olddn)) &&
isroot))
{
/* Here means that we didn't find the parent */
- if (parententry && parententry->ep_entry)
- {
- ldap_result_matcheddn = slapi_ch_strdup((char *)
slapi_entry_get_dn(parententry->ep_entry));
- }
- else
- {
- ldap_result_matcheddn = "NULL";
- }
+ ldap_result_matcheddn = "NULL";
ldap_result_code= LDAP_NO_SUCH_OBJECT;
LDAPDebug( LDAP_DEBUG_TRACE, "Parent does not exist matched %s, parentdn
= %s\n",
ldap_result_matcheddn, slapi_sdn_get_ndn(&dn_parentdn), 0 );
commit 270fa7377ec1a49cf925381e1fe6b40759ec4d4e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jul 7 17:51:43 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11821 DEADCODE Triaged Unassigned Bug Minor Fix Required
allinstance_set_busy() ds/ldap/servers/slapd/back-ldbm/misc.c
11822 DEADCODE Triaged Unassigned Bug Minor Fix Required
allinstance_set_not_busy() ds/ldap/servers/slapd/back-ldbm/misc.c
Comment:
objset_next_obj releases the previous object internally.
Thus, there is no leak. Just remove the 2 lines:
if (inst_obj)
object_release(inst_obj);
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index 2bcdd9d..0e1dc60 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -231,8 +231,6 @@ allinstance_set_not_busy(struct ldbminfo *li)
inst = (ldbm_instance *)object_get_data(inst_obj);
instance_set_not_busy(inst);
}
- if (inst_obj)
- object_release(inst_obj);
}
void
@@ -250,8 +248,6 @@ allinstance_set_busy(struct ldbminfo *li)
inst->inst_name);
}
}
- if (inst_obj)
- object_release(inst_obj);
}
int
commit a24a746c029aea8c6cd66b7b6f1bf8ab5fea09ed
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jul 7 17:37:44 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11820 DEADCODE Triaged Unassigned Bug Minor Fix Required
idl_new_delete_key() ds/ldap/servers/slapd/back-ldbm/idl_new.c
Comment:
tmpid is no longer used. Since we don't define DB_ALLIDS_ON_WRITE, ALLID has no
chance to be stored in the db. But the code should be fixed as follows:
Remove:
480 ID tmpid = 0;
The 496 must be
496 if (id == ALLID) {
diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c
b/ldap/servers/slapd/back-ldbm/idl_new.c
index 4c7a227..20eee68 100644
--- a/ldap/servers/slapd/back-ldbm/idl_new.c
+++ b/ldap/servers/slapd/back-ldbm/idl_new.c
@@ -437,7 +437,6 @@ int idl_new_delete_key(
int ret = 0;
DBC *cursor = NULL;
DBT data = {0};
- ID tmpid = 0;
/* Make a cursor */
ret = db->cursor(db,txn,&cursor,0);
@@ -453,7 +452,7 @@ int idl_new_delete_key(
/* Position cursor at the key, value pair */
ret = cursor->c_get(cursor,key,&data,DB_GET_BOTH);
if (0 == ret) {
- if (tmpid == ALLID) {
+ if (id == ALLID) {
goto error; /* allid: never delete it */
}
} else {
commit 5c75740c62bd228b2bde244a55467f4724ce80a4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 17:59:53 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11818 DEADCODE Triaged Unassigned Bug Minor Fix Required
agt_mopen_stats() ds/ldap/servers/slapd/agtmmap.c
Comment:
Removing the unreachable statement:
Execution cannot reach this statement "return 0;".
313 return 0;
diff --git a/ldap/servers/slapd/agtmmap.c b/ldap/servers/slapd/agtmmap.c
index 8211b7b..b152a7c 100644
--- a/ldap/servers/slapd/agtmmap.c
+++ b/ldap/servers/slapd/agtmmap.c
@@ -219,7 +219,7 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
} /* end switch */
#else
-
+ /* _WIN32 */
switch (mode) {
case O_RDONLY:
{
@@ -310,8 +310,6 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
#endif /* !__WINNT__ */
-return 0;
-
} /* agt_mopen_stats () */
commit d1946d8f5c1e2f318587c06ecd4016f9b9027783
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 17:46:13 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11817 DEADCODE Triaged Unassigned Bug Moderate Fix Required
NSUniqueAttr_Init() ds/ldap/servers/plugins/uiduniq/uid.c
Comment:
NSUniqueAttr_Init declared err twice. One at the top and another
in BEGIN - END (do - while loop). The second err in the do - while
loop is trashed when it gets out of the loop. Regardless of the
result in the do - while loop, err = 0 (success) was returned to
the caller.
We are removing the second err in the BEGIN (== do - while) scope.
945 int err;
diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c
index 64b5b14..de7310f 100644
--- a/ldap/servers/plugins/uiduniq/uid.c
+++ b/ldap/servers/plugins/uiduniq/uid.c
@@ -942,7 +942,6 @@ NSUniqueAttr_Init(Slapi_PBlock *pb)
int err = 0;
BEGIN
- int err;
int argc;
char **argv;
commit 9533a4085bd1b5d462e322e366e470218f2b03b1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 17:42:37 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11816 DEADCODE Triaged Unassigned Bug Moderate Fix Required
NS7bitAttr_Init() ds/ldap/servers/plugins/uiduniq/7bit.c
Comment:
NS7bitAttr_Init declared err twice. One at the top and another
in BEGIN - END (do - while loop). The second err in the do -
while loop is trashed when it gets out of the loop. Regardless
of the result in the do - while loop, err = 0 (success) was
returned to the caller.
We are removing the second err in the BEGIN (== do - while) scope.
692 int err;
diff --git a/ldap/servers/plugins/uiduniq/7bit.c b/ldap/servers/plugins/uiduniq/7bit.c
index f575d26..f6120d6 100644
--- a/ldap/servers/plugins/uiduniq/7bit.c
+++ b/ldap/servers/plugins/uiduniq/7bit.c
@@ -689,7 +689,6 @@ NS7bitAttr_Init(Slapi_PBlock *pb)
int err = 0;
BEGIN
- int err;
int argc;
char **argv;
commit 732b57f12ed407bf7c1acb661bf48504b42b28ea
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 17:23:07 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11815 DEADCODE Triaged Unassigned Bug Minor Fix Required
distinguishedname_validate() ds/ldap/servers/plugins/syntaxes/validate.c
Comment:
A variable val_copy is declared and initialized, but not used.
We remove these lines:
364 char *val_copy = NULL;
403 if (val_copy) {
Execution cannot reach this statement "slapi_ch_free_string(&val_c...".
404 slapi_ch_free_string(&val_copy);
405 }
diff --git a/ldap/servers/plugins/syntaxes/validate.c
b/ldap/servers/plugins/syntaxes/validate.c
index 989137b..cfdb17f 100644
--- a/ldap/servers/plugins/syntaxes/validate.c
+++ b/ldap/servers/plugins/syntaxes/validate.c
@@ -361,7 +361,6 @@ int distinguishedname_validate(
)
{
int rc = 0; /* Assume value is valid */
- char *val_copy = NULL;
const char *p = begin;
const char *last = NULL;
@@ -400,9 +399,6 @@ int distinguishedname_validate(
}
exit:
- if (val_copy) {
- slapi_ch_free_string(&val_copy);
- }
return rc;
}
commit c766b7ac3ce68eae18ace54805bdd3badcaf7a80
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 17:15:22 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11814 DEADCODE Triaged Unassigned Bug Moderate Fix Required
string_filter_sub() ds/ldap/servers/plugins/syntaxes/string.c
Comment:
A code to update tmpbufsize was missing. This "tpbufsize = len + 1;"
is needed before slapi_ch_realloc.
351 tmpbufsize = len + 1;
352 tmpbuf = (char *) slapi_ch_realloc( tmpbuf, tmpbufsize );
Also, if (len < tmpbufsize) were true (could not be true since
tmpbufsize never have been set), bvp->bv_val was copied to buf
which is not long enough for bvp->bv_val. The bug was also
fixed.
diff --git a/ldap/servers/plugins/syntaxes/string.c
b/ldap/servers/plugins/syntaxes/string.c
index 9131f9f..18e7a05 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -342,15 +342,15 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char
*final,
len = bvp->bv_len;
if ( len < sizeof(buf) ) {
- strcpy( buf, bvp->bv_val );
realval = buf;
+ strncpy( realval, bvp->bv_val, sizeof(buf) );
} else if ( len < tmpbufsize ) {
- strcpy( buf, bvp->bv_val );
realval = tmpbuf;
+ strncpy( realval, bvp->bv_val, tmpbufsize );
} else {
- tmpbuf = (char *) slapi_ch_realloc( tmpbuf, len + 1 );
- strcpy( tmpbuf, bvp->bv_val );
- realval = tmpbuf;
+ tmpbufsize = len + 1;
+ realval = tmpbuf = (char *) slapi_ch_realloc( tmpbuf, tmpbufsize );
+ strncpy( realval, bvp->bv_val, tmpbufsize );
}
/* 3rd arg: 1 - trim leading blanks */
value_normalize_ext( realval, syntax, 1, &alt );
commit c38c2a860937cda0cdbe8f05acaa8083feb8caf1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 16:35:16 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11813 DEADCODE Triaged Unassigned Bug Minor Fix Required
send_dirsync_search() ds/ldap/servers/plugins/replication/windows_connection.c
Comment:
op_string points to a static string:
731 op_string = "search";
We don't need to check op_string in slapi_log_error.
diff --git a/ldap/servers/plugins/replication/windows_connection.c
b/ldap/servers/plugins/replication/windows_connection.c
index 2e24bfe..7adf3be 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -758,7 +758,7 @@ send_dirsync_search(Repl_Connection *conn)
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: Failed to get %s operation: LDAP error %d (%s)\n",
agmt_get_long_name(conn->agmt),
- op_string ? op_string : "NULL", rc, ldap_err2string(rc));
+ op_string, rc, ldap_err2string(rc));
conn->last_ldap_error = rc;
if (IS_DISCONNECT_ERROR(rc))
{
commit e5da45f9754a824c89d4b9e2598f9e9eee8c7823
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 16:24:48 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11812 DEADCODE Triaged Unassigned Bug Moderate Fix Required
repl_objset_destroy() ds/ldap/servers/plugins/replication/repl_objset.c
Comment:
Fixed a typo. The line 182 is supposed to be:
182 if ((co = llistGetFirst((*o)->objects, &cookie)) != NULL)
diff --git a/ldap/servers/plugins/replication/repl_objset.c
b/ldap/servers/plugins/replication/repl_objset.c
index 48c3641..4f28eb8 100644
--- a/ldap/servers/plugins/replication/repl_objset.c
+++ b/ldap/servers/plugins/replication/repl_objset.c
@@ -179,7 +179,7 @@ repl_objset_destroy(Repl_Objset **o, time_t maxwait, FNFree panic_fn)
* function for each remaining object.
*/
PR_Lock((*o)->lock);
- if ((co = llistGetFirst((*o)->objects, &cookie)) == NULL)
+ if ((co = llistGetFirst((*o)->objects, &cookie)) != NULL)
{
panic_fn(co->data);
while (NULL != co)
commit 94c10d34330f455f946003abff378983d730edbf
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 16:14:48 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11811 DEADCODE Triaged Unassigned Bug Minor Fix Required
decode_total_update_extop() ds/ldap/servers/plugins/replication/repl5_total.c
Comment:
dn_csn is declared and initialized, but not really used.
We are removing these lines:
710 CSN *dn_csn = NULL;
816 if (NULL != dn_csn)
817 {
Execution cannot reach this statement "csn_free(&dn_csn);".
818 csn_free(&dn_csn);
819 }
diff --git a/ldap/servers/plugins/replication/repl5_total.c
b/ldap/servers/plugins/replication/repl5_total.c
index f358dad..5416d0c 100644
--- a/ldap/servers/plugins/replication/repl5_total.c
+++ b/ldap/servers/plugins/replication/repl5_total.c
@@ -707,7 +707,6 @@ decode_total_update_extop(Slapi_PBlock *pb, Slapi_Entry **ep)
Slapi_Entry *e = NULL;
Slapi_Attr *attr = NULL;
char *str = NULL;
- CSN *dn_csn = NULL;
struct berval *extop_value = NULL;
char *extop_oid = NULL;
ber_len_t len;
@@ -813,10 +812,6 @@ loser:
/* slapi_ch_free accepts NULL pointer */
slapi_ch_free((void **)&str);
- if (NULL != dn_csn)
- {
- csn_free(&dn_csn);
- }
if (attr != NULL)
{
slapi_attr_free (&attr);
commit 5d9b48948f980619901a3653d092c8dc655231bb
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 16:04:39 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11809 DEADCODE Triaged Unassigned Bug Minor Ignore
_replica_reap_tombstones() ds/ldap/servers/plugins/replication/repl5_replica.c
Comment:
If replica_name is NULL, _replica_reap_tombstones has returned
at the line 2460. Thus there is no need to check "replica_name"
is NULL or not at line 2555.
11810 DEADCODE Triaged Unassigned Bug Moderate Fix Required
replica_check_for_data_reload() ds/ldap/servers/plugins/replication/repl5_replica.c
Comment:
At the line 1478, !cl_cover_be is always true. Therefore,
there is no possibility that "<" is chosen in slapi_log_error.
diff --git a/ldap/servers/plugins/replication/repl5_replica.c
b/ldap/servers/plugins/replication/repl5_replica.c
index 0d2f195..5042f32 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -1476,11 +1476,11 @@ int replica_check_for_data_reload (Replica *r, void *arg)
/* We can't use existing changelog - remove existing file */
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"replica_check_for_data_reload: "
- "Warning: data for replica %s was reloaded and it no longer matches the
data "
+ "Warning: data for replica %s was reloaded and it no longer
matches the data "
"in the changelog (replica data %s changelog). Recreating the
changelog file. This could affect replication "
"with replica's consumers in which case the consumers should
be reinitialized.\n",
escape_string(slapi_sdn_get_dn(r->repl_root),ebuf),
- ((!be_cover_cl && !cl_cover_be) ? "<>" : (!be_cover_cl ?
"<" : ">")) );
+ ((!be_cover_cl) ? "<>" : ">") );
rc = cl5DeleteDBSync (r_obj);
@@ -2554,7 +2554,7 @@ _replica_reap_tombstones(void *arg)
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"Info: No purge CSN for tombstone reap for replica %s.\n",
- replica_name ? replica_name : "(null)");
+ replica_name);
}
done:
commit 51796b5efab4f1a760f4bb2298ede7fcfa2c40ca
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 15:44:23 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11808 DEADCODE Triaged Unassigned Bug Minor Fix Required
replication_multimaster_plugin_init()
ds/ldap/servers/plugins/replication/repl5_init.c
Comment:
There used to be an initializing replica hash code between the
line 573 and 575:
572 /* initialize replica hash - has to be done before mapping tree is
573 initialized so we can't do it in the start function */
575 if (rc != 0)
576 {
Execution cannot reach this statement "slapi_log_error(0, repl_plu...".
577 slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
578 "replication_multimaster_plugin_init: failed to initialize replica
hash\n");
579 return -1;
580 }
The initializing replica hash code was moved out but the comment
and the result checking code were left. Removing them.
Also, setting non 0 value to a static int variable
multimaster_initialised if the plugin registration was successful.
diff --git a/ldap/servers/plugins/replication/repl5_init.c
b/ldap/servers/plugins/replication/repl5_init.c
index 9d8776a..8d4eb1c 100644
--- a/ldap/servers/plugins/replication/repl5_init.c
+++ b/ldap/servers/plugins/replication/repl5_init.c
@@ -571,18 +571,8 @@ int replication_multimaster_plugin_init(Slapi_PBlock *pb)
*/
multimaster_mtnode_extension_init ();
- if(rc==0 && !multimaster_initialised)
+ if(!multimaster_initialised)
{
- /* initialize replica hash - has to be done before mapping tree is
- initialized so we can't do it in the start function */
-
- if (rc != 0)
- {
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "replication_multimaster_plugin_init: failed to initialize replica
hash\n");
- return -1;
- }
-
/* Initialize extensions */
repl_con_init_ext();
repl_sup_init_ext();
@@ -603,6 +593,10 @@ int replication_multimaster_plugin_init(Slapi_PBlock *pb)
rc= slapi_register_plugin("extendedop", 1 /* Enabled */,
"multimaster_end_extop_init", multimaster_end_extop_init, "Multimaster
replication end extended operation plugin", NULL, identity);
rc= slapi_register_plugin("extendedop", 1 /* Enabled */,
"multimaster_total_extop_init", multimaster_total_extop_init, "Multimaster
replication total update extended operation plugin", NULL, identity);
rc= slapi_register_plugin("extendedop", 1 /* Enabled */,
"multimaster_response_extop_init", multimaster_response_extop_init,
"Multimaster replication extended response plugin", NULL, identity);
+ if (0 == rc)
+ {
+ multimaster_initialised = 1;
+ }
}
return rc;
}
commit 2c2b3ecea9f478bc0e7308ace741ee9e2429acb7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 15:13:19 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11806 DEADCODE Triaged Unassigned Bug Moderate Fix Required
agmt_set_last_init_status() ds/ldap/servers/plugins/replication/repl5_agmt.c
Comment:
macro NSDS50_REPL_REPLICA_READY is 0
repl5.h:#define NSDS50_REPL_REPLICA_READY 0x00 /* Replica ready, go ahead */
Because of this if expression:
1991 else if (replrc != 0)
"Replica acquired successfully" never be set to last_init_status.
Removed (replrc == NSDS50_REPL_REPLICA_READY) checking from the
else if (replrc != 0) clause and added "Replica acquired successfully"
to the string to print message since replrc == NSDS50_REPL_REPLICA_READY
there.
11807 DEADCODE Triaged Unassigned Bug Moderate Fix Required
agmt_set_last_update_status() ds/ldap/servers/plugins/replication/repl5_agmt.c
Comment:
macro NSDS50_REPL_REPLICA_READY is 0
repl5.h:#define NSDS50_REPL_REPLICA_READY 0x00 /* Replica ready, go ahead */
Because of this if expression:
1991 else if (replrc != 0)
"Replica acquired successfully" never be set to last_update_status.
Removed (replrc == NSDS50_REPL_REPLICA_READY) checking from the
else if (replrc != 0) clause and added "Replica acquired successfully"
to the string to print message since replrc == NSDS50_REPL_REPLICA_READY
there.
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c
b/ldap/servers/plugins/replication/repl5_agmt.c
index 890452d..b5fcf95 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -1921,14 +1921,10 @@ agmt_set_last_update_status (Repl_Agmt *ra, int ldaprc, int
replrc, const char *
replmsg ? " - " : "", replmsg ? replmsg : "");
}
}
+ /* ldaprc == LDAP_SUCCESS */
else if (replrc != 0)
{
- if (replrc == NSDS50_REPL_REPLICA_READY)
- {
- PR_snprintf(ra->last_update_status, STATUS_LEN, "%d %s",
- ldaprc, "Replica acquired successfully");
- }
- else if (replrc == NSDS50_REPL_REPLICA_BUSY)
+ if (replrc == NSDS50_REPL_REPLICA_BUSY)
{
PR_snprintf(ra->last_update_status, STATUS_LEN,
"%d Can't acquire busy replica", replrc );
@@ -1941,8 +1937,8 @@ agmt_set_last_update_status (Repl_Agmt *ra, int ldaprc, int replrc,
const char *
else if (replrc == NSDS50_REPL_DISABLED)
{
PR_snprintf(ra->last_update_status, STATUS_LEN, "%d Incremental update
aborted: "
- "Replication agreement for %s\n can not
be updated while the replica is disabled.\n"
- "(If the suffix is disabled you must
enable it then restart the server for replication to take place).",
+ "Replication agreement for %s\n can not be updated while the replica is
disabled.\n"
+ "(If the suffix is disabled you must enable it then restart the server for
replication to take place).",
replrc, ra->long_name ? ra->long_name : "a replica");
/* Log into the errors log, as "ra->long_name" is not accessible from
the caller */
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
@@ -1959,11 +1955,14 @@ agmt_set_last_update_status (Repl_Agmt *ra, int ldaprc, int
replrc, const char *
message?" - ":"",message?message:"");
}
}
- else if (message != NULL)
+ else if (message != NULL) /* replrc == NSDS50_REPL_REPLICA_READY == 0 */
{
- PR_snprintf(ra->last_update_status, STATUS_LEN, "%d %s", ldaprc,
message);
+ PR_snprintf(ra->last_update_status, STATUS_LEN,
+ "%d Replica acquired successfully: %s",
+ ldaprc, message);
}
- else { /* agmt_set_last_update_status(0,0,NULL) to reset agmt */
+ else
+ { /* agmt_set_last_update_status(0,0,NULL) to reset agmt */
PR_snprintf(ra->last_update_status, STATUS_LEN, "%d", ldaprc);
}
}
@@ -1999,14 +1998,10 @@ agmt_set_last_init_status (Repl_Agmt *ra, int ldaprc, int replrc,
const char *me
replmsg ? " - " : "", replmsg ? replmsg : "");
}
}
+ /* ldaprc == LDAP_SUCCESS */
else if (replrc != 0)
{
- if (replrc == NSDS50_REPL_REPLICA_READY)
- {
- PR_snprintf(ra->last_init_status, STATUS_LEN, "%d %s",
- ldaprc, "Replica acquired successfully");
- }
- else if (replrc == NSDS50_REPL_REPLICA_RELEASE_SUCCEEDED)
+ if (replrc == NSDS50_REPL_REPLICA_RELEASE_SUCCEEDED)
{
PR_snprintf(ra->last_init_status, STATUS_LEN, "%d %s",
ldaprc, "Replication session successful");
@@ -2014,8 +2009,8 @@ agmt_set_last_init_status (Repl_Agmt *ra, int ldaprc, int replrc,
const char *me
else if (replrc == NSDS50_REPL_DISABLED)
{
PR_snprintf(ra->last_init_status, STATUS_LEN, "%d Total update aborted:
"
- "Replication agreement for %s\n can not
be updated while the replica is disabled.\n"
- "(If the suffix is disabled you must
enable it then restart the server for replication to take place).",
+ "Replication agreement for %s\n can not be updated while the replica is
disabled.\n"
+ "(If the suffix is disabled you must enable it then restart the server for
replication to take place).",
replrc, ra->long_name ? ra->long_name : "a replica");
/* Log into the errors log, as "ra->long_name" is not accessible from
the caller */
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
@@ -2032,11 +2027,14 @@ agmt_set_last_init_status (Repl_Agmt *ra, int ldaprc, int replrc,
const char *me
message?" - ":"",message?message:"");
}
}
- else if (message != NULL)
+ else if (message != NULL) /* replrc == NSDS50_REPL_REPLICA_READY == 0 */
{
- PR_snprintf(ra->last_init_status, STATUS_LEN, "%d %s", ldaprc, message);
+ PR_snprintf(ra->last_init_status, STATUS_LEN,
+ "%d Replica acquired successfully: %s",
+ ldaprc, message);
}
- else { /* agmt_set_last_init_status(0,0,NULL) to reset agmt */
+ else
+ { /* agmt_set_last_init_status(0,0,NULL) to reset agmt */
PR_snprintf(ra->last_init_status, STATUS_LEN, "%d", ldaprc);
}
}
commit 7a5db43cc8dd899b62416a683c701416dd5d96e7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 13:53:17 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11805 DEADCODE Triaged Unassigned Bug Minor Ignore
clcache_load_buffer_bulk() ds/ldap/servers/plugins/replication/cl5_clcache.c
Comment:
Experimented the transaction control, but it was not adopted.
383 /* txn control seems not improving anything so turn it off */
Comment out these lines.
418 if ( txn ) {
Execution cannot reach this statement "(*txn->commit)(txn, 256U);".
419 txn->commit ( txn, DB_TXN_NOSYNC );
420 }
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c
b/ldap/servers/plugins/replication/cl5_clcache.c
index 07bc6bb..31947d3 100644
--- a/ldap/servers/plugins/replication/cl5_clcache.c
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
@@ -380,12 +380,11 @@ clcache_load_buffer_bulk ( CLC_Buffer *buf, int flag )
DBC *cursor = NULL;
int rc;
- /* txn control seems not improving anything so turn it off */
- /*
+#if 0 /* txn control seems not improving anything so turn it off */
if ( *(_pool->pl_dbenv) ) {
txn_begin( *(_pool->pl_dbenv), NULL, &txn, 0 );
}
- */
+#endif
PR_Lock ( buf->buf_busy_list->bl_lock );
if ( 0 == ( rc = clcache_open_cursor ( txn, buf, &cursor )) ) {
@@ -415,9 +414,11 @@ clcache_load_buffer_bulk ( CLC_Buffer *buf, int flag )
cursor->c_close ( cursor );
}
+#if 0 /* txn control seems not improving anything so turn it off */
if ( txn ) {
txn->commit ( txn, DB_TXN_NOSYNC );
}
+#endif
PR_Unlock ( buf->buf_busy_list->bl_lock );
commit 8672c1fddb51e72329618ae07c2af1cf1b577176
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 13:35:53 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11803 DEADCODE Triaged Unassigned Bug Minor Fix Required
_cl5GetFirstEntry() ds/ldap/servers/plugins/replication/cl5_api.c
11804 DEADCODE Triaged Unassigned Bug Minor Fix Required
_cl5GetNextEntry() ds/ldap/servers/plugins/replication/cl5_api.c
Comment:
Eliminated unnecessary codes.
diff --git a/ldap/servers/plugins/replication/cl5_api.c
b/ldap/servers/plugins/replication/cl5_api.c
index f61bd0a..6aec7b2 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -5538,22 +5538,11 @@ static int _cl5GetFirstEntry (Object *obj, CL5Entry *entry, void
**iterator, DB_
}
/* db error occured while iterating */
- if (rc != 0)
- {
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
- "_cl5GetFirstEntry: failed to get entry; db error - %d %s\n", rc,
db_strerror(rc));
- rc = CL5_DB_ERROR;
- goto done;
- }
-
- /* successfully retrieved next entry but it was out of range */
- if (rc == CL5_SUCCESS)
- {
- slapi_ch_free (&(key.data));
- slapi_ch_free (&(data.data));
- rc = CL5_NOTFOUND;
- goto done;
- }
+ /* On this path, the condition "rc != 0" cannot be false */
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5GetFirstEntry: failed to get entry; db error - %d %s\n",
+ rc, db_strerror(rc));
+ rc = CL5_DB_ERROR;
done:;
/* error occured */
@@ -5621,15 +5610,11 @@ static int _cl5GetNextEntry (CL5Entry *entry, void *iterator)
}
/* cursor operation failed */
- if (rc != 0)
- {
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
- "_cl5GetNextEntry: failed to get entry; db error - %d %s\n", rc,
db_strerror(rc));
-
- return CL5_DB_ERROR;
- }
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5GetNextEntry: failed to get entry; db error - %d %s\n",
+ rc, db_strerror(rc));
- return rc;
+ return CL5_DB_ERROR;
}
static int _cl5CurrentDeleteEntry (void *iterator)
commit 40cbfa6cc5f5781cfe4a3bd41f6acd648bf1e23e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 11:46:21 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11802 DEADCODE Triaged Unassigned Bug Minor Ignore
dna_get_next_value() ds/ldap/servers/plugins/dna/dna.c
Comment:
Merged 2 pblock destroy codes slapi_pblock_destroy(pb) to
one at the end of the function dna_get_next_value.
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index dfa86c4..0059546 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -2016,9 +2016,6 @@ static int dna_get_next_value(struct configEntry *config_entry,
slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
-
- slapi_pblock_destroy(pb);
- pb = NULL;
}
if (LDAP_SUCCESS == ret) {
@@ -2036,8 +2033,9 @@ static int dna_get_next_value(struct configEntry *config_entry,
done:
slapi_unlock_mutex(config_entry->lock);
- if (pb)
+ if (pb) {
slapi_pblock_destroy(pb);
+ }
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"<-- dna_get_next_value\n");
commit 110546612d0e004363cee2dc77fd451967940ebc
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 11:35:42 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11800 DEADCODE Triaged Unassigned Bug Minor Fix Required
cos_cache_add_defn() ds/ldap/servers/plugins/cos/cos_cache.c
Comment:
If theDef points to the allocated memory at the line 1410, ret never becomes -1. Thus,
theDef never be non-NULL at 1497. Removing
1497 if(theDef)
1498 slapi_ch_free((void**)&theDef);
11801 DEADCODE Triaged Unassigned Bug Minor Fix Required
cos_cache_follow_pointer() ds/ldap/servers/plugins/cos/cos_cache.c
Comment:
default is not needed:
3525 default:
3526 goto bail;
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index bc79ee5..89902f8 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -1494,8 +1494,6 @@ static int cos_cache_add_defn(
cos_cache_del_attrval_list(spec);
if(pAttrs)
cos_cache_del_attrval_list(pAttrs);
- if(theDef)
- slapi_ch_free((void**)&theDef);
}
LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_defn\n",0,0,0);
@@ -3521,9 +3519,6 @@ static int cos_cache_follow_pointer( vattr_context *c, const char
*dn, char *typ
/* this must be a compare op */
ret = slapi_vattr_value_compare_sp(c, pEntryList[0],type, test_this, result,
flags);
break;
-
- default:
- goto bail;
}
}
}
commit 92bf4eb29d084d72ab55c09f830f62fd4aadce2d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 11:02:07 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11798 DEADCODE Triaged Unassigned Bug Moderate Fix Required
cb_sasl_bind_once_s() ds/ldap/servers/plugins/chainingdb/cb_bind.c
Comment:
This is not a DEADCODE problem, but a half-baked implementation
considering this comment:
190 /* realloc matcheddn & errmsg because the mem alloc model */
191 /* may differ from malloc
The author intended this:
184 rc = ldap_parse_result( ld, result, status, &matcheddnp2, &errmsgp2,
185 &referrals, resctrlsp, 1 );
diff --git a/ldap/servers/plugins/chainingdb/cb_bind.c
b/ldap/servers/plugins/chainingdb/cb_bind.c
index 638404a..71d1ade 100644
--- a/ldap/servers/plugins/chainingdb/cb_bind.c
+++ b/ldap/servers/plugins/chainingdb/cb_bind.c
@@ -181,7 +181,7 @@ cb_sasl_bind_once_s( cb_conn_pool *pool, char *dn, int method, char *
mechanism,
char * matcheddnp2, * errmsgp2;
matcheddnp2=errmsgp2=NULL;
*resctrlsp=NULL;
- rc = ldap_parse_result( ld, result, status, matcheddnp, errmsgp,
+ rc = ldap_parse_result( ld, result, status, &matcheddnp2, &errmsgp2,
&referrals, resctrlsp, 1 );
if ( referrals != NULL ) {
*refurlsp = referrals2berval( referrals );
commit de66a9e1a83ca5f9dacbfc87bf944ebaa8291058
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 10:47:15 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11796 DEADCODE Triaged Unassigned Bug Minor Ignore
slapi_ldap_init_ext() ds/ldap/servers/slapd/ldaputil.c
Comment:
ldapurl is guaranteed not NULL.
323 slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_init_ext",
324 "Could not parse given LDAP URL [%s] : error [%s]\n",
325 ldapurl ? ldapurl : "NULL",
326 slapi_urlparse_err2string(rc));
11797 DEADCODE Triaged Unassigned Bug Minor Ignore
slapi_ldap_bind() ds/ldap/servers/slapd/ldaputil.c
Comment:
It is guaranteed that mech has some value at the line 755.
755 slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
756 "Error: could not perform interactive bind for id "
757 "[%s] mech [%s]: error %d (%s)\n",
758 bindid ? bindid : "(anon)",
759 mech ? mech : "SIMPLE",
760 rc, ldap_err2string(rc));
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 2c5b0c9..1ebd479 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -322,7 +322,7 @@ slapi_ldap_init_ext(
!ludp)) {
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_init_ext",
"Could not parse given LDAP URL [%s] : error [%s]\n",
- ldapurl ? ldapurl : "NULL",
+ ldapurl, /* ldapurl cannot be NULL here */
slapi_urlparse_err2string(rc));
goto done;
}
@@ -756,7 +756,7 @@ slapi_ldap_bind(
"Error: could not perform interactive bind for id "
"[%s] mech [%s]: error %d (%s)\n",
bindid ? bindid : "(anon)",
- mech ? mech : "SIMPLE",
+ mech, /* mech cannot be SIMPLE here */
rc, ldap_err2string(rc));
}
}
commit 782432e0ea5e795dd4fa7eb0b3c04df28d8fa072
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 10:31:17 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11795 DEADCODE Triaged Unassigned Bug Minor Fix Required
DS_LASRoleDnAttrEval() ds/ldap/servers/plugins/acl/acllas.c
Comment:
Merged the 2 lines to check matched with ACL_TRUE into one.
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index 12cefaf..5de1866 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -3920,16 +3920,10 @@ DS_LASRoleDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t
comparator,
** Let's compare with the client, thi might be just an user. If it is not
** then we test it against the list of groups.
*/
- if ((matched = acllas__user_has_role(
- lasinfo.aclpb,
- roleDN,
- lasinfo.aclpb->aclpb_authorization_sdn)) == ACL_TRUE){
- slapi_ch_free ( (void **)&n_attrval );
- slapi_sdn_free(&roleDN );
- break;
- }
+ matched = acllas__user_has_role(lasinfo.aclpb,
+ roleDN, lasinfo.aclpb->aclpb_authorization_sdn);
slapi_ch_free ( (void **)&n_attrval );
- slapi_sdn_free(&roleDN );
+ slapi_sdn_free(&roleDN);
if (matched == ACL_TRUE) {
break;
} else if ( matched == ACL_DONT_KNOW ) {
commit 92d7458355c775ddd62bb82c58cffe2472ee5ff9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 2 10:04:48 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11794 DEADCODE Triaged Unassigned Bug Minor Ignore
slapi_dn_syntax_check() ds/ldap/servers/slapd/plugin_syntax.c
Comment:
Checking for the possibility of dn == NULL is not needed
since it is already checked at the line 303.
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index 5018326..174b136 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -319,7 +319,7 @@ slapi_dn_syntax_check(
if (dn_plugin->plg_syntax_validate(&dn_bval) != 0) {
if (syntaxlogging) {
slapi_log_error( SLAPI_LOG_FATAL, "Syntax Check",
- "DN value (%s) invalid per syntax\n", dn ? dn : "");
+ "DN value (%s) invalid per syntax\n", dn);
}
if (syntaxcheck || override) {
commit 889e07426f879ee8c999692a298f48221805ec06
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jul 23 11:17:37 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11792 DEADCODE Triaged Unassigned Bug Minor Fix Required
acl__match_handlesFromCache() ds/ldap/servers/plugins/acl/acl.c
Comment:
Looks like a simple copy & paste bug. Replaced the macro to
compare ACLPB_HAS_ACLCB_EVALCONTEXT with ACLPB_EVALCONTEXT_ACLCB.
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 43b289e..a96a34b 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -3748,7 +3748,7 @@ acl__match_handlesFromCache ( Acl_PBlock *aclpb, char *attr, int
access)
aclpb->aclpb_state &= ~ACLPB_MATCHES_ALL_ACLS;
aclpb->aclpb_state |= ACLPB_UPD_ACLCB_CACHE;
/* Did not match */
- if ( context_type == ACLPB_HAS_ACLCB_EVALCONTEXT ) {
+ if ( context_type == ACLPB_EVALCONTEXT_ACLCB ) {
aclpb->aclpb_state &= ~ACLPB_HAS_ACLCB_EVALCONTEXT;
} else {
aclpb->aclpb_state |= ACLPB_COPY_EVALCONTEXT;