aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/dix-config.h15
-rw-r--r--makefile.before2
-rw-r--r--xorg-server/hw/xwin/winauth.c11
-rw-r--r--xorg-server/include/os.h2
-rw-r--r--xorg-server/os/access.c284
-rw-r--r--xorg-server/os/connection.c23
-rw-r--r--xorg-server/os/log.c2
-rw-r--r--xorg-server/os/utils.c56
-rw-r--r--xorg-server/os/xdmcp.c11
9 files changed, 325 insertions, 81 deletions
diff --git a/include/dix-config.h b/include/dix-config.h
index 4ff06c358..028c1a033 100644
--- a/include/dix-config.h
+++ b/include/dix-config.h
@@ -237,6 +237,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
/* Define to 1 if you have the <sys/vm86.h> header file. */
#undef HAVE_SYS_VM86_H
@@ -255,8 +258,11 @@
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
+/* Define to 1 if you have the `vasprintf' function. */
+#undef HAVE_VASPRINTF
+
/* Support IPv6 for TCP connections */
-#undef IPv6
+#define IPv6 1
/* Support os-specific local connections */
#undef LOCALCONN
@@ -291,6 +297,9 @@
/* Support X resource extension */
#define RES 1
+/* Support client ID tracking in X resource extension */
+#undef CLIENTIDS
+
/* Support MIT-SCREEN-SAVER extension */
#define SCREENSAVER 1
@@ -484,6 +493,10 @@
#include <X11/Xwinsock.h>
#include <X11/Xwindows.h>
+#if NTDDI_VERSION < NTDDI_VISTA
+int inet_pton(int af, const char *src, void *dst);
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
+#endif
#include <assert.h>
#define strcasecmp _stricmp
diff --git a/makefile.before b/makefile.before
index e613eb603..a5ed0aa68 100644
--- a/makefile.before
+++ b/makefile.before
@@ -61,7 +61,7 @@ endif
DEFINES += WIN32 _WIN32 _WINDOWS WINDOWS _MBCS __i386__ __MINGW32__ OPEN_MAX=256 PATH_MAX=256 _TIMEVAL_DEFINED mode_t=int __STDC__ X_LOCALE
-DEFINES += FAKEIT HAVE_CONFIG_H _BSD_SOURCE
+DEFINES += FAKEIT HAVE_CONFIG_H _BSD_SOURCE _WIN32_WINNT=_WIN32_WINNT_WINXP
TOPSRCDIR=$(MHMAKECONF)\xorg-server
diff --git a/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c
index 10bce693b..b603f70f5 100644
--- a/xorg-server/hw/xwin/winauth.c
+++ b/xorg-server/hw/xwin/winauth.c
@@ -32,6 +32,10 @@
#include <xwin-config.h>
#endif
+#define GC X11_GC /* To avoid compilation errors later when including win.h (which also defines the GC type) */
+#include <X11/Xlib.h>
+#undef GC
+
#include "win.h"
/* Includes for authorization */
@@ -136,7 +140,6 @@ GenerateAuthorization(
Bool
winGenerateAuthorization (void)
{
- Bool fFreeAuth = FALSE;
SecurityAuthorizationPtr pAuth = NULL;
/* Call OS layer to generate authorization key */
@@ -187,19 +190,16 @@ winGenerateAuthorization (void)
pAuth))
{
ErrorF ("winGenerateAuthorization - AddResource failed for auth.\n");
- fFreeAuth = TRUE;
goto auth_bailout;
}
/* Don't free the auth data, since it is still used internally */
- pAuth = NULL;
#endif
return TRUE;
auth_bailout:
- if (fFreeAuth)
- free(pAuth);
+ free(pAuth);
return FALSE;
}
@@ -208,6 +208,7 @@ winGenerateAuthorization (void)
void
winSetAuthorization(void)
{
+ if (g_pAuthData)
XSetAuthorization (AUTH_NAME,
strlen (AUTH_NAME),
g_pAuthData,
diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h
index dd3b05739..a11cacc44 100644
--- a/xorg-server/include/os.h
+++ b/xorg-server/include/os.h
@@ -392,7 +392,7 @@ extern _X_EXPORT void DisableLocalHost(void);
extern _X_EXPORT void AccessUsingXdmcp(void);
-extern _X_EXPORT void DefineSelf(int /*fd*/);
+extern _X_EXPORT void DefineSelf(int /*fd*/, const int /*protocol*/);
#if XDMCP
extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/);
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, &notime);
- } 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 [:<display>] [option]\n");
+ ErrorF("Usage...\nVcxsrv [:<display>] [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)
@@ -1602,9 +1604,6 @@ get_addr_by_name(
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
#endif
-#if defined(WIN32) && defined(TCPCONN)
- _XSERVTransWSAStartup();
-#endif
if (!(hep = _XGethostbyname(namestr, hparams)))
{
FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
@@ -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);
}