<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
If the query failed, the result set should not be parsed and used. This results in an empty result set which will most likely lead to unwanted behavior.
Background: While troubleshooting, we detected that domain.reload actually replaces domains with an empty result set if mongodb connectivity fails.
```
DEBUG: db_mongodb [mongodb_dbase.c:849]: db_mongodb_store_result(): An error occurred: No suitable servers found (`serverSelectionTryOnce` set): [connection timeout calling ismaster on 'pdb-iop1-wrmg-2:27017'] [connection timeout calling ismaster on 'pdb-iop1-wrmg-1:27017']
DEBUG: domain [domain.c:365]: reload_tables(): number of rows in domain_attrs table: 0
DEBUG: <core> [db_res.c:79]: db_free_columns(): freeing 0 columns
DEBUG: <core> [db_res.c:138]: db_free_result(): freeing result set at 0x7fb0c9811848
DEBUG: db_mongodb [mongodb_dbase.c:973]: db_mongodb_query(): query to collection [domains]
DEBUG: db_mongodb [mongodb_dbase.c:1007]: db_mongodb_query(): query filter: { }
DEBUG: db_mongodb [mongodb_dbase.c:1043]: db_mongodb_query(): columns filter: { "projection" : { "domain" : 1, "did" : 1 } }
```
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3996
-- Commit Summary --
* mongodb: fix cursor error resulting empty result set
-- File Changes --
M src/modules/db_mongodb/mongodb_dbase.c (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3996.patchhttps://github.com/kamailio/kamailio/pull/3996.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3996
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3996(a)github.com>
Module: kamailio
Branch: master
Commit: 2737bb19a363be7c0d67749b75f11c7e9d2d09f3
URL: https://github.com/kamailio/kamailio/commit/2737bb19a363be7c0d67749b75f11c7…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-10-08T15:03:55+02:00
http_async_client: fix warning deprecated-non-prototype
> Warning: ./http_multi.h:64:5: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C23, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
> 64 | int init_http_multi();
> | ^
> http_multi.c:403:5: note: conflicting prototype is here
> 403 | int init_http_multi(struct event_base *evbase, struct http_m_global *wg)
> | ^
> 1 warning generated.
---
Modified: src/modules/http_async_client/http_multi.h
---
Diff: https://github.com/kamailio/kamailio/commit/2737bb19a363be7c0d67749b75f11c7…
Patch: https://github.com/kamailio/kamailio/commit/2737bb19a363be7c0d67749b75f11c7…
---
diff --git a/src/modules/http_async_client/http_multi.h b/src/modules/http_async_client/http_multi.h
index 0f35a722306..8e3676b3ed1 100644
--- a/src/modules/http_async_client/http_multi.h
+++ b/src/modules/http_async_client/http_multi.h
@@ -61,7 +61,7 @@ extern int curl_verbose;
extern int curl_follow_redirect;
void set_curl_mem_callbacks(void);
-int init_http_multi();
+int init_http_multi(struct event_base *evbase, struct http_m_global *wg);
int multi_timer_cb(CURLM *multi, long timeout_ms, struct http_m_global *g);
void timer_cb(int fd, short kind, void *userp);
int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp);
From the build log
```
CC (gcc) [M kazoo.so] kazoo.o
CC (gcc) [M kazoo.so] kz_amqp.o
kz_amqp.c: In function 'kz_amqp_connection_open_ssl':
kz_amqp.c:857:17: warning: 'amqp_set_initialize_ssl_library' is deprecated [-Wdeprecated-declarations]
857 | amqp_set_initialize_ssl_library(1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from kz_amqp.c:37:
/usr/include/rabbitmq-c/ssl_socket.h:233:16: note: declared here
233 | void AMQP_CALL amqp_set_initialize_ssl_library(amqp_boolean_t do_initialize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC (gcc) [M kazoo.so] kz_fixup.o
CC (gcc) [M kazoo.so] kz_hash.o
```
Functions description in the header file
https://github.com/alanxz/rabbitmq-c/blob/v0.13.0/include/rabbitmq-c/ssl_so…
```
/**
* Sets whether rabbitmq-c will initialize OpenSSL.
*
* \deprecated Since v0.13.0 this is a no-op. OpenSSL automatically manages
* library initialization and uninitialization.
*
* OpenSSL requires a one-time initialization across a whole program, this sets
* whether or not rabbitmq-c will initialize the SSL library when the first call
* to amqp_ssl_socket_new() is made. You should call this function with
* do_init = 0 if the underlying SSL library is initialized somewhere else
* the program.
*
* Failing to initialize or double initialization of the SSL library will
* result in undefined behavior
*
* By default rabbitmq-c will initialize the underlying SSL library.
*
* NOTE: calling this function after the first socket has been opened with
* amqp_open_socket() will not have any effect.
*
* \param [in] do_initialize If 0 rabbitmq-c will not initialize the SSL
* library, otherwise rabbitmq-c will initialize the
* SSL library
*
* \since v0.4.0
*/
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3466
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3466(a)github.com>
Module: kamailio
Branch: master
Commit: 35a87c98f4e84b65f82376dfb57050f43d0f355f
URL: https://github.com/kamailio/kamailio/commit/35a87c98f4e84b65f82376dfb57050f…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-10-08T13:26:32+02:00
ims_usrloc_pcscf: fix warning deprecated-non-prototype
> In file included from usrloc_db.c:12:
> Warning: ./usrloc_db.h:131:5: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
> int use_location_pcscf_table();
> ^
> usrloc_db.c:113:5: note: conflicting prototype is here
> int use_location_pcscf_table(str *domain)
> ^
> 1 warning generated.
---
Modified: src/modules/ims_usrloc_pcscf/usrloc_db.h
---
Diff: https://github.com/kamailio/kamailio/commit/35a87c98f4e84b65f82376dfb57050f…
Patch: https://github.com/kamailio/kamailio/commit/35a87c98f4e84b65f82376dfb57050f…
---
diff --git a/src/modules/ims_usrloc_pcscf/usrloc_db.h b/src/modules/ims_usrloc_pcscf/usrloc_db.h
index 3c50c153b4e..688387b1b2d 100644
--- a/src/modules/ims_usrloc_pcscf/usrloc_db.h
+++ b/src/modules/ims_usrloc_pcscf/usrloc_db.h
@@ -128,7 +128,7 @@ typedef struct reusable_buffer
int data_len;
} t_reusable_buffer;
-int use_location_pcscf_table();
+int use_location_pcscf_table(str *domain);
void destroy_db();
int init_db(const str *db_url, int db_update_period, int fetch_num_rows);
int connect_db(const str *db_url);
Module: kamailio
Branch: master
Commit: f49012d15a06b27875cf6bca211ad953968b5217
URL: https://github.com/kamailio/kamailio/commit/f49012d15a06b27875cf6bca211ad95…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-10-08T13:10:57+02:00
cdp: fix warning deprecated-non-prototype
> Warning: peerstatemachine.c:120:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:182:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:395:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:400:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:420:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:462:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> Warning: peerstatemachine.c:467:19: warning: passing arguments to 'log_peer_list' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
> log_peer_list(L_INFO);
> ^
> 7 warnings generated.
---
Modified: src/modules/cdp/peerstatemachine.c
---
Diff: https://github.com/kamailio/kamailio/commit/f49012d15a06b27875cf6bca211ad95…
Patch: https://github.com/kamailio/kamailio/commit/f49012d15a06b27875cf6bca211ad95…
---
diff --git a/src/modules/cdp/peerstatemachine.c b/src/modules/cdp/peerstatemachine.c
index 97edb129549..2571e5df252 100644
--- a/src/modules/cdp/peerstatemachine.c
+++ b/src/modules/cdp/peerstatemachine.c
@@ -117,7 +117,7 @@ int sm_process(
R_Disc(p);
p->state = Closed;
}
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case Stop:
/* just ignore this state */
@@ -134,7 +134,7 @@ int sm_process(
case I_Rcv_Conn_Ack:
p->state = Wait_I_CEA;
I_Snd_CER(p);
- if (p->state == Closed)
+ if(p->state == Closed)
sm_process(p, Start, 0, 1, 0);
break;
case I_Rcv_Conn_NAck:
@@ -179,7 +179,7 @@ int sm_process(
Cleanup(p, p->I_sock);
p->state = Closed;
}
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case R_Conn_CER:
if(p->r_cer)
@@ -392,12 +392,12 @@ int sm_process(
Snd_DPA(p, msg, AAA_SUCCESS, p->R_sock);
R_Disc(p);
p->state = Closed;
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case R_Peer_Disc:
R_Disc(p);
p->state = Closed;
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case R_Rcv_CER:
result_code = Process_CER(p, msg);
@@ -417,7 +417,7 @@ int sm_process(
/*R_Disc(p);p.state = Closed;*/
p->state = R_Open; /* Or maybe I should disconnect it?*/
}
- log_peer_list(L_INFO);
+ log_peer_list();
break;
default:
LM_ERR("sm_process(): In state %s invalid event %s\n",
@@ -459,12 +459,12 @@ int sm_process(
Snd_DPA(p, msg, 2001, p->I_sock);
I_Disc(p);
p->state = Closed;
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case I_Peer_Disc:
I_Disc(p);
p->state = Closed;
- log_peer_list(L_INFO);
+ log_peer_list();
break;
case I_Rcv_CER:
result_code = Process_CER(p, msg);
@@ -669,13 +669,13 @@ void I_Snd_CER(peer *p)
if((ret = getsockname(p->I_sock, &(addr_u.addr), &addrlen)) == -1) {
LM_ERR("I_Snd_CER(): Error on finding local host address > %s\n",
strerror(errno));
- Cleanup(p,p->I_sock);
+ Cleanup(p, p->I_sock);
p->state = Closed;
AAAFreeMessage(&cer);
return;
}
- if (ret != -1) {
+ if(ret != -1) {
switch(addr_u.addr.sa_family) {
case AF_INET:
set_2bytes(x, 1);