A response to the amqp query caused a segfault in libc
- Refactored parts of the code to be more readable and DRY - Split up functions for 3/4/5 arguments passed - Tested in 8.5.2
#### Pre-Submission Checklist - [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 --> - [x] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description The current state of the module was not usable anymore as everything up from 5.5.x caused a segfault when the kazoo_query method was executed. Refactored the module a bit to make sure it is works again 5.8.x
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4002
-- Commit Summary --
* Fixed segfault when using kazoo_query in kazoo mod
-- File Changes --
M src/modules/kazoo/kazoo.c (10) M src/modules/kazoo/kz_amqp.c (67) M src/modules/kazoo/kz_amqp.h (9)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4002.patch https://github.com/kamailio/kamailio/pull/4002.diff
Commit message hasn't the format required by CONTRIBUTING guide
@linuxmaniac Thanks, fixed the commit message
@linuxmaniac requested changes on this pull request.
you need to format the code with clang-format and amend
@@ -846,17 +846,17 @@ void kz_amqp_channel_close(kz_amqp_conn_ptr rmq, amqp_channel_t channel)
kz_amqp_error("closing channel", amqp_channel_close(rmq->conn, channel, AMQP_REPLY_SUCCESS)); } -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR < 13
why are you removing this part?
@remcovanvugt pushed 1 commit.
3c8126974f03c9a297e10e5db5d9b5fcbfd797aa kazoo: fixed segfault when using kazoo_query
@remcovanvugt commented on this pull request.
@@ -846,17 +846,17 @@ void kz_amqp_channel_close(kz_amqp_conn_ptr rmq, amqp_channel_t channel)
kz_amqp_error("closing channel", amqp_channel_close(rmq->conn, channel, AMQP_REPLY_SUCCESS)); } -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR < 13
@linuxmaniac This was not supposed to be removed, fixed that
you need to format the code with clang-format and amend
Done
@linuxmaniac commented on this pull request.
@@ -846,17 +846,17 @@ void kz_amqp_channel_close(kz_amqp_conn_ptr rmq, amqp_channel_t channel)
kz_amqp_error("closing channel", amqp_channel_close(rmq->conn, channel, AMQP_REPLY_SUCCESS)); } -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR < 13
not, really. The code is different. Please, put it back as it was.
@remcovanvugt pushed 1 commit.
61fcd7d73a8fd2ed68435f81f18dad9c5a941928 kazoo: fixed segfault when using kazoo_query
@remcovanvugt commented on this pull request.
@@ -846,17 +846,17 @@ void kz_amqp_channel_close(kz_amqp_conn_ptr rmq, amqp_channel_t channel)
kz_amqp_error("closing channel", amqp_channel_close(rmq->conn, channel, AMQP_REPLY_SUCCESS)); } -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR < 13
Sorry about the extra work, I overlooked the commit between 5.8.2 and master. That's why this got accidentally removed. It should be as it was now.
@linuxmaniac commented on this pull request.
@@ -888,8 +888,8 @@ int kz_amqp_connection_open_ssl(kz_amqp_conn_ptr rmq)
amqp_ssl_socket_set_verify( rmq->socket, kz_amqps_verify_peer | kz_amqps_verify_hostname); #else - amqp_ssl_socket_set_verify_peer(rmq->socket, kz_amqps_verify_peer);
not really. Still changes here.
@remcovanvugt pushed 1 commit.
f8a1d2e86b2fe59c8d02a239dc7b893a4b92ee85 kazoo: fixed segfault when using kazoo_query
@remcovanvugt commented on this pull request.
@@ -888,8 +888,8 @@ int kz_amqp_connection_open_ssl(kz_amqp_conn_ptr rmq)
amqp_ssl_socket_set_verify( rmq->socket, kz_amqps_verify_peer | kz_amqps_verify_hostname); #else - amqp_ssl_socket_set_verify_peer(rmq->socket, kz_amqps_verify_peer);
Formatted that back to what it was
@linuxmaniac approved this pull request.
waiting for comments from @lazedo for a bit
Thanks, merging it.
Merged #4002 into master.