]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: connection: Don't set remote_pid or remote_uid to TCP connection event
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 25 Nov 2019 13:13:28 +0000 (15:13 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 25 Nov 2019 17:49:29 +0000 (19:49 +0200)
They weren't initialized properly when connection_init_server_ip() or
connection_init_client_ip_from() was called with remote_ip parameter.

src/lib/connection.c

index a3aef767a5edd804565b810e40006c2b2705b193..8565443ddcb7a3305d662793956f8c5321e8fbc6 100644 (file)
@@ -394,16 +394,11 @@ connection_update_properties(struct connection *conn)
                        /* already known */
                } else if (fd < 0 || errno == ENOTSOCK ||
                      net_getunixcred(fd, &cred) < 0) {
-                       conn->remote_uid = (uid_t)-1;
-                       conn->remote_pid = (pid_t)-1;
                } else {
                        conn->remote_pid = cred.pid;
                        conn->remote_uid = cred.uid;
                }
                conn->unix_peer_known = TRUE;
-       } else {
-               conn->remote_uid = (uid_t)-1;
-               conn->remote_pid = (pid_t)-1;
        }
 
        connection_update_property_label(conn);
@@ -514,6 +509,8 @@ connection_init_full(struct connection_list *list, struct connection *conn,
        conn->fd_in = fd_in;
        conn->fd_out = fd_out;
        conn->disconnected = TRUE;
+       conn->remote_uid = (uid_t)-1;
+       conn->remote_pid = (pid_t)-1;
 
        i_free(conn->base_name);
        conn->base_name = i_strdup(name);