Module: kamailio
Branch: master
Commit: 3a803770d4fb80347ba70dac94625b0e9aeab44d
URL:
https://github.com/kamailio/kamailio/commit/3a803770d4fb80347ba70dac94625b0…
Author: Victor Seva <vseva(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-06-19T12:10:35+02:00
rabbitmq: don't try to use ssl_socket functions to a tcp_socket
fixes #3883
---
Modified: src/modules/rabbitmq/rabbitmq.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3a803770d4fb80347ba70dac94625b0…
Patch:
https://github.com/kamailio/kamailio/commit/3a803770d4fb80347ba70dac94625b0…
---
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) {