summaryrefslogtreecommitdiff
path: root/os/xdmcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/xdmcp.c')
-rw-r--r--os/xdmcp.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/os/xdmcp.c b/os/xdmcp.c
index d9aa52716..cbd43f45b 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -13,7 +13,7 @@
* without express or implied warranty.
*
*/
-/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.29 2003/11/22 04:51:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.32 2004/01/01 17:09:29 herrb Exp $ */
#ifdef WIN32
/* avoid conflicting definitions */
@@ -758,14 +758,6 @@ XdmcpSelectHost(
int host_len,
ARRAY8Ptr AuthenticationName)
{
-#if defined(IPv6) && defined(AF_INET6)
- /* Don't need list of addresses for host anymore */
- if (mgrAddrFirst != NULL) {
- freeaddrinfo(mgrAddrFirst);
- mgrAddrFirst = NULL;
- mgrAddr = NULL;
- }
-#endif
state = XDM_START_CONNECTION;
memmove(&req_sockaddr, host_sockaddr, host_len);
req_socklen = host_len;
@@ -1161,7 +1153,7 @@ send_query_msg(void)
socketfd = xdmcpSocket6;
#endif
XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
- sizeof (ManagerAddress));
+ ManagerAddressLen);
}
}
@@ -1213,9 +1205,19 @@ send_request_msg(void)
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,8 +1248,27 @@ send_request_msg(void)
return;
}
XdmcpWriteCARD16 (&buffer, DisplayNumber);
- XdmcpWriteARRAY16 (&buffer, &ConnectionTypes);
- XdmcpWriteARRAYofARRAY8 (&buffer, &ConnectionAddresses);
+ 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);