diff options
| author | Ralf Habacker <ralf.habacker@freenet.de> | 2013-08-08 16:48:04 +0200 |
|---|---|---|
| committer | Ralf Habacker <ralf.habacker@freenet.de> | 2013-08-09 17:52:32 +0200 |
| commit | 4886ff454e3b6d42727fe266557eccd68d728c78 (patch) | |
| tree | 488739d6635151857a33fcea63769cc8ce54ec1d | |
| parent | d6b67a0383f9eec06798949a50e2878a918f08e9 (diff) | |
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
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
| -rw-r--r-- | dbus/dbus-sysdeps-win.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index aa0f97e2..14fbf131 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -208,7 +208,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; @@ -244,8 +245,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; } |
