From 23efc56ad5c99c457c1dd4b99d370979ec709d91 Mon Sep 17 00:00:00 2001 From: vikrant patel Date: Thu, 10 Oct 2024 13:46:03 +0530 Subject: [PATCH] ubi9 Compilation Warnings (#196) * Initial openssl changes: replaced RSA with PKEY * More changes related to deprecated encryption API change * some code cleanup * minor change * remove unwanted changes * ubi8:openssl-1.x and ubi9:openssl-3.x support * include of param_build in condition * minor changes for ubi8 * reverting ubi8 code to free RSA memory * Initial changes to support encrypt/decrypt functionality for openSSL3.0 * Addressed review comment for failure of EVP functions * Addressed review comments * Couple of more warnings addressed for ubi9 * addressed warning from server_store module * ubi8 compilation support * ubi8 compilation support --- server_admin/src/janssonProcessPost.c | 2 +- server_engine/test/test_multiConsumerQ.c | 4 ++-- server_engine/test/test_queue2.c | 2 +- server_proxy/src/pxtcp.c | 7 ++++++- server_store/src/storeHighAvailability.c | 12 +++++++++++- server_store/src/storeMemoryHA.c | 2 +- server_transport/src/tcp.c | 9 +++++++-- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/server_admin/src/janssonProcessPost.c b/server_admin/src/janssonProcessPost.c index f2dbd36a..b89aa2c6 100644 --- a/server_admin/src/janssonProcessPost.c +++ b/server_admin/src/janssonProcessPost.c @@ -1725,7 +1725,7 @@ XAPI void ism_config_setServerName(int getLock, int setDefault) { struct utsname buf; /* get current admin port */ - int port = ism_config_json_getAdminPort(getLock); + unsigned short port = ism_config_json_getAdminPort(getLock); /* Get current ServerName */ if ( getLock == 1 ) pthread_rwlock_wrlock(&srvConfiglock); diff --git a/server_engine/test/test_multiConsumerQ.c b/server_engine/test/test_multiConsumerQ.c index 507e849e..2c06520a 100644 --- a/server_engine/test/test_multiConsumerQ.c +++ b/server_engine/test/test_multiConsumerQ.c @@ -2904,7 +2904,7 @@ void test_DeepSelection(void) rc = pthread_mutex_unlock(&controlMutex); TEST_ASSERT_EQUAL(rc, OK); - (void)pthread_yield(); + (void)sched_yield(); rc = pthread_mutex_lock(&controlMutex); TEST_ASSERT_EQUAL(rc, OK); @@ -3219,7 +3219,7 @@ void test_UnackdSelection(void) rc = pthread_mutex_unlock(&controlMutex); TEST_ASSERT_EQUAL(rc, OK); - (void)pthread_yield(); + (void)sched_yield(); rc = pthread_mutex_lock(&controlMutex); TEST_ASSERT_EQUAL(rc, OK); diff --git a/server_engine/test/test_queue2.c b/server_engine/test/test_queue2.c index 5cea82c0..43776398 100644 --- a/server_engine/test/test_queue2.c +++ b/server_engine/test/test_queue2.c @@ -1428,7 +1428,7 @@ static void Queue2_EnableDisable( ismQueueType_t type TEST_ASSERT_EQUAL(rc, OK); } - pthread_yield(); + sched_yield(); } // Having reached here ask the putters to stop diff --git a/server_proxy/src/pxtcp.c b/server_proxy/src/pxtcp.c index d3dbd0d2..83e292dc 100644 --- a/server_proxy/src/pxtcp.c +++ b/server_proxy/src/pxtcp.c @@ -1222,7 +1222,12 @@ static void sslTraceErr(ism_transport_t * transport, uint32_t rc, const char * } } for (;;) { - rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #if OPENSSL_VERSION_NUMBER < 0x30000000L + rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #else + const char * func; + rc = (uint32_t)ERR_get_error_all(&file, &line, &func, &data, &flags); + #endif if (rc == 0) break; ERR_error_string_n(rc, mbuf, sizeof mbuf); diff --git a/server_store/src/storeHighAvailability.c b/server_store/src/storeHighAvailability.c index 66cfaf54..5f8d16c7 100644 --- a/server_store/src/storeHighAvailability.c +++ b/server_store/src/storeHighAvailability.c @@ -158,6 +158,7 @@ static void sslTraceErr(ConnInfoRec *cInfo, uint32_t rc, const char * file, int { int flags, i=1; const char * data; + const char * fn; char mbuf[1024]; char * pos; int err = errno; @@ -177,7 +178,12 @@ static void sslTraceErr(ConnInfoRec *cInfo, uint32_t rc, const char * file, int i=0; } for (;;) { - rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #if OPENSSL_VERSION_NUMBER < 0x30000000L + rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #else + const char * func; + rc = (uint32_t)ERR_get_error_all(&file, &line, &fn, &data, &flags); + #endif if (rc == 0) break; ERR_error_string_n(rc, mbuf, sizeof mbuf); @@ -5059,6 +5065,10 @@ int cip_prepare_req_msg(haGlobalInfo *gInfo) int numActiveConns; char *p ; ismCluster_Statistics_t cs[1]; + cs->connectedServers=cs->disconnectedServers=0; + cs->pClusterName=cs->pServerName=cs->pServerUID=NULL; + cs->healthStatus=ISM_CLUSTER_HEALTH_UNKNOWN; + cs->haStatus=ISM_CLUSTER_HA_UNKNOWN; haConReqMsg *msg = &gInfo->dInfo->req_msg[0] ; memset(msg, 0, sizeof(haConReqMsg)) ; //msg->msg_len = sizeof(haConReqMsg) - INT_SIZE ; diff --git a/server_store/src/storeMemoryHA.c b/server_store/src/storeMemoryHA.c index 37706043..6dd0426f 100644 --- a/server_store/src/storeMemoryHA.c +++ b/server_store/src/storeMemoryHA.c @@ -1140,7 +1140,7 @@ static int ism_store_memHASendAck(ismStore_memHAChannel_t *pHAChannel, ismStore_ ismStore_memHAMsgType_t msgType = StoreHAMsg_Ack; char *pBuffer=NULL, *pPos=NULL; int rc; - uint32_t opcount, bufferLength; + uint32_t opcount=0, bufferLength; if ((rc = ism_store_memHAEnsureBufferAllocation(pHAChannel, &pBuffer, diff --git a/server_transport/src/tcp.c b/server_transport/src/tcp.c index 8f7853b2..b7ea595d 100644 --- a/server_transport/src/tcp.c +++ b/server_transport/src/tcp.c @@ -1031,7 +1031,12 @@ static void sslTraceErr(ism_transport_t * transport, uint32_t rc, const char * } } for (;;) { - rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #if OPENSSL_VERSION_NUMBER < 0x30000000L + rc = (uint32_t)ERR_get_error_line_data(&file, &line, &data, &flags); + #else + const char * func; + rc = (uint32_t)ERR_get_error_all(&file, &line, &func, &data, &flags); + #endif if (rc == 0) break; ERR_error_string_n(rc, mbuf, sizeof mbuf); @@ -2581,7 +2586,7 @@ HOT static void * ism_tcp_ioProcessorThreadProc(void * parm, void * context, int if (value) { if (iopDelay > 0) { for (i = 0; i < iopDelay; i++) { - pthread_yield(); + sched_yield(); } } else { ism_common_sleep(-iopDelay);