xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 24 19:31:43 UTC 2018


 os/xdmcp.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 08ff37d05a04a1ceed6086cfceae9c34331cb633
Author: Andreas Fett <a.fett at gmx.de>
Date:   Mon Oct 22 22:03:22 2018 +0200

    os/xdmcp: Fix binding of ipv6 source address
    
    Choose the socket fd of the correct address family based
    on the address family of the argument to the -from option.
    
    Fixes: xorg/xserver#4

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 62adead84..df3312df6 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -912,6 +912,7 @@ static void
 get_xdmcp_sock(void)
 {
     int soopts = 1;
+    int socketfd = -1;
 
 #if defined(IPv6) && defined(AF_INET6)
     if ((xdmcpSocket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
@@ -924,8 +925,18 @@ get_xdmcp_sock(void)
                         sizeof(soopts)) < 0)
         XdmcpWarning("UDP set broadcast socket-option failed");
 #endif                          /* SO_BROADCAST */
-    if (xdmcpSocket >= 0 && xdm_from != NULL) {
-        if (bind(xdmcpSocket, (struct sockaddr *) &FromAddress,
+
+    if (xdm_from == NULL)
+        return;
+
+    if (SOCKADDR_FAMILY(FromAddress) == AF_INET)
+        socketfd = xdmcpSocket;
+#if defined(IPv6) && defined(AF_INET6)
+    else if (SOCKADDR_FAMILY(FromAddress) == AF_INET6)
+        socketfd = xdmcpSocket6;
+#endif
+    if (socketfd >= 0) {
+        if (bind(socketfd, (struct sockaddr *) &FromAddress,
                  FromAddressLen) < 0) {
             FatalError("Xserver: failed to bind to -from address: %s\n",
                        xdm_from);


More information about the xorg-commit mailing list