aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/os
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-07 21:38:18 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-07 21:38:18 +0200
commit3039a34cbd8716766391fe7de5ea002f643bf143 (patch)
tree3dedb91af3a6a473d05b516eb7881065ca397ab7 /nx-X11/programs/Xserver/os
parent168c063dcaa8b60a3b6e3e1132416841d48419ea (diff)
parent736a2333e655ecfee78cb82f074cce5e84bdc218 (diff)
downloadnx-libs-3039a34cbd8716766391fe7de5ea002f643bf143.tar.gz
nx-libs-3039a34cbd8716766391fe7de5ea002f643bf143.tar.bz2
nx-libs-3039a34cbd8716766391fe7de5ea002f643bf143.zip
Merge branch 'uli42-pr/decouple-xserver' into 3.6.x
Attributes GH PR #208: https://github.com/ArcticaProject/nx-libs/pull/208
Diffstat (limited to 'nx-X11/programs/Xserver/os')
-rw-r--r--nx-X11/programs/Xserver/os/Imakefile8
-rw-r--r--nx-X11/programs/Xserver/os/access.c19
-rw-r--r--nx-X11/programs/Xserver/os/connection.c12
-rw-r--r--nx-X11/programs/Xserver/os/io.c3
-rw-r--r--nx-X11/programs/Xserver/os/utils.c5
-rw-r--r--nx-X11/programs/Xserver/os/xdmauth.c25
-rw-r--r--nx-X11/programs/Xserver/os/xdmcp.c4
-rw-r--r--nx-X11/programs/Xserver/os/xstrans.c17
8 files changed, 60 insertions, 33 deletions
diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile
index b1873b8fd..047ad6615 100644
--- a/nx-X11/programs/Xserver/os/Imakefile
+++ b/nx-X11/programs/Xserver/os/Imakefile
@@ -114,12 +114,12 @@ BOOTSTRAPCFLAGS =
SRCS = WaitFor.c access.c connection.c io.c $(COLOR_SRCS) \
osinit.c utils.c log.c auth.c mitauth.c secauth.c \
$(XDMAUTHSRCS) $(RPCSRCS) xdmcp.c OtherSources \
- transport.c $(SNPRINTF_SRCS) $(STRLCAT_SRCS) \
+ xstrans.c $(SNPRINTF_SRCS) $(STRLCAT_SRCS) \
xprintf.c
OBJS = WaitFor.o access.o connection.o io.o $(COLOR_OBJS) \
osinit.o utils.o log.o auth.o mitauth.o secauth.o \
$(XDMAUTHOBJS) $(RPCOBJS) xdmcp.o OtherObjects \
- transport.o $(SNPRINTF_OBJS) $(STRLCAT_OBJS) \
+ xstrans.o $(SNPRINTF_OBJS) $(STRLCAT_OBJS) \
xprintf.o
#if UseMemLeak
@@ -135,7 +135,7 @@ BOOTSTRAPCFLAGS =
#if HasPam && HasPamMisc
PAM_DEFINES = -DUSE_PAM
#endif
- DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) \
+ DEFINES = $(CONNECTION_FLAGS) $(MEM_DEFINES) \
$(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) \
$(RGB_DEFINES) $(GETPEER_DEFINES) \
$(RANDOM_DEFINES) $(BUGMSG) $(XTRANS_FAILDEFINES) $(NX_DEFINES)
@@ -172,8 +172,6 @@ SpecialCObjectRule(auth,$(ICONFIGFILES),$(XDMCP_DEFINES))
SpecialCObjectRule(xdmauth,$(ICONFIGFILES),$(XDMCP_DEFINES))
SpecialCObjectRule(xdmcp,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES))
SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES))
-SpecialCObjectRule(transport,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES))
-LinkSourceFile(transport.c,$(TRANSCOMMSRC))
SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES))
SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES))
SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES))
diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c
index db1b9b2c8..532e32f68 100644
--- a/nx-X11/programs/Xserver/os/access.c
+++ b/nx-X11/programs/Xserver/os/access.c
@@ -64,6 +64,9 @@ SOFTWARE.
#include <stdio.h>
#include <stdlib.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#include <nx-X11/Xauth.h>
#include <nx-X11/X.h>
@@ -1168,7 +1171,7 @@ ResetHosts (char *display)
struct dn_naddr dnaddr, *dnaddrp, *dnet_addr();
#endif
int family = 0;
- void *addr;
+ void *addr = NULL;
int len;
siTypesInitialize();
@@ -1306,8 +1309,8 @@ ResetHosts (char *display)
for (a = addresses ; a != NULL ; a = a->ai_next) {
len = a->ai_addrlen;
f = ConvertAddr(a->ai_addr,&len,(void **)&addr);
- if ( (family == f) ||
- ((family == FamilyWild) && (f != -1)) ) {
+ if (addr && ((family == f) ||
+ ((family == FamilyWild) && (f != -1)))) {
NewHost(f, addr, len, FALSE);
}
}
@@ -1696,7 +1699,7 @@ GetHosts (
for (host = validhosts; host; host = host->next)
{
len = host->len;
- if ((ptr + sizeof(xHostEntry) + len) > (data + n))
+ if ((ptr + sizeof(xHostEntry) + len) > ((unsigned char *) *data + n))
break;
((xHostEntry *)ptr)->family = host->family;
((xHostEntry *)ptr)->length = len;
@@ -1775,7 +1778,7 @@ InvalidHost (
ClientPtr client)
{
int family;
- void *addr;
+ void *addr = NULL;
register HOST *selfhost, *host;
if (!AccessEnabled) /* just let them in */
@@ -1810,7 +1813,7 @@ InvalidHost (
return (0);
}
} else {
- if (addrEqual (family, addr, len, host))
+ if (addr && addrEqual (family, addr, len, host))
return (0);
}
@@ -2082,7 +2085,7 @@ siHostnameAddrMatch(int family, void * addr, int len,
struct addrinfo *addresses;
struct addrinfo *a;
int f, hostaddrlen;
- void * hostaddr;
+ void * hostaddr = NULL;
if (siAddrLen >= sizeof(hostname))
return FALSE;
@@ -2094,7 +2097,7 @@ siHostnameAddrMatch(int family, void * addr, int len,
for (a = addresses ; a != NULL ; a = a->ai_next) {
hostaddrlen = a->ai_addrlen;
f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr);
- if ((f == family) && (len == hostaddrlen) &&
+ if ((f == family) && (len == hostaddrlen) && hostaddr &&
(acmp (addr, hostaddr, len) == 0) ) {
res = TRUE;
break;
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 4f635fa7e..9cba17864 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -70,15 +70,9 @@ SOFTWARE.
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
-#ifndef XSERV_t
-# define XSERV_t
-#endif
-#ifndef TRANS_SERVER
-# define TRANS_SERVER
-#endif
-#ifndef TRANS_REOPEN
-# define TRANS_REOPEN
-#endif
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#include <errno.h>
#include <signal.h>
diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c
index 77ed0d44a..d184a981c 100644
--- a/nx-X11/programs/Xserver/os/io.c
+++ b/nx-X11/programs/Xserver/os/io.c
@@ -64,6 +64,9 @@ SOFTWARE.
#include <nx-X11/Xwinsock.h>
#endif
#include <stdio.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#include <nx-X11/Xmd.h>
#include <errno.h>
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index a6982a3e2..8c69b1346 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -90,6 +90,9 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h>
#include "misc.h"
#include <nx-X11/X.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#include "input.h"
#include "dixfont.h"
@@ -141,7 +144,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef XKB
-#include <nx-X11/extensions/XKBsrv.h>
+#include "xkbsrv.h"
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
diff --git a/nx-X11/programs/Xserver/os/xdmauth.c b/nx-X11/programs/Xserver/os/xdmauth.c
index 75e748bea..48e1da6df 100644
--- a/nx-X11/programs/Xserver/os/xdmauth.c
+++ b/nx-X11/programs/Xserver/os/xdmauth.c
@@ -39,6 +39,9 @@ from The Open Group.
#include <stdio.h>
#include <nx-X11/X.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
#include <nx-X11/Xtrans/Xtrans.h>
#include "os.h"
#include "osdep.h"
@@ -66,8 +69,8 @@ XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
{
XdmAuthKeyPtr incoming;
- XdmcpUnwrap (incomingData->data, &privateKey,
- incomingData->data,incomingData->length);
+ XdmcpUnwrap (incomingData->data, (unsigned char *)&privateKey,
+ incomingData->data,incomingData->length);
if (packet_type == ACCEPT) {
if (incomingData->length != 8)
return FALSE;
@@ -86,7 +89,8 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
outgoingData->data = 0;
if (packet_type == REQUEST) {
if (XdmcpAllocARRAY8 (outgoingData, 8))
- XdmcpWrap (&rho, &privateKey, outgoingData->data, 8);
+ XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey,
+ outgoingData->data, 8);
}
return TRUE;
}
@@ -96,7 +100,8 @@ XdmAuthenticationAddAuth (int name_len, char *name,
int data_len, char *data)
{
Bool ret;
- XdmcpUnwrap (data, (unsigned char *)&privateKey, data, data_len);
+ XdmcpUnwrap ((unsigned char *)data, (unsigned char *)&privateKey,
+ (unsigned char *)data, data_len);
authFromXDMCP = TRUE;
ret = AddAuthorization (name_len, name, data_len, data);
authFromXDMCP = FALSE;
@@ -149,11 +154,11 @@ XdmAuthenticationInit (char *cookie, int cookie_len)
}
XdmcpGenerateKey (&rho);
XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen,
- (unsigned char *)&rho,
+ (char *)&rho,
sizeof (rho),
- XdmAuthenticationValidator,
- XdmAuthenticationGenerator,
- XdmAuthenticationAddAuth);
+ (ValidatorFunc)XdmAuthenticationValidator,
+ (GeneratorFunc)XdmAuthenticationGenerator,
+ (AddAuthorFunc)XdmAuthenticationAddAuth);
}
#endif /* XDMCP */
@@ -384,7 +389,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie,
if (!plain)
return (XID) -1;
for (auth = xdmAuth; auth; auth=auth->next) {
- XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length);
+ XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL)
{
client->next = xdmClients;
@@ -429,7 +434,7 @@ XdmToID (unsigned short cookie_length, char *cookie)
if (!plain)
return (XID) -1;
for (auth = xdmAuth; auth; auth=auth->next) {
- XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length);
+ XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL)
{
free (client);
diff --git a/nx-X11/programs/Xserver/os/xdmcp.c b/nx-X11/programs/Xserver/os/xdmcp.c
index 19b8753f7..d84fe2906 100644
--- a/nx-X11/programs/Xserver/os/xdmcp.c
+++ b/nx-X11/programs/Xserver/os/xdmcp.c
@@ -19,6 +19,10 @@
#ifdef WIN32
#include <nx-X11/Xwinsock.h>
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
+#include <nx-X11/Xtrans/Xtrans.h>
#endif
#include <nx-X11/Xos.h>
diff --git a/nx-X11/programs/Xserver/os/xstrans.c b/nx-X11/programs/Xserver/os/xstrans.c
new file mode 100644
index 000000000..cdb664430
--- /dev/null
+++ b/nx-X11/programs/Xserver/os/xstrans.c
@@ -0,0 +1,17 @@
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <nx-X11/Xfuncproto.h>
+
+/* ErrorF is used by xtrans */
+#ifndef HAVE_DIX_CONFIG_H
+extern _X_EXPORT void
+ErrorF(const char *f, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+#endif
+
+#define TRANS_REOPEN
+#define TRANS_SERVER
+#define XSERV_t
+#include <nx-X11/Xtrans/transport.c>