Index: xdmcp.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/os/xdmcp.c,v
retrieving revision 3.30
diff -c -r3.30 xdmcp.c
*** xdmcp.c	30 Dec 2003 16:35:19 -0000	3.30
--- xdmcp.c	31 Dec 2003 14:20:13 -0000
***************
*** 1213,1221 ****
--- 1213,1231 ----
      XdmcpHeader	    header;
      int		    length;
      int		    i;
+     CARD16	    XdmcpConnectionType;
      ARRAY8	    authenticationData;
      int		    socketfd = xdmcpSocket;
  
+     switch (SOCKADDR_FAMILY(ManagerAddress))
+     {
+     case AF_INET:	XdmcpConnectionType=FamilyInternet; break;
+ #if defined(IPv6) && defined(AF_INET6)
+     case AF_INET6:	XdmcpConnectionType=FamilyInternet6; break;
+ #endif
+     default:		XdmcpConnectionType=0xffff; break;
+     }
+ 
      header.version = XDM_PROTOCOL_VERSION;
      header.opcode = (CARD16) REQUEST;
  
***************
*** 1246,1253 ****
  	return;
      }
      XdmcpWriteCARD16 (&buffer, DisplayNumber);
!     XdmcpWriteARRAY16 (&buffer, &ConnectionTypes);
!     XdmcpWriteARRAYofARRAY8 (&buffer, &ConnectionAddresses);
  
      XdmcpWriteARRAY8 (&buffer, AuthenticationName);
      XdmcpWriteARRAY8 (&buffer, &authenticationData);
--- 1256,1282 ----
  	return;
      }
      XdmcpWriteCARD16 (&buffer, DisplayNumber);
!     XdmcpWriteCARD8 (&buffer, ConnectionTypes.length);
! 
!     /* The connection array is send reordered, so that connections of	*/
!     /* the same address type as the XDMCP manager connection are send	*/
!     /* first. This works around a bug in xdm. mario@klebsch.de 		*/
!     for (i = 0; i < (int)ConnectionTypes.length; i++)
! 	if (ConnectionTypes.data[i]==XdmcpConnectionType)
! 	    XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
!     for (i = 0; i < (int)ConnectionTypes.length; i++)
! 	if (ConnectionTypes.data[i]!=XdmcpConnectionType)
! 	    XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]);
! 
!     XdmcpWriteCARD8 (&buffer, ConnectionAddresses.length);
!     for (i = 0; i < (int)ConnectionAddresses.length; i++)
! 	if ( (i<ConnectionTypes.length) && 
! 	     (ConnectionTypes.data[i]==XdmcpConnectionType) )
! 	    XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
!     for (i = 0; i < (int)ConnectionAddresses.length; i++)
! 	if ( (i>=ConnectionTypes.length) ||
! 	     (ConnectionTypes.data[i]!=XdmcpConnectionType) )
! 	    XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]);
  
      XdmcpWriteARRAY8 (&buffer, AuthenticationName);
      XdmcpWriteARRAY8 (&buffer, &authenticationData);
