]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Amend connection debug message with source ip:port.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Mar 2018 20:08:09 +0000 (21:08 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:08:17 +0000 (10:08 +0200)
Helps matching debug logs between client and server.

src/lib-smtp/smtp-client-connection.c

index 3b5e0af28e70750a1a3dd583e828e50538e46c2f..d8a5b77d3e22752decc12a2cf3453f1a68c73385 100644 (file)
@@ -1313,7 +1313,17 @@ smtp_client_connection_connected(struct connection *_conn, bool success)
                return;
        }
 
-       smtp_client_connection_debug(conn, "Connected");
+       if (conn->set.debug) {
+               struct ip_addr local_ip;
+               in_port_t local_port;
+               int ret;
+
+               ret = net_getsockname(_conn->fd_in, &local_ip, &local_port);
+               i_assert(ret == 0);
+               smtp_client_connection_debug(conn,
+                       "Connected to server (from %s:%u)",
+                       net_ip2addr(&local_ip), local_port);
+       }
 
        (void)net_set_tcp_nodelay(_conn->fd_out, TRUE);
        if (set->socket_send_buffer_size > 0) {