Module: kamailio
Branch: 5.8
Commit: ec27c0207a364fd4f563707b740877ab77bfb5a5
URL:
https://github.com/kamailio/kamailio/commit/ec27c0207a364fd4f563707b740877a…
Author: Victor Seva <vseva(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-06-19T12:14:18+02:00
rabbitmq: don't try to use ssl_socket functions to a tcp_socket
fixes #3883
(cherry picked from commit 3a803770d4fb80347ba70dac94625b0e9aeab44d)
---
Modified: src/modules/rabbitmq/rabbitmq.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ec27c0207a364fd4f563707b740877a…
Patch:
https://github.com/kamailio/kamailio/commit/ec27c0207a364fd4f563707b740877a…
---
diff --git a/src/modules/rabbitmq/rabbitmq.c b/src/modules/rabbitmq/rabbitmq.c
index 8547bacac79..a1e95ad55b3 100644
--- a/src/modules/rabbitmq/rabbitmq.c
+++ b/src/modules/rabbitmq/rabbitmq.c
@@ -597,19 +597,22 @@ static int rabbitmq_connect(amqp_connection_state_t *conn)
return RABBITMQ_ERR_SOCK;
}
- if(rmq_amqps_ca_file) {
- if(amqp_ssl_socket_set_cacert(amqp_sock, rmq_amqps_ca_file)) {
- LM_ERR("Failed to set CA certificate for amqps connection\n");
- return RABBITMQ_ERR_SSL_CACERT;
+ if(amqp_info.ssl) { // only valid for amqp_ssl_socket_t
+ if(rmq_amqps_ca_file) {
+ if(amqp_ssl_socket_set_cacert(amqp_sock, rmq_amqps_ca_file)) {
+ LM_ERR("Failed to set CA certificate for amqps connection\n");
+ return RABBITMQ_ERR_SSL_CACERT;
+ }
}
- }
#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR < 8
- amqp_ssl_socket_set_verify(amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
+ amqp_ssl_socket_set_verify(amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
#else
- amqp_ssl_socket_set_verify_peer(amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
- amqp_ssl_socket_set_verify_hostname(amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
+ amqp_ssl_socket_set_verify_peer(amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
+ amqp_ssl_socket_set_verify_hostname(
+ amqp_sock, (rmq_amqps_ca_file) ? 1 : 0);
#endif
+ }
ret = amqp_socket_open(amqp_sock, amqp_info.host, amqp_info.port);
if(ret != AMQP_STATUS_OK) {