Thursday, May 25, 2017

[389-commits] [389-ds-base] 01/01: Ticket 49269 - Fix coverity errors

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch master
in repository 389-ds-base.

commit c2c512e4faf4f86d05d94aa2117a1a4910f81dfd
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Wed May 24 10:56:22 2017 -0400

Ticket 49269 - Fix coverity errors

Desciption: Fix coverity and clanf errors/warnings. Also fix a compiler warning

https://pagure.io/389-ds-base/issue/49269

Reviewed by: firstyear(Thanks!)
---
ldap/servers/plugins/http/http_impl.c | 9 ++++++++-
ldap/servers/plugins/pwdstorage/crypt_pwd.c | 3 +++
ldap/servers/plugins/replication/repl_extop.c | 5 +++--
ldap/servers/slapd/pw_verify.c | 2 +-
lib/libaccess/oneeval.cpp | 2 +-
5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/ldap/servers/plugins/http/http_impl.c b/ldap/servers/plugins/http/http_impl.c
index 7accdf6..1ca0416 100644
--- a/ldap/servers/plugins/http/http_impl.c
+++ b/ldap/servers/plugins/http/http_impl.c
@@ -591,15 +591,22 @@ static PRStatus sendPostReq(PRFileDesc *fd, const char *path, httpheader **httph
PRInt32 http_connection_time_out = 0;
int i = 0;
int body_len, buflen = 0;
+ int path_len;

if (body) {
body_len = strlen(body);
} else {
body_len = 0;
}
+ if (path) {
+ path_len = strlen(path);
+ } else {
+ path_len = 0;
+ }
+
PR_snprintf(body_len_str, sizeof(body_len_str), "%d", body_len);

- buflen = (HTTP_POST_STD_LEN + strlen(path) + body_len + strlen(body_len_str));
+ buflen = (HTTP_POST_STD_LEN + path_len + body_len + strlen(body_len_str));

for (i = 0; httpheaderArray[i] != NULL; i++) {

diff --git a/ldap/servers/plugins/pwdstorage/crypt_pwd.c b/ldap/servers/plugins/pwdstorage/crypt_pwd.c
index 03b442a..341fc20 100644
--- a/ldap/servers/plugins/pwdstorage/crypt_pwd.c
+++ b/ldap/servers/plugins/pwdstorage/crypt_pwd.c
@@ -108,6 +108,9 @@ crypt_pw_enc_by_hash( const char *pwd, int hash_algo){
algo_salt = slapi_ch_smprintf("$5$%s", salt);
} else if (hash_algo == CRYPT_SHA512) {
algo_salt = slapi_ch_smprintf("$6$%s", salt);
+ } else {
+ /* default to CRYPT_UNIX */
+ algo_salt = strdup(salt);
}

PR_Lock(cryptlock);
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 51287ca..40e66f9 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -1158,7 +1158,8 @@ send_response:

r_locking_conn = replica_get_locking_conn(r);
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "multimaster_extop_StartNSDS50ReplicationRequest - "
- "already acquired replica: locking_conn=%d, current connid=%d\n", (int) r_locking_conn, (int) connid);
+ "already acquired replica: locking_conn=%" PRIu64 ", current connid=%" PRIu64 "\n",
+ r_locking_conn, connid);

if ((r_locking_conn != ULONG_MAX) && (r_locking_conn == connid)) {
replica_relinquish_exclusive_access(r, connid, opid);
@@ -1174,7 +1175,7 @@ send_response:
* that the RA will restart a new session in a clear state
*/
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "multimaster_extop_StartNSDS50ReplicationRequest - "
- "already acquired replica: disconnect conn=%d\n", connid);
+ "already acquired replica: disconnect conn=%" PRIu64 "\n", connid);
slapi_disconnect_server(conn);

}
diff --git a/ldap/servers/slapd/pw_verify.c b/ldap/servers/slapd/pw_verify.c
index 852b027..7cdd4c8 100644
--- a/ldap/servers/slapd/pw_verify.c
+++ b/ldap/servers/slapd/pw_verify.c
@@ -118,7 +118,7 @@ pw_validate_be_dn(Slapi_PBlock *pb, Slapi_Entry **referral)
}

/* We need a slapi_sdn_isanon? */
- if (method == LDAP_AUTH_SIMPLE && cred->bv_len == 0) {
+ if (method == LDAP_AUTH_SIMPLE && (cred == NULL || cred->bv_len == 0)) {
return SLAPI_BIND_ANONYMOUS;
}

diff --git a/lib/libaccess/oneeval.cpp b/lib/libaccess/oneeval.cpp
index dc07ebd..d8bdd9a 100644
--- a/lib/libaccess/oneeval.cpp
+++ b/lib/libaccess/oneeval.cpp
@@ -658,7 +658,7 @@ ACL_INTEvalTestRights(
* place to do it.
*/

- while (*rights)
+ while (*rights && rights_cnt < ACL_MAX_TEST_RIGHTS)
{
rarray_p = &rights_arry[rights_cnt];


--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org

No comments:

Post a Comment