mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 02:58:01 +02:00
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>
This commit is contained in:
parent
d6b67a0383
commit
4886ff454e
1 changed files with 5 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue