]> 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)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 25 May 2018 20:53:29 +0000 (22:53 +0200)
Helps matching debug logs between client and server.

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

index c5ceabe8ce34b8b13a0c06a6f9100f8626257003..c8cea9bc3e73d32e4952b25417b71d87a7c52302 100644 (file)
@@ -1308,7 +1308,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) {