From ca5d010292c57383da523797a095ac847e1fe103 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 9 Mar 2011 12:47:28 +0000 Subject: Enable only functions defined in windows XP Enabled IPV6 compilation --- xorg-server/os/access.c | 284 +++++++++++++++++++++++++++++++++++++++----- xorg-server/os/connection.c | 23 ++-- xorg-server/os/log.c | 2 +- xorg-server/os/utils.c | 56 ++++----- xorg-server/os/xdmcp.c | 11 +- 5 files changed, 303 insertions(+), 73 deletions(-) (limited to 'xorg-server/os') diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index b034671f9..2b37afe65 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -242,6 +242,10 @@ static int AccessEnabled = DEFAULT_ACCESS_CONTROL; static int LocalHostEnabled = FALSE; static int LocalHostRequested = FALSE; static int UsingXdmcp = FALSE; +static u_long *pInterfaces = NULL; +static int ActiveInterfaces = 0; + +void match_interface(u_long u_lQuery); /* FamilyServerInterpreted implementation */ static Bool siAddrMatch(int family, pointer addr, int len, HOST *host, @@ -249,6 +253,84 @@ static Bool siAddrMatch(int family, pointer addr, int len, HOST *host, static int siCheckAddr(const char *addrString, int length); static void siTypesInitialize(void); +#if NTDDI_VERSION >= NTDDI_VISTA +const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) +{ + if (af == AF_INET) + { + struct sockaddr_in in; + memset(&in, 0, sizeof(in)); + in.sin_family = AF_INET; + memcpy(&in.sin_addr, src, sizeof(struct in_addr)); + if (getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST) != 0) + { + errno = WSAGetLastError(); + return NULL; + } + else return dst; + } + else if (af == AF_INET6) + { + struct sockaddr_in6 in; + memset(&in, 0, sizeof(in)); + in.sin6_family = AF_INET6; + memcpy(&in.sin6_addr, src, sizeof(struct in_addr6)); + if (getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST) != 0) + { + errno = WSAGetLastError(); + return NULL; + } + else return dst; + } + errno = WSAEAFNOSUPPORT; + return NULL; +} + +int inet_pton(int af, const char *src, void *dst) +{ + struct sockaddr_storage ss; + int sslen = sizeof(ss); + if (af == AF_INET) + { + struct in_addr out; + char buffer[INET_ADDRSTRLEN + 1]; + strncpy (buffer, src, INET_ADDRSTRLEN); + buffer [INET_ADDRSTRLEN] = '\0'; + if (WSAStringToAddressA(buffer, AF_INET, NULL, (struct sockaddr*)&ss, &sslen) == SOCKET_ERROR) + { + errno = WSAGetLastError(); + return 0; + } + else + { + out = ((struct sockaddr_in *)&ss)->sin_addr; + memcpy (dst, &out, sizeof(struct in_addr)); + return 1; + } + } + else if (af == AF_INET6) + { + struct in6_addr out6; + char buffer6[INET6_ADDRSTRLEN + 1]; + strncpy (buffer6, src, INET6_ADDRSTRLEN); + buffer6 [INET6_ADDRSTRLEN] = '\0'; + if (WSAStringToAddressA(buffer6, AF_INET6, NULL, (struct sockaddr*)&ss, &sslen) == SOCKET_ERROR) + { + errno = WSAGetLastError(); + return 0; + } + else + { + out6 = ((struct sockaddr_in6 *)&ss)->sin6_addr; + memcpy (dst, &out6, sizeof(struct in6_addr)); + return 1; + } + } + errno = WSAEAFNOSUPPORT; + return -1; +} +#endif + /* * called when authorization is not enabled to add the * local host to the access list @@ -328,7 +410,7 @@ ifioctl (int fd, int cmd, char *arg) #endif /* - * DefineSelf (fd): + * DefineSelf (fd, protocol): * * Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. @@ -336,12 +418,11 @@ ifioctl (int fd, int cmd, char *arg) #if !defined(SIOCGIFCONF) void -DefineSelf (int fd) +DefineSelf (int fd, const int protocol) { #if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN) return; #else - register int n; int len; caddr_t addr; int family; @@ -353,6 +434,10 @@ DefineSelf (int fd) struct { char nodename[512]; } name; + HOST ha; + struct addrinfo *addresses; + struct addrinfo *a; + struct addrinfo hints; #endif register struct hostent *hp; @@ -371,7 +456,6 @@ DefineSelf (int fd) #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif - /* Why not use gethostname()? Well, at least on my system, I've had to * make an ugly kernel patch to get a name longer than 8 characters, and * uname() lets me access to the whole string (it smashes release, you @@ -383,27 +467,94 @@ DefineSelf (int fd) gethostname(name.nodename, sizeof(name.nodename)); #endif + /* Colin's experiments with using getaddrinfo() instead of the IPv6-useless gethostbyname() */ + memset( &hints, 0, sizeof(hints) ); + if (protocol == 4) hints.ai_family = AF_INET; + else if (protocol == 6) hints.ai_family = AF_INET6; + + if (getaddrinfo(name.nodename, NULL, &hints, &addresses) != 0) goto CarryOnTheOldWay; + + if (protocol == 6) ErrorF ("DefineSelf - %s has IPv%d addresses...\n", + name.nodename, protocol); + + for (a = addresses; a != NULL; a = a->ai_next) { + char ad[INET6_ADDRSTRLEN]; + ha.family = a->ai_family; + if (a->ai_family == AF_INET6) { + ha.addr = (unsigned char *) + &((struct sockaddr_in6 *) a->ai_addr)->sin6_addr; + ha.len = + sizeof (((struct sockaddr_in6 *) a->ai_addr)->sin6_addr); + } else { + ha.addr = (unsigned char *) + &((struct sockaddr_in *) a->ai_addr)->sin_addr; + ha.len = + sizeof (((struct sockaddr_in *) a->ai_addr)->sin_addr); + } + inet_ntop(ha.family, ha.addr, ad, sizeof(ad)); + + if (ha.family == AF_INET6) { + ErrorF(" %s", ad); + saddr.sa.sa_family = AF_INET6; + inet6addr = (struct sockaddr_in6 *) (&(saddr.sa)); + acopy (ha.addr, &(inet6addr->sin6_addr), ha.len); + len = sizeof(saddr.in6); + family = ConvertAddr (&(saddr.sa), &len, (pointer *)&addr); + if ( family != -1 && family != FamilyLocal ) { + for (host = selfhosts; + host && !addrEqual (family, addr, len, host); + host = host->next) ; + if (!host) { + /* add this host to the host list. */ + MakeHost(host,len) + if (host) { + host->family = family; + host->len = len; + acopy (addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; + } + if (family == FamilyInternet6 && + !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) { + XdmcpRegisterConnection (family, (char *)addr, len); + } + } + } + } + } + if (protocol == 6) ErrorF ("\n"); + freeaddrinfo(addresses); + /* End of Colin's experiments */ + +CarryOnTheOldWay: + hp = _XGethostbyname(name.nodename, hparams); if (hp != NULL) { - #ifdef h_addr - #define hp_addr *list - char **list; - - /* iterate over the addresses */ - for (list = hp->h_addr_list; *list; list++) - #else - #define hp_addr hp->h_addr - #endif - { - saddr.sa.sa_family = hp->h_addrtype; - switch (hp->h_addrtype) { - case AF_INET: - inetaddr = (struct sockaddr_in *) (&(saddr.sa)); - acopy ( hp_addr, &(inetaddr->sin_addr), hp->h_length); - len = sizeof(saddr.sa); - break; -#if defined(IPv6) && defined(AF_INET6) + int i = 0, j = 0; + IN_ADDR Inter; + saddr.sa.sa_family = hp->h_addrtype; + switch (hp->h_addrtype) { + case AF_INET: + if (protocol == 6) return; /* We should not be here: gethostbyname() is useless with inet6! */ + inetaddr = (struct sockaddr_in *) (&(saddr.sa)); + if (!pInterfaces) match_interface(0); + if (ActiveInterfaces && pInterfaces && *pInterfaces) + { + ErrorF ("DefineSelf - %s has %d usable IPv%d interface%s...\n address%s", + name.nodename, ActiveInterfaces, protocol, + ActiveInterfaces==1 ? "" : "s", + ActiveInterfaces==1 ? "" : "es"); + for (i = 0; hp->h_addr_list[i]; i++) + { + Inter.S_un.S_addr = *(u_long *)hp->h_addr_list[i]; + ErrorF(" %s", inet_ntoa(Inter)); + if (*pInterfaces == *(u_long *)hp->h_addr_list[i]) j = i; + } + ErrorF ("\n"); + } + break; +#if 0 /* We never used to get here and AF_INET6 is now processed by getaddrinfo() */ case AF_INET6: inet6addr = (struct sockaddr_in6 *) (&(saddr.sa)); acopy ( hp_addr, &(inet6addr->sin6_addr), hp->h_length); @@ -412,7 +563,14 @@ DefineSelf (int fd) #endif default: goto DefineLocalHost; - } + } + + for (i = -1; i < 0 || hp->h_addr_list[i]; i++) + { + if (i < 0) acopy ( hp->h_addr_list[j], &(inetaddr->sin_addr), hp->h_length); + else if (i == j) continue; + else acopy ( hp->h_addr_list[i], &(inetaddr->sin_addr), hp->h_length); + len = sizeof(saddr.sa); family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr); if ( family != -1 && family != FamilyLocal ) { @@ -462,12 +620,13 @@ DefineSelf (int fd) #endif /* XDMCP */ } } - } + } } /* * now add a host of family FamilyLocalHost... */ DefineLocalHost: + free(pInterfaces); for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); @@ -904,18 +1063,19 @@ ResetHosts (char *display) FreeHost (host); } -#if defined WIN32 && defined __MINGW32__ -#define ETC_HOST_PREFIX "X" -#else #define ETC_HOST_PREFIX "/etc/X" -#endif #define ETC_HOST_SUFFIX ".hosts" fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + strlen(display) + 1; if (fnamelen > sizeof(fname)) FatalError("Display name `%s' is too long\n", display); +#ifdef __MINGW32__ + snprintf(fname, sizeof(fname), "%s%s" ETC_HOST_SUFFIX, getenv("XHOSTPREFIX"), + display); +#else snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display); +#endif if ((fd = fopen (fname, "r")) != 0) { @@ -989,9 +1149,13 @@ ResetHosts (char *display) { struct addrinfo *addresses; struct addrinfo *a; + struct addrinfo hints; int f; - if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { + memset( &hints, 0, sizeof(hints) ); + if (family == FamilyInternet) hints.ai_family = AF_INET; + else if (family == FamilyInternet6) hints.ai_family = AF_INET6; + if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) { for (a = addresses ; a != NULL ; a = a->ai_next) { len = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&len,(pointer *)&addr); @@ -1318,6 +1482,8 @@ NewHost (int family, { register HOST *host; + if (family == FamilyLocal) return TRUE; /* No FamilyLocal in Vcxsrv */ + for (host = validhosts; host; host = host->next) { if (addrEqual (family, addr, len, host)) @@ -1780,6 +1946,7 @@ siHostnameAddrMatch(int family, pointer addr, int len, char hostname[SI_HOSTNAME_MAXLEN]; struct addrinfo *addresses; struct addrinfo *a; + struct addrinfo hints; int f, hostaddrlen; pointer hostaddr; @@ -1789,7 +1956,10 @@ siHostnameAddrMatch(int family, pointer addr, int len, strncpy(hostname, siAddr, siAddrLen); hostname[siAddrLen] = '\0'; - if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { + memset( &hints, 0, sizeof(hints) ); + if (family == FamilyInternet) hints.ai_family = AF_INET; + else if (family == FamilyInternet6) hints.ai_family = AF_INET6; + if (getaddrinfo(hostname, NULL, &hints, &addresses) == 0) { for (a = addresses ; a != NULL ; a = a->ai_next) { hostaddrlen = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr); @@ -1822,7 +1992,7 @@ siHostnameAddrMatch(int family, pointer addr, int len, if ((hp = _XGethostbyname(hostname, hparams)) != NULL) { #ifdef h_addr /* new 4.3bsd version of gethostent */ /* iterate over the addresses */ - for (addrlist = hp->h_addr_list; *addrlist; addrlist++) + for (addrlist = (const char **)hp->h_addr_list; *addrlist; addrlist++) #else addrlist = &hp->h_addr; #endif @@ -2104,3 +2274,55 @@ siTypesInitialize(void) &siLocalGroupPriv); #endif } + +void match_interface(u_long u_lQuery) +{ + WSADATA w; + SOCKET sd; + INTERFACE_INFO InterfaceList[25]; + PSOCKADDR_IN pAddress, pNetmask; + u_long nBytesReturned, tempAddress; + u_long u_lAddress, u_lNetmask, u_lFlags; + int nNumInterfaces, i, j = 0; + + if (WSAStartup(MAKEWORD(2,2), &w) != 0) + return; + + sd = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0); + if (sd == INVALID_SOCKET) + { + WSACleanup(); + return; + } + + if (WSAIoctl(sd, SIO_GET_INTERFACE_LIST, 0, 0, &InterfaceList, sizeof(InterfaceList), &nBytesReturned, 0, 0) == SOCKET_ERROR) + { + closesocket(sd); + WSACleanup(); + return; + } + + nNumInterfaces = (int)(nBytesReturned/sizeof(INTERFACE_INFO)); + pInterfaces = malloc(25*sizeof(u_long)); + for (i = 0; i < nNumInterfaces; ++i) + { + pAddress = &InterfaceList[i].iiAddress.AddressIn; + u_lAddress = pAddress->sin_addr.S_un.S_addr; + + pNetmask = &InterfaceList[i].iiNetmask.AddressIn; + u_lNetmask = pNetmask->sin_addr.S_un.S_addr; + + u_lFlags = InterfaceList[i].iiFlags; + if ((u_lFlags & IFF_UP) && !(u_lFlags & IFF_LOOPBACK)) + { + if ((u_lAddress & u_lNetmask) == (u_lQuery & u_lNetmask)) j = i; + *(pInterfaces + ActiveInterfaces) = u_lAddress; + ActiveInterfaces++; + } + } + tempAddress = *pInterfaces; + *pInterfaces = *(pInterfaces + j); + *(pInterfaces + j) = tempAddress; + closesocket(sd); + WSACleanup(); +} diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c index a95ab0343..da195df39 100644 --- a/xorg-server/os/connection.c +++ b/xorg-server/os/connection.c @@ -149,11 +149,13 @@ int MaxClients = 0; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ +#if !defined(_MSC_VER) static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ +static Pid_t ParentProcess; +#endif Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or equivalent) will send SIGCONT back. */ Bool PartialNetwork; /* continue even if unable to bind all addrs */ -static Pid_t ParentProcess; static Bool debug_conns = FALSE; @@ -424,16 +426,19 @@ CreateWellKnownSockets(void) { ListenTransFds = malloc(ListenTransCount * sizeof (int)); - for (i = 0; i < ListenTransCount; i++) + for (i = ListenTransCount; i > 0; i--) { - int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); + int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i-1]); - ListenTransFds[i] = fd; + ListenTransFds[i-1] = fd; FD_SET (fd, &WellKnownConnections); - if (!_XSERVTransIsLocal (ListenTransConns[i])) + if (!_XSERVTransIsLocal (ListenTransConns[i-1])) { - DefineSelf (fd); + int protocol = 0; + if (!strcmp("inet", ListenTransConns[i-1]->transptr->TransName)) protocol = 4; + else if (!strcmp("inet6", ListenTransConns[i-1]->transptr->TransName)) protocol = 6; + DefineSelf (fd, protocol); } } } @@ -993,9 +998,10 @@ CheckConnections(void) { #ifndef WIN32 fd_mask mask; + int curoff; #endif fd_set tmask; - int curclient, curoff; + int curclient; int i; struct timeval notime; int r; @@ -1027,6 +1033,7 @@ CheckConnections(void) } } #else + /* First test AllSockets and then AllClients are valid sockets */ XFD_COPYSET(&AllSockets, &savedAllSockets); for (j=0; j<2; j++) { @@ -1037,7 +1044,7 @@ CheckConnections(void) FD_SET(curclient, &tmask); do { r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); - } while (r < 0 && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK)); + } while (r == SOCKET_ERROR && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK)); if (r < 0) if (GetConnectionTranslation(curclient) > 0) CloseDownClient(clients[GetConnectionTranslation(curclient)]); diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index 8d4dfc4ec..8b5d24b94 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -510,7 +510,7 @@ VAuditF(const char *f, va_list args) if (auditTimer != NULL) TimerForce(auditTimer); ErrorF("%s%s", prefix != NULL ? prefix : "", buf); - strlcpy(oldbuf, buf, sizeof(oldbuf)); + strncpy(oldbuf, buf, sizeof(oldbuf)); oldlen = len; nrepeat = 0; auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 5f3054941..72f07684e 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -494,7 +494,10 @@ AdjustWaitForDelay (pointer waitTime, unsigned long newdelay) void UseMsg(void) { - ErrorF("use: X [:] [option]\n"); + ErrorF("Usage...\nVcxsrv [:] [option]\n\n"); + ErrorF(":display-number\n\tVcxsrv runs as the given display-number, which defaults to 0.\n"); + ErrorF("\tTo run multiple instances, use unique display-numbers.\n\n"); + ErrorF("-a # default pointer acceleration (factor)\n"); ErrorF("-ac disable access control restrictions\n"); ErrorF("-audit int set audit trail level\n"); @@ -502,12 +505,14 @@ void UseMsg(void) ErrorF("-br create root window with black background\n"); ErrorF("+bs enable any backing store support\n"); ErrorF("-bs disable any backing store support\n"); - ErrorF("-c turns off key-click\n"); - ErrorF("c # key-click volume (0-100)\n"); ErrorF("-cc int default color visual class\n"); ErrorF("-nocursor disable the cursor\n"); ErrorF("-core generate core dump on fatal error\n"); +#ifdef _MSC_VER + ErrorF("-dpi [auto|int] screen resolution set to native or this dpi\n"); +#else ErrorF("-dpi int screen resolution in dots per inch\n"); +#endif #ifdef DPMSExtension ErrorF("-dpms disables VESA DPMS monitor control\n"); #endif @@ -532,31 +537,24 @@ void UseMsg(void) ErrorF("-noreset don't reset after last client exists\n"); ErrorF("-background [none] create root window with no background\n"); ErrorF("-reset reset after last client exists\n"); - ErrorF("-p # screen-saver pattern duration (minutes)\n"); ErrorF("-pn accept failure to listen on all ports\n"); ErrorF("-nopn reject failure to listen on all ports\n"); ErrorF("-r turns off auto-repeat\n"); ErrorF("r turns on auto-repeat \n"); ErrorF("-render [default|mono|gray|color] set render color alloc policy\n"); - ErrorF("-retro start with classic stipple and cursor\n"); - ErrorF("-s # screen-saver timeout (minutes)\n"); + ErrorF("-retro start with classic stipple\n"); ErrorF("-t # default pointer threshold (pixels/t)\n"); ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); - ErrorF("ttyxx server started from init on /dev/ttyxx\n"); - ErrorF("v video blanking for screen-saver\n"); - ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); ErrorF("-wr create root window with white background\n"); - ErrorF("-maxbigreqsize set maximal bigrequest size \n"); #ifdef PANORAMIX ErrorF("+xinerama Enable XINERAMA extension\n"); ErrorF("-xinerama Disable XINERAMA extension\n"); #endif ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n"); ErrorF("-schedInterval int Set scheduler interval in msec\n"); - ErrorF("-sigstop Enable SIGSTOP based startup\n"); ErrorF("+extension name Enable extension\n"); ErrorF("-extension name Disable extension\n"); #ifdef XDMCP @@ -650,17 +648,6 @@ ProcessCommandLine(int argc, char *argv[]) enableBackingStore = TRUE; else if ( strcmp( argv[i], "-bs") == 0) disableBackingStore = TRUE; - else if ( strcmp( argv[i], "c") == 0) - { - if(++i < argc) - defaultKeyboardControl.click = atoi(argv[i]); - else - UseMsg(); - } - else if ( strcmp( argv[i], "-c") == 0) - { - defaultKeyboardControl.click = 0; - } else if ( strcmp( argv[i], "-cc") == 0) { if(++i < argc) @@ -685,7 +672,24 @@ ProcessCommandLine(int argc, char *argv[]) else if ( strcmp( argv[i], "-dpi") == 0) { if(++i < argc) +#ifdef _MSC_VER + { + if (strcmp(argv[i], "auto") == 0) + { + HDC hdc = GetDC(NULL); + if (hdc) + { + int dpiY = GetDeviceCaps(hdc, LOGPIXELSY); + monitorResolution = dpiY; + ReleaseDC(NULL, hdc); + } + } + else if (isdigit(*argv[i])) /* Naively prevent a crash if not numeric */ + monitorResolution = atoi(argv[i]); + } +#else monitorResolution = atoi(argv[i]); +#endif else UseMsg(); } @@ -853,10 +857,6 @@ ProcessCommandLine(int argc, char *argv[]) { noTestExtensions = TRUE; } - else if ( strcmp( argv[i], "v") == 0) - defaultScreenSaverBlanking = PreferBlanking; - else if ( strcmp( argv[i], "-v") == 0) - defaultScreenSaverBlanking = DontPreferBlanking; else if ( strcmp( argv[i], "-wm") == 0) defaultBackingStore = WhenMapped; else if ( strcmp( argv[i], "-wr") == 0) @@ -950,10 +950,6 @@ ProcessCommandLine(int argc, char *argv[]) else UseMsg (); } - else if ( strcmp( argv[i], "-sigstop") == 0) - { - RunFromSigStopParent = TRUE; - } else if ( strcmp( argv[i], "+extension") == 0) { if (++i < argc) diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c index d587e91b5..f4ecc9b57 100644 --- a/xorg-server/os/xdmcp.c +++ b/xorg-server/os/xdmcp.c @@ -62,6 +62,8 @@ static char *defaultDisplayClass = COMPILEDDISPLAYCLASS; +extern void match_interface(u_long u_lQuery); + static int xdmcpSocket, sessionSocket; static xdmcp_states state; #if defined(IPv6) && defined(AF_INET6) @@ -1601,9 +1603,6 @@ get_addr_by_name( struct hostent *hep; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; -#endif -#if defined(WIN32) && defined(TCPCONN) - _XSERVTransWSAStartup(); #endif if (!(hep = _XGethostbyname(namestr, hparams))) { @@ -1630,6 +1629,9 @@ get_manager_by_name( int i) { + PSOCKADDR_IN queryAddr = NULL; + u_long u_lqueryAddr = 0; + if ((i + 1) == argc) { FatalError("Xserver: missing %s host name in command line\n", argv[i]); @@ -1641,6 +1643,9 @@ get_manager_by_name( , &mgrAddr, &mgrAddrFirst #endif ); + queryAddr = (PSOCKADDR_IN)&ManagerAddress; + u_lqueryAddr = queryAddr->sin_addr.S_un.S_addr; + match_interface(u_lqueryAddr); } -- cgit v1.2.3