From 598b67ccc50489063327146d204cc1ca90136d04 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 5 Nov 2019 16:54:32 +0000 Subject: [PATCH] [Minor] Fix log tag in ssl connections --- src/libutil/ssl_util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c index d145e4f5b..f2898d592 100644 --- a/src/libutil/ssl_util.c +++ b/src/libutil/ssl_util.c @@ -47,13 +47,13 @@ struct rspamd_ssl_connection { gboolean verify_peer; SSL *ssl; gchar *hostname; - const gchar *log_tag; struct rspamd_io_ev *ev; struct rspamd_io_ev *shut_ev; struct ev_loop *event_loop; rspamd_ssl_handler_t handler; rspamd_ssl_error_handler_t err_handler; gpointer handler_data; + gchar log_tag[8]; }; #define msg_debug_ssl(...) rspamd_conditional_debug_fast (NULL, NULL, \ @@ -621,7 +621,14 @@ rspamd_ssl_connection_new (gpointer ssl_ctx, struct ev_loop *ev_base, c->ssl = SSL_new (ssl_ctx); c->event_loop = ev_base; c->verify_peer = verify_peer; - c->log_tag = log_tag; + + if (log_tag) { + rspamd_strlcpy (c->log_tag, log_tag, sizeof (log_tag)); + } + else { + rspamd_random_hex (c->log_tag, sizeof (log_tag) - 1); + c->log_tag[sizeof (log_tag) - 1] = '\0'; + } return c; } -- 2.39.5