]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Add local_ip and remote_ip fields to connection event
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 8 Mar 2023 14:48:30 +0000 (16:48 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:20:55 +0000 (14:20 +0200)
These will be required to preserve support for local {) and remote {}
config filters after the following change.

src/doveadm/client-connection.c

index a0d9212694dc86534fdbeedefd547684bf1cc219..1d28b605efbd5867c2ae91d45fd3dda326886b99 100644 (file)
@@ -62,8 +62,10 @@ int client_connection_init(struct client_connection *conn,
        conn->type = type;
        conn->pool = pool;
 
-       (void)net_getsockname(fd, &conn->local_ip, &conn->local_port);
-       (void)net_getpeername(fd, &conn->remote_ip, &conn->remote_port);
+       if (net_getsockname(fd, &conn->local_ip, &conn->local_port) == 0)
+               event_add_ip(conn->event, "local_ip", &conn->local_ip);
+       if (net_getpeername(fd, &conn->remote_ip, &conn->remote_port) == 0)
+               event_add_ip(conn->event, "remote_ip", &conn->local_ip);
 
        ip = net_ip2addr(&conn->remote_ip);
        if (ip[0] != '\0')