diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/access.c | 59 | ||||
-rw-r--r-- | os/utils.c | 36 | ||||
-rw-r--r-- | os/xdmcp.c | 47 |
3 files changed, 108 insertions, 34 deletions
diff --git a/os/access.c b/os/access.c index 77dcebe20..14b61839c 100644 --- a/os/access.c +++ b/os/access.c @@ -45,7 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/access.c,v 3.50 2003/11/03 05:12:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/access.c,v 3.54 2004/01/03 17:38:39 herrb Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -645,6 +645,20 @@ DefineLocalHost: #include <arpa/inet.h> #endif +#if defined(IPv6) && defined(AF_INET6) +static void +in6_fillscopeid(struct sockaddr_in6 *sin6) +{ +#if defined(__KAME__) + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + sin6->sin6_scope_id = + ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); + sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; + } +#endif +} +#endif + void DefineSelf (int fd) { @@ -761,6 +775,10 @@ DefineSelf (int fd) #endif /* DNETCONN */ if (family == -1 || family == FamilyLocal) continue; +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR); +#endif #ifdef DEF_SELF_DEBUG if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", @@ -898,10 +916,24 @@ DefineSelf (int fd) family = ConvertAddr(ifr->ifa_addr, &len, (pointer *)&addr); if (family == -1 || family == FamilyLocal) continue; +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr); +#endif + #ifdef DEF_SELF_DEBUG if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", ifr->ifa_name, addr[0], addr[1], addr[2], addr[3]); +#if defined(IPv6) && defined(AF_INET6) + else if (family == FamilyInternet6) { + char cp[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, addr, cp, sizeof(cp)); + ErrorF("Xserver: DefineSelf(): ifname = %s addr = %s\n", + ifr->ifa_name, cp); + } +#endif #endif /* DEF_SELF_DEBUG */ for (host = selfhosts; host != NULL && !addrEqual(family, addr, len, host); @@ -923,17 +955,34 @@ DefineSelf (int fd) /* * If this isn't an Internet Address, don't register it. */ - if (family != FamilyInternet) + if (family != FamilyInternet +#if defined(IPv6) && defined(AF_INET6) + && family != FamilyInternet6 +#endif + ) continue; /* - * ignore 'localhost' entries as they're not usefule + * ignore 'localhost' entries as they're not useful * on the other end of the wire */ - if (len == 4 && + if (ifr->ifa_flags & IFF_LOOPBACK) + continue; + + if (family == FamilyInternet && addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[2] == 1) + addr[2] == 0 && addr[3] == 1) continue; +#if defined(IPv6) && defined(AF_INET6) + else if (family == FamilyInternet6 && + IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) + continue; +#endif XdmcpRegisterConnection(family, (char *)addr, len); +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + /* IPv6 doesn't support broadcasting, so we drop out here */ + continue; +#endif if ((ifr->ifa_flags & IFF_BROADCAST) && (ifr->ifa_flags & IFF_UP)) broad_addr = *ifr->ifa_broadaddr; diff --git a/os/utils.c b/os/utils.c index c10fad5ae..654c8bc7e 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1,4 +1,4 @@ -/* $XdotOrg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */ +/* $XdotOrg: xc/programs/Xserver/os/utils.c,v 1.1.4.6 2004/02/25 21:47:04 kaleb Exp $ */ /* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */ /* @@ -50,7 +50,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.95 2003/10/01 18:36:38 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.97 2004/01/09 00:35:06 dawes Exp $ */ #ifdef __CYGWIN__ #include <stdlib.h> @@ -129,12 +129,12 @@ OR PERFORMANCE OF THIS SOFTWARE. Bool CoreDump; Bool noTestExtensions; -Bool noXineramaExtension = TRUE; +Bool noPanoramiXExtension = TRUE; #ifdef XINERAMA -Bool XineramaVisibilityNotifySent = FALSE; -Bool XineramaMapped = FALSE; -Bool XineramaWindowExposureSent = FALSE; -Bool XineramaOneExposeRequest = FALSE; +Bool PanoramiXVisibilityNotifySent = FALSE; +Bool PanoramiXMapped = FALSE; +Bool PanoramiXWindowExposureSent = FALSE; +Bool PanoramiXOneExposeRequest = FALSE; #endif int auditTrailLevel = 1; @@ -245,6 +245,7 @@ LockServer(void) int lfd, i, haslock, l_pid, t; char *tmppath = NULL; int len; + char port[20]; if (nolock) return; /* @@ -259,13 +260,14 @@ LockServer(void) FatalError("No TMP dir found\n"); #endif + sprintf(port, "%d", atoi(display)); len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); - len += strlen(tmppath) + strlen(display) + strlen(LOCK_SUFFIX) + 1; + len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1; if (len > sizeof(LockFile)) - FatalError("Display name `%s' is too long\n", display); - (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, display); - (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, display); + FatalError("Display name `%s' is too long\n", port); + (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port); + (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port); /* * Create a temporary file containing our PID. Attempt three times @@ -360,7 +362,7 @@ LockServer(void) */ unlink(tmp); FatalError("Server is already active for display %s\n%s %s\n%s\n", - display, "\tIf this server is no longer running, remove", + port, "\tIf this server is no longer running, remove", LockFile, "\tand start again."); } } @@ -585,8 +587,10 @@ ProcessCommandLine(int argc, char *argv[]) defaultKeyboardControl.autoRepeat = TRUE; -#ifdef PART_NET - PartialNetwork = TRUE; +#ifdef NO_PART_NET + PartialNetwork = FALSE; +#else + PartialNetwork = TRUE; #endif for ( i = 1; i < argc; i++ ) @@ -882,10 +886,10 @@ ProcessCommandLine(int argc, char *argv[]) } #ifdef XINERAMA else if ( strcmp( argv[i], "+xinerama") == 0){ - noXineramaExtension = FALSE; + noPanoramiXExtension = FALSE; } else if ( strcmp( argv[i], "-xinerama") == 0){ - noXineramaExtension = TRUE; + noPanoramiXExtension = TRUE; } #endif else if ( strcmp( argv[i], "-x") == 0) diff --git a/os/xdmcp.c b/os/xdmcp.c index a949d2d10..6ffaa3f24 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xdmcp.c,v 1.4 2001/01/31 13:37:19 pookie Exp $ */ +/* $XdotOrg: xc/programs/Xserver/os/xdmcp.c,v 1.1.4.5 2004/02/23 21:37:27 kaleb Exp $ */ /* $Xorg: xdmcp.c,v 1.4 2001/01/31 13:37:19 pookie Exp $ */ /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. @@ -14,7 +14,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 */ @@ -759,14 +759,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; @@ -1162,7 +1154,7 @@ send_query_msg(void) socketfd = xdmcpSocket6; #endif XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress, - sizeof (ManagerAddress)); + ManagerAddressLen); } } @@ -1214,9 +1206,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; @@ -1247,8 +1249,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); |