]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: Change login proxy message to include IP address
authorSiavash Tavakoli <siavash.tavakoli@open-xchange.com>
Thu, 30 Sep 2021 11:49:31 +0000 (12:49 +0100)
committerSiavash Tavakoli <siavash.tavakoli@open-xchange.com>
Mon, 18 Oct 2021 07:47:50 +0000 (08:47 +0100)
Will be in format "<IP> (<host>)". Host part is optional and not added
if proxy target is an IP address.

src/login-common/client-common-auth.c

index d776083c2bc8d7b9df02edc580a225df7785bf3f..2d4346c3bb6f52938261dc2dcd5ac5c00845a68f 100644 (file)
@@ -296,8 +296,13 @@ void client_proxy_finish_destroy_client(struct client *client)
 
        /* Include hostname in the log message in case it's different from the
           IP address in the prefix. */
-       str_printfa(str, "Started proxying to %s",
-                   login_proxy_get_host(client->login_proxy));
+       const char *ip_str = login_proxy_get_ip_str(client->login_proxy);
+       const char *host = login_proxy_get_host(client->login_proxy);
+       str_printfa(str, "Started proxying to <%s>",
+                   login_proxy_get_ip_str(client->login_proxy));
+       if (strcmp(ip_str, host) != 0)
+               str_printfa(str, " (<%s>)", host);
+
        client_proxy_append_conn_info(str, client);
 
        login_proxy_append_success_log_info(client->login_proxy, str);