From 6e376ee273cb95afae31b0183e3b7bf3468c4520 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 09:37:36 +0200 Subject: [PATCH 01/12] db_berkeley: fix compilation warning > km_db_berkeley.c:486:58: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] > if ((ret = bdb_get_columns(_tbc->dtp, *_r, lres, _nc)) < 0) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ > km_db_berkeley.c:513:50: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] > if ((ret=bdb_append_row( *_r, dbuf, lres, i)) < 0) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ > km_db_berkeley.c:567:58: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] > if ((ret = bdb_get_columns(_tbc->dtp, *_r, lres, _nc)) < 0) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ > km_db_berkeley.c:572:47: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] > if ((ret=bdb_convert_row( *_r, dbuf, lres)) < 0) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ > 4 warnings generated. --- modules/db_berkeley/km_db_berkeley.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/db_berkeley/km_db_berkeley.c b/modules/db_berkeley/km_db_berkeley.c index 9b0806ef3e3..e7e05f5fd68 100644 --- a/modules/db_berkeley/km_db_berkeley.c +++ b/modules/db_berkeley/km_db_berkeley.c @@ -362,9 +362,10 @@ int km_bdb_query(db1_con_t* _con, db_key_t* _k, db_op_t* _op, db_val_t* _v, table_p _tp = NULL; char kbuf[MAX_ROW_SIZE]; char dbuf[MAX_ROW_SIZE]; - u_int32_t i, len, ret; + u_int32_t i, len; int klen=MAX_ROW_SIZE; int *lkey=NULL, *lres=NULL; + int ret; DBT key, data; DB *db; DBC *dbcp; From 1db19f1672ebebcb916f4415c59f5c820a1b0068 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 09:45:38 +0200 Subject: [PATCH 02/12] auth_radius: fix compilation warning > authorize.c:110:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_NONCE_REUSED; > ~ ^~~~~~~~~~~~~~~~~ > authorize.c:114:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_STALE_NONCE; > ~ ^~~~~~~~~~~~~~~~ > authorize.c:120:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_ERROR; > ~ ^~~~~~~~~~ > authorize.c:124:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_NO_CREDENTIALS; > ~ ^~~~~~~~~~~~~~~~~~~ > authorize.c:131:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_OK; > ~ ^~~~~~~ > authorize.c:148:9: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_ERROR; > ~ ^~~~~~~~~~ > authorize.c:153:12: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_ERROR; > ~ ^~~~~~~~~~ > authorize.c:159:12: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_ERROR;; > ~ ^~~~~~~~~~ > authorize.c:186:12: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_ERROR; > ~ ^~~~~~~~~~ > authorize.c:189:12: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_OK; > ~ ^~~~~~~ > authorize.c:193:8: warning: implicit conversion from enumeration type 'enum auth_cfg_result' to different enumeration type 'auth_result_t' (aka 'enum auth_result') [-Wenum-conversion] > ret = AUTH_INVALID_PASSWORD; > ~ ^~~~~~~~~~~~~~~~~~~~~ > 11 warnings generated. --- modules/auth_radius/authorize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/auth_radius/authorize.c b/modules/auth_radius/authorize.c index 18dff11597f..36c74ebc8d7 100644 --- a/modules/auth_radius/authorize.c +++ b/modules/auth_radius/authorize.c @@ -74,7 +74,7 @@ static inline int authorize(struct sip_msg* _msg, pv_elem_t* _realm, pv_spec_t * _uri_user, hdr_types_t _hftype) { int res; - auth_result_t ret; + auth_cfg_result_t ret; struct hdr_field* h; auth_body_t* cred; str *uri_user; From 4e2f17dfc6ae25739cb40328f3d5636ea1ab6fca Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:03:42 +0200 Subject: [PATCH 03/12] misc_radius: fix compilation warning > functions.c:47:27: warning: comparison of array 'vp->strvalue' equal to a null pointer is always false [-Wtautological-pointer-compare] > if (vp->lvalue==0 || vp->strvalue==0) > ~~~~^~~~~~~~ ~ > 1 warning generated. --- modules/misc_radius/functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/misc_radius/functions.c b/modules/misc_radius/functions.c index fb9ec784c1f..e171468a748 100644 --- a/modules/misc_radius/functions.c +++ b/modules/misc_radius/functions.c @@ -44,7 +44,7 @@ static inline int extract_avp(VALUE_PAIR* vp, unsigned short *flags, char *end; /* empty? */ - if (vp->lvalue==0 || vp->strvalue==0) + if (vp->lvalue==0) goto error; p = vp->strvalue; From bb545d02225f23e7d1d9c950f2e4645db3d33c4f Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:05:45 +0200 Subject: [PATCH 04/12] peering: fix compilation warning > verify.c:58:30: warning: comparison of array 'vp->strvalue' equal to a null pointer is always false [-Wtautological-pointer-compare] > if (vp->lvalue==0 || vp->strvalue==0) > ~~~~^~~~~~~~ ~ > 1 warning generated. --- modules/peering/verify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/peering/verify.c b/modules/peering/verify.c index cafd12ccad7..743fcfe2992 100644 --- a/modules/peering/verify.c +++ b/modules/peering/verify.c @@ -55,7 +55,7 @@ static inline int extract_avp(VALUE_PAIR* vp, unsigned short *flags, char *end; /* empty? */ - if (vp->lvalue==0 || vp->strvalue==0) + if (vp->lvalue==0) goto error; p = vp->strvalue; From c3bbe6e059ade56959b68e6caae2f8521734f502 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:10:13 +0200 Subject: [PATCH 05/12] pua_xmpp: fix compilation warning > xmpp2simple.c:372:10: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion] > slash= '\0'; > ^~~~ > 1 warning generated. --- modules/pua_xmpp/xmpp2simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pua_xmpp/xmpp2simple.c b/modules/pua_xmpp/xmpp2simple.c index 0d141255651..709351c9c0d 100644 --- a/modules/pua_xmpp/xmpp2simple.c +++ b/modules/pua_xmpp/xmpp2simple.c @@ -369,7 +369,7 @@ int build_publish(xmlNodePtr pres_node, int expires) return -1; } strcpy(resource, slash+1); - slash= '\0'; + slash= NULL; } pres_uri= euri_xmpp_sip(uri); xmlFree(uri); From 007bd7e0c874f25ff73bfd36bd210b0fed2bac7a Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:22:57 +0200 Subject: [PATCH 06/12] cdp: fix compilation warning > peerstatemachine.c:97:19: warning: implicit conversion from enumeration type 'peer_state_t' to different enumeration type 'peer_event_t' [-Wenum-conversion] > next_event = I_Snd_Conn_Req(p); > ~ ^~~~~~~~~~~~~~~~~ > peerstatemachine.c:531:10: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion] > return I_Rcv_Conn_NAck; > ~~~~~~ ^~~~~~~~~~~~~~~ > peerstatemachine.c:534:9: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion] > return I_Rcv_Conn_Ack; > ~~~~~~ ^~~~~~~~~~~~~~ > 3 warnings generated. --- modules/cdp/peerstatemachine.c | 2 +- modules/cdp/peerstatemachine.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cdp/peerstatemachine.c b/modules/cdp/peerstatemachine.c index b5e6dd7ae7c..c69cc9972a7 100644 --- a/modules/cdp/peerstatemachine.c +++ b/modules/cdp/peerstatemachine.c @@ -519,7 +519,7 @@ int sm_process(peer *p,peer_event_t event,AAAMessage *msg,int peer_locked,int so * @param p - peer to send to * @returns the new state for the peer */ -peer_state_t I_Snd_Conn_Req(peer *p) +peer_event_t I_Snd_Conn_Req(peer *p) { LM_INFO("I_Snd_Conn_Req(): Peer %.*s \n", p->fqdn.len,p->fqdn.s); diff --git a/modules/cdp/peerstatemachine.h b/modules/cdp/peerstatemachine.h index 47d93f8433c..4b9ef8a3c36 100644 --- a/modules/cdp/peerstatemachine.h +++ b/modules/cdp/peerstatemachine.h @@ -50,7 +50,7 @@ int sm_process(peer *p,peer_event_t event,AAAMessage *msg,int peer_locked,int sock); -peer_state_t I_Snd_Conn_Req(peer *p); +peer_event_t I_Snd_Conn_Req(peer *p); void Cleanup(peer *p,int sock); void Error(peer *p, int sock); void I_Snd_CER(peer *p); From 26d1426cfeb926ee440542716e7365d16b627801 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:24:01 +0200 Subject: [PATCH 07/12] cdp: fix compilation warnings > peerstatemachine.c:97:19: warning: implicit conversion from enumeration type 'peer_state_t' to different enumeration type 'peer_event_t' [-Wenum-conversion] > next_event = I_Snd_Conn_Req(p); > ~ ^~~~~~~~~~~~~~~~~ > peerstatemachine.c:531:10: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion] > return I_Rcv_Conn_NAck; > ~~~~~~ ^~~~~~~~~~~~~~~ > peerstatemachine.c:534:9: warning: implicit conversion from enumeration type 'peer_event_t' to different enumeration type 'peer_state_t' [-Wenum-conversion] > return I_Rcv_Conn_Ack; > ~~~~~~ ^~~~~~~~~~~~~~ > 3 warnings generated. --- modules/cdp/session.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cdp/session.c b/modules/cdp/session.c index f418204fe62..3c904c3e9bf 100644 --- a/modules/cdp/session.c +++ b/modules/cdp/session.c @@ -73,7 +73,7 @@ unsigned int *session_id2; /**< counter for second part of the session id */ inline void AAASessionsLock(unsigned int hash) { if(destroy_modules_phase()) return; - if ( hash >=0 && hash < sessions_hash_size ){ + if ( hash < sessions_hash_size ){ lock_get(sessions[hash].lock); } else { @@ -88,7 +88,7 @@ inline void AAASessionsUnlock(unsigned int hash) { if(destroy_modules_phase()) return; - if ( hash >=0 && hash < sessions_hash_size ){ + if ( hash < sessions_hash_size ){ lock_release(sessions[hash].lock); } else { @@ -330,7 +330,7 @@ void del_session(cdp_session_t *x) if (!x) return; hash = x->hash; - if (hash < 0 || hash >= sessions_hash_size) { + if (hash >= sessions_hash_size) { LM_ERR("del_session: x->hash :%d out of range of sessions_hash_size: %d !\n",hash, sessions_hash_size); return; } From 64091168246c28b560e79ad0a19d1f97c12cb894 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:39:43 +0200 Subject: [PATCH 08/12] cdp: fix compilation warning > diameter_msg.c:443:10: warning: implicit conversion from enumeration type 'AAAReturnCode' to different enumeration type 'AAAResultCode' [-Wenum-conversion] > return AAA_ERR_SUCCESS; > ~~~~~~ ^~~~~~~~~~~~~~~ > 1 warning generated. --- modules/cdp/diameter_api.h | 2 +- modules/cdp/diameter_msg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cdp/diameter_api.h b/modules/cdp/diameter_api.h index c0d049578bb..f9ba4181484 100644 --- a/modules/cdp/diameter_api.h +++ b/modules/cdp/diameter_api.h @@ -76,7 +76,7 @@ typedef AAAReturnCode (*AAAFreeAVPList_f)(AAA_AVP_LIST *avpList); -AAAResultCode AAASetMessageResultCode(AAAMessage *message,AAAResultCode resultCode); +AAAReturnCode AAASetMessageResultCode(AAAMessage *message,AAAResultCode resultCode); void AAAPrintMessage(AAAMessage *msg); diff --git a/modules/cdp/diameter_msg.c b/modules/cdp/diameter_msg.c index 0814a9323a2..3630d40f1f0 100644 --- a/modules/cdp/diameter_msg.c +++ b/modules/cdp/diameter_msg.c @@ -434,7 +434,7 @@ AAAReturnCode AAAFreeMessage(AAAMessage **msg) * @param resultCode - code to set as result * \note This function is taken from DISC http://developer.berlios.de/projects/disc/ */ -AAAResultCode AAASetMessageResultCode( +AAAReturnCode AAASetMessageResultCode( AAAMessage *message, AAAResultCode resultCode) { From 4fa83825c7bd51d59d9788c6fd7dd532b5bce398 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 10:58:29 +0200 Subject: [PATCH 09/12] ims_dialog: fix compilation warning > dlg_handlers.c:1345:63: warning: address of 'rpl->via1->branch->value' will always evaluate to 'true' [-Wpointer-bool-conversion] > if (rpl->via1->branch && (&rpl->via1->branch->value) && (rpl->via1->branch->value.len > 0)) { > ~~ ~~~~~~~~~~~~~~~~~~~^~~~~ > 1 warning generated. --- modules/ims_dialog/dlg_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ims_dialog/dlg_handlers.c b/modules/ims_dialog/dlg_handlers.c index 394c7798dd0..faf76787095 100644 --- a/modules/ims_dialog/dlg_handlers.c +++ b/modules/ims_dialog/dlg_handlers.c @@ -1342,7 +1342,7 @@ void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) { if (!dlg_out) { if (rpl->first_line.u.reply.statuscode < 299) { /*we don't care about failure responses to dialog - not necessary to create dialog out...*/ - if (rpl->via1->branch && (&rpl->via1->branch->value) && (rpl->via1->branch->value.len > 0)) { + if (rpl->via1->branch && (rpl->via1->branch->value.len > 0)) { branch = rpl->via1->branch->value; } From 8b75904980f7f7669fe35676a4042e387e29f352 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 11:03:10 +0200 Subject: [PATCH 10/12] ims_auth: fix compilation warnigns > cxdx_avp.c:661:26: warning: comparison of constant 4 with boolean expression is always false [-Wtautological-constant-out-of-range-compare] > if (!avp||!avp->data.len==4) *item_number=0; > ~~~~~~~~~~~~~~^ ~ > 1 warning generated. > cxdx_mar.c:372:45: warning: comparison of constant 32 with boolean expression is always false [-Wtautological-constant-out-of-range-compare] > if (!tmp->response_auth.len == 32 > ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ --- modules/ims_auth/cxdx_avp.c | 2 +- modules/ims_auth/cxdx_mar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ims_auth/cxdx_avp.c b/modules/ims_auth/cxdx_avp.c index a09e6b24b22..bd4031c8406 100644 --- a/modules/ims_auth/cxdx_avp.c +++ b/modules/ims_auth/cxdx_avp.c @@ -658,7 +658,7 @@ int cxdx_get_auth_data_item_answer(AAAMessage *msg, AAA_AVP **auth_data, avp = cdpb.AAAFindMatchingAVPList(list,0,AVP_IMS_SIP_Item_Number, IMS_vendor_id_3GPP,0); - if (!avp||!avp->data.len==4) *item_number=0; + if (!avp||avp->data.len!=4) *item_number=0; else *item_number = get_4bytes(avp->data.s); avp = cdpb.AAAFindMatchingAVPList(list,0,AVP_IMS_SIP_Authentication_Scheme, diff --git a/modules/ims_auth/cxdx_mar.c b/modules/ims_auth/cxdx_mar.c index 1f81d0c340b..a949edd5e25 100644 --- a/modules/ims_auth/cxdx_mar.c +++ b/modules/ims_auth/cxdx_mar.c @@ -373,7 +373,7 @@ void async_cdp_callback(int is_timeout, void *param, AAAMessage *maa, long elaps &scscf_name_str, 0, result_hex); pkg_free(etsi_nonce.s); - if (!tmp->response_auth.len == 32 + if (tmp->response_auth.len != 32 || strncasecmp(tmp->response_auth.s, result_hex, 32)) { LM_ERR("The HSS' Response-Auth is different from what we compute locally!\n" " BUT! If you sent an MAR with auth scheme unknown (HSS-Selected Authentication), this is normal.\n" From 44d17221c3a72401b1d3157cc969acf07cb80bd0 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 11:41:14 +0200 Subject: [PATCH 11/12] app_java: fix compiler warning > java_msgobj.c:233:80: warning: comparison of array 'msg->add_to_branch_s' equal to a null pointer is always false [-Wtautological-pointer-compare] > jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0 || msg->add_to_branch_s == NULL) ? "" : strdup(msg->add_to_branch_s)); > ~~~~~^~~~~~~~~~~~~~~ ~~~~ > 1 warning generated. --- modules/app_java/java_msgobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/app_java/java_msgobj.c b/modules/app_java/java_msgobj.c index 0a43786feaa..fc32849684f 100644 --- a/modules/app_java/java_msgobj.c +++ b/modules/app_java/java_msgobj.c @@ -230,7 +230,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg) LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.add_to_branch_s\n", APP_NAME); return NULL; } - jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0 || msg->add_to_branch_s == NULL) ? "" : strdup(msg->add_to_branch_s)); + jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0) ? "" : strdup(msg->add_to_branch_s)); (*env)->SetObjectField(env, SipMsgInstance, fid, jStrParam); if ((*env)->ExceptionCheck(env)) { From f0ac15dc896f959cb92ad85fd1426fac1aa0bb55 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 6 Jun 2016 11:47:23 +0200 Subject: [PATCH 12/12] tls: fix compilation warning > tls_config.c:403:6: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] > write(out_fd, &ch, 1); > ^~~~~ ~~~~~~~~~~~~~~ > tls_config.c:408:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] > write(out_fd, &ch, 1); > ^~~~~ ~~~~~~~~~~~~~~ > 2 warnings generated. --- modules/tls/tls_config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/tls/tls_config.c b/modules/tls/tls_config.c index af1d88a0324..fc631550b48 100644 --- a/modules/tls/tls_config.c +++ b/modules/tls/tls_config.c @@ -400,12 +400,16 @@ tls_domains_cfg_t* tls_load_config(str* filename) pkg_free(file_path); file_path = NULL; while (read(in_fd, &ch, 1)) { - write(out_fd, &ch, 1); + if (write(out_fd, &ch, 1)<0) { + LOG(L_ERR, "write error: %s\n", strerror(errno)); + } } close(in_fd); in_fd = 0; ch = '\n'; - write(out_fd, &ch, 1); + if (write(out_fd, &ch, 1)<0) { + LOG(L_ERR, "write error: %s\n", strerror(errno)); + } } } closedir(dir);