From f404db35d8a777cdee10511fa694380284ffcb8b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 20:51:40 +0200 Subject: xserver doesn't stop all connections to localhost Backport of the following commit + manual fix at some other locations. commit 75b9383d8a4c113ab3c6cfc1d5efcb5d9982a1bf Author: Jesse Adkins Date: Tue Aug 18 21:13:40 2009 -0700 xserver doesn't stop all connections to localhost X.Org Bugzilla #23329: http://bugs.freedesktop.org/show_bug.cgi?id=23329 Patch #28648: http://bugs.freedesktop.org/attachment.cgi?id=28648 I noticed in xserver at os/access.c that xorg tries to stop connections to localhost by checking against the address 127.0.0.1. However, RFC 3330 defines the localhost network as 127.0.0.0/8. This means that any IPv4 address that starts with 127 is just another name for localhos --- nx-X11/programs/Xserver/os/access.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index bea4b968a..bd5a2b69c 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -405,8 +405,7 @@ DefineSelf (int fd) * on the other end of the wire. */ if (len == 4 && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; /* @@ -541,8 +540,8 @@ DefineSelf (int fd) */ if (family == FamilyInternet && !(len == 4 && - ((addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) || + /* backport 75b9383d8a4c113ab3c6cfc1d5efcb5d9982a1bf */ + ((addr[0] == 127 || (addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0))) ) @@ -755,8 +754,7 @@ DefineSelf (int fd) * on the other end of the wire */ if (family == FamilyInternet && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6 && @@ -903,8 +901,7 @@ DefineSelf (int fd) continue; if (family == FamilyInternet && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; /* -- cgit v1.2.3