-diff -Nur XFree86-4.0.2.org/xc/config/cf/Server.tmpl XFree86-4.0.2/xc/config/cf/Server.tmpl
---- XFree86-4.0.2.org/xc/config/cf/Server.tmpl Fri Feb 18 17:23:07 2000
-+++ XFree86-4.0.2/xc/config/cf/Server.tmpl Thu Dec 21 08:47:33 2000
-@@ -31,8 +31,14 @@
- #ifndef MakeDllModules
- #define MakeDllModules NO
+diff -urN xc.orig/config/cf/Server.tmpl xc/config/cf/Server.tmpl
+--- xc.orig/config/cf/Server.tmpl Mon Dec 30 15:52:30 2002
++++ xc/config/cf/Server.tmpl Mon Dec 30 17:31:51 2002
+@@ -25,8 +25,14 @@
+ #ifndef DoThreadedServer
+ #define DoThreadedServer NO
#endif
+#ifndef XserverNeedsSetUID
+#define XserverNeedsSetUID NO
+#define InstallServerSetUID (XserverNeedsSetUID && !UseXserverWrapper)
#endif
- /*
-diff -Nur XFree86-4.0.2.org/xc/config/cf/xf86site.def XFree86-4.0.2/xc/config/cf/xf86site.def
---- XFree86-4.0.2.org/xc/config/cf/xf86site.def Thu Dec 21 09:01:05 2000
-+++ XFree86-4.0.2/xc/config/cf/xf86site.def Thu Dec 21 08:47:33 2000
-@@ -348,13 +348,15 @@
+ #ifdef CrossCompileDir
+diff -urN xc.orig/config/cf/xf86site.def xc/config/cf/xf86site.def
+--- xc.orig/config/cf/xf86site.def Mon Dec 30 15:52:31 2002
++++ xc/config/cf/xf86site.def Mon Dec 30 17:37:06 2002
+@@ -69,14 +69,15 @@
*/
/*
- * If you only run the X server under xdm the X servers don't need to be
- * installed SetUID, and you may comment out the lines below. If you run
- * the servers by hand (with xinit or startx), then they do need to be
-- * installed SetUID on most OSs.
-- * Consult your system administrator before making the X server setuid.
+- * installed SetUID on most platforms.
+ * The X servers need to run as root on most OSs. We're now using a
+ * wrapper in that case, but we still need to make it known that the
+ * servers need SetUID. When only using xdm, this (and the wrapper)
+ * are not required. Disabling this automatically disables use of the
+ * wrapper.
*
--#define InstallXserverSetUID NO
+- * Consult your system administrator before making the X server setuid.
+ * If you're only starting the Xservers with xdm set this to NO
-+ *
-+#define XserverNeedsSetUID NO
+ *
+-#define InstallXserverSetUID NO
++#define XserverNeedsSetUID NO
*/
- /*
-diff -Nur XFree86-4.0.2.org/xc/config/cf/xfree86.cf XFree86-4.0.2/xc/config/cf/xfree86.cf
---- XFree86-4.0.2.org/xc/config/cf/xfree86.cf Thu Dec 21 09:01:06 2000
-+++ XFree86-4.0.2/xc/config/cf/xfree86.cf Thu Dec 21 08:47:33 2000
-@@ -585,12 +585,15 @@
+
+diff -urN xc.orig/config/cf/xfree86.cf xc/config/cf/xfree86.cf
+--- xc.orig/config/cf/xfree86.cf Mon Dec 30 15:52:31 2002
++++ xc/config/cf/xfree86.cf Mon Dec 30 17:31:51 2002
+@@ -1104,12 +1104,15 @@
#endif
/*
# endif
#endif
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/Imakefile XFree86-4.0.2/xc/programs/Xserver/Imakefile
---- XFree86-4.0.2.org/xc/programs/Xserver/Imakefile Wed Dec 13 00:58:58 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/Imakefile Thu Dec 21 08:54:16 2000
+diff -urN xc.orig/programs/Xserver/Imakefile xc/programs/Xserver/Imakefile
+--- xc.orig/programs/Xserver/Imakefile Mon Dec 30 15:53:22 2002
++++ xc/programs/Xserver/Imakefile Mon Dec 30 17:31:51 2002
@@ -4,11 +4,6 @@
*/
- XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.205 2000/12/11 20:29:31 dawes Exp $
+ XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.275 2002/12/21 00:19:11 torrey Exp $
-#ifndef InstallXserverSetUID
-#define InstallXserverSetUID NO
#include <Server.tmpl>
#ifdef XFree86Version
-@@ -1017,6 +1012,11 @@
- $(XNESTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XNESTSYSLIBS))
+@@ -1146,6 +1141,12 @@
#endif /* XnestServer */
-+
+
+#if UseXserverWrapper
-+SetUIDProgramTarget(Xwrapper,os/wrapper.o,NullParameter,$(PAMLIBS),NullParameter)
++all:: Xwrapper
++SetUIDProgramTarget(Xwrapper,os/wrapper.o,NullParameter,$(SERVERPAMLIBRARIES),NullParameter)
+InstallProgramWithFlags(Xwrapper,$(BINDIR),$(INSTUIDFLAGS))
+#endif
-
- #if XnonServer
++
+ #if defined(XnonServer) && XnonServer
XCOMM
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c
---- XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Wed Nov 29 17:43:28 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Thu Dec 21 08:47:33 2000
+ XCOMM non server, just compile sources for build test
+diff -urN xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c
+--- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Mon Dec 30 15:53:52 2002
++++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Mon Dec 30 17:31:51 2002
@@ -66,7 +66,10 @@
/* check if we're run with euid==0 */
if (geteuid() != 0)
}
/*
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/os/Imakefile XFree86-4.0.2/xc/programs/Xserver/os/Imakefile
---- XFree86-4.0.2.org/xc/programs/Xserver/os/Imakefile Tue Dec 5 01:59:14 2000
-+++ XFree86-4.0.2/xc/programs/Xserver/os/Imakefile Thu Dec 21 08:47:33 2000
-@@ -113,6 +113,7 @@
+--- xc/programs/Xserver/os/Imakefile.orig 2006-02-19 16:51:31.000000000 +0100
++++ xc/programs/Xserver/os/Imakefile 2006-07-19 21:30:56.576028250 +0200
+@@ -239,6 +241,14 @@
+ SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES))
#endif
- DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) $(KRB5_DEFINES) $(RGB_DEFINES)
- INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes
-+ EXTRA_DEFINES = -DUSE_PAM
- DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS)
- LINTLIBS = ../dix/llib-ldix.ln
-@@ -156,6 +157,14 @@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
- #else
- SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES))
-+#endif
-+
-+#if UseXserverWrapper
++#if UseXserverWrapper && XF86Server
+AllTarget(wrapper.o)
+
-+ WRAPPER_DEFINES = -DXSERVER_PATH=\"/etc/X11/X\"
++ WRAPPER_DEFINES = -DXSERVER_PATH=\"/etc/X11/X\" $(PAMDEFINES)
+
+SpecialCObjectRule(wrapper,NullParameter,$(WRAPPER_DEFINES))
- #endif
-
++#endif
++
#if HasKrb5
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/os/wrapper.c XFree86-4.0.2/xc/programs/Xserver/os/wrapper.c
---- XFree86-4.0.2.org/xc/programs/Xserver/os/wrapper.c Thu Jan 1 01:00:00 1970
-+++ XFree86-4.0.2/xc/programs/Xserver/os/wrapper.c Thu Dec 21 08:47:33 2000
+ LinkSourceFile(k5encode.c,$(XAUTHSRC))
+ #endif
+diff -urN xc.orig/programs/Xserver/os/wrapper.c xc/programs/Xserver/os/wrapper.c
+--- xc.orig/programs/Xserver/os/wrapper.c Thu Jan 1 01:00:00 1970
++++ xc/programs/Xserver/os/wrapper.c Mon Dec 30 17:31:52 2002
@@ -0,0 +1,304 @@
+/*
+ * X server wrapper.
+ exit(1);
+}
+
-diff -Nur XFree86-4.0.2.org/xc/programs/xinit/xinit.c XFree86-4.0.2/xc/programs/xinit/xinit.c
---- XFree86-4.0.2.org/xc/programs/xinit/xinit.c Tue Nov 7 00:06:04 2000
-+++ XFree86-4.0.2/xc/programs/xinit/xinit.c Thu Dec 21 08:47:33 2000
-@@ -147,6 +147,7 @@
+diff -urN xc.orig/programs/xinit/startx.cpp xc/programs/xinit/startx.cpp
+--- xc.orig/programs/xinit/startx.cpp Mon Dec 30 15:54:10 2002
++++ xc/programs/xinit/startx.cpp Mon Dec 30 17:31:52 2002
+@@ -53,7 +53,7 @@
+ sysclientrc=XINITDIR/xinitrc
+ sysserverrc=XINITDIR/xserverrc
+ defaultclient=BINDIR/xterm
+-defaultserver=BINDIR/X
++defaultserver=BINDIR/Xwrapper
+ defaultclientargs=""
+ defaultserverargs=""
+ clientargs=""
+diff -urN xc.orig/programs/xinit/xinit.c xc/programs/xinit/xinit.c
+--- xc.orig/programs/xinit/xinit.c Mon Dec 30 15:54:10 2002
++++ xc/programs/xinit/xinit.c Mon Dec 30 17:31:52 2002
+@@ -146,6 +146,7 @@
#define OK_EXIT 0
#define ERR_EXIT 1
+char *default_wrapper = BINDIR "/Xwrapper";
char *default_server = "X";
char *default_display = ":0"; /* choose most efficient */
- #ifndef __EMX__
-@@ -316,7 +317,10 @@
+ char *default_client[] = {"xterm", "-geometry", "+1+1", "-n", "login", NULL};
+@@ -332,7 +333,10 @@
if (argc == 0 ||
- #ifndef __EMX__
+ #ifndef __UNIXOS2__
(**argv != '/' && **argv != '.')) {
- *sptr++ = default_server;
+ if (access(default_wrapper, X_OK) == 0)