From a1f855e6145350439f33c411dd67244a165aeeec Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Thu, 8 Aug 2013 16:48:04 +0200 Subject: [PATCH] Only take process id of localhost client connection entries. This patch makes sure, that the process id is fetched only from localhost client address connections fetched from the tcp table. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060 --- dbus/dbus-sysdeps-win.c | 7 +++++-- 1 Datei geändert, 5 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 4fa1b89..35cf134 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -210,7 +210,8 @@ _dbus_get_peer_pid_from_tcp_handle (int handle) for (dwSize = 0; dwSize < lpBuffer->dwNumEntries; dwSize++) { int local_port = ntohs (lpBuffer->table[dwSize].dwLocalPort); - if (local_port == peer_port) + int local_address = ntohl (lpBuffer->table[dwSize].dwLocalAddr); + if (local_address == INADDR_LOOPBACK && local_port == peer_port) { result = lpBuffer->table[dwSize].dwOwningPid; break; @@ -246,8 +247,10 @@ _dbus_get_peer_pid_from_tcp_handle (int handle) for (i = 0; i < tcp_table->dwNumEntries; i++) { MIB_TCPROW_OWNER_PID *p = &tcp_table->table[i]; + int local_address = ntohl (p->dwLocalAddr); int local_port = ntohs (p->dwLocalPort); - if (p->dwState == MIB_TCP_STATE_ESTAB && local_port == peer_port) + if (p->dwState == MIB_TCP_STATE_ESTAB + && local_address == INADDR_LOOPBACK && local_port == peer_port) result = p->dwOwningPid; } -- 1.7.10.4