-diff -urN XFree86-4.0.1.orig/xc/config/cf/Server.tmpl XFree86-4.0.1/xc/config/cf/Server.tmpl
---- XFree86-4.0.1.orig/xc/config/cf/Server.tmpl Fri Feb 18 17:23:07 2000
-+++ XFree86-4.0.1/xc/config/cf/Server.tmpl Mon Jul 10 04:01:04 2000
+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
#endif
/*
-diff -urN XFree86-4.0.1.orig/xc/config/cf/xf86site.def XFree86-4.0.1/xc/config/cf/xf86site.def
---- XFree86-4.0.1.orig/xc/config/cf/xf86site.def Mon Jul 10 03:59:05 2000
-+++ XFree86-4.0.1/xc/config/cf/xf86site.def Mon Jul 10 04:01:04 2000
-@@ -305,13 +305,15 @@
+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 @@
*/
/*
*/
/*
-diff -urN XFree86-4.0.1.orig/xc/config/cf/xfree86.cf XFree86-4.0.1/xc/config/cf/xfree86.cf
---- XFree86-4.0.1.orig/xc/config/cf/xfree86.cf Mon Jul 10 03:59:05 2000
-+++ XFree86-4.0.1/xc/config/cf/xfree86.cf Mon Jul 10 04:01:04 2000
-@@ -550,12 +550,15 @@
+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 @@
#endif
/*
# endif
#endif
-diff -urN XFree86-4.0.1.orig/xc/programs/Xserver/Imakefile XFree86-4.0.1/xc/programs/Xserver/Imakefile
---- XFree86-4.0.1.orig/xc/programs/Xserver/Imakefile Sat Jun 17 20:42:16 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/Imakefile Mon Jul 10 04:01:33 2000
+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
@@ -4,11 +4,6 @@
*/
- XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.184 2000/06/17 00:03:10 martin Exp $
+ XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.205 2000/12/11 20:29:31 dawes Exp $
-#ifndef InstallXserverSetUID
-#define InstallXserverSetUID NO
#include <Server.tmpl>
#ifdef XFree86Version
-@@ -257,6 +252,7 @@
- SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(USB) \
- $(EXTRASYSLIBS)
+@@ -264,7 +259,7 @@
+ EXTRASYSLIBS = ServerExtraSysLibs
#endif
-+ PAMLIBS = -lpam -lpam_misc -ldl
- CBRT = mi/LibraryTargetName(cbrt)
- STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS)
-
-@@ -1012,6 +1008,11 @@
- $(XVFBLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XVFBSYSLIBS))
- #endif /* XVirtualFramebufferServer */
+ #if HasPam && HasPamMisc
+- PAMLIBS = PamLibraries PamMiscLibraries
++ PAMLIBS = -lpam -lpam_misc -ldl PamLibraries PamMiscLibraries
+ #endif
+ #if !(SystemV4 || defined(SGIArchitecture) || UseRgbTxt)
+ DBMLIBS = DBMLibrary
+@@ -1017,6 +1012,11 @@
+ $(XNESTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XNESTSYSLIBS))
+ #endif /* XnestServer */
+
+#if UseXserverWrapper
+InstallProgramWithFlags(Xwrapper,$(BINDIR),$(INSTUIDFLAGS))
+#endif
- CFBDIRS = $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR)
- IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR)
-diff -urN XFree86-4.0.1.orig/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c
---- XFree86-4.0.1.orig/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Fri Feb 25 19:28:11 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c Mon Jul 10 04:01:04 2000
-@@ -65,7 +65,10 @@
+ #if 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
+@@ -66,7 +66,10 @@
/* check if we're run with euid==0 */
if (geteuid() != 0)
{
}
/*
-diff -urN XFree86-4.0.1.orig/xc/programs/Xserver/os/Imakefile XFree86-4.0.1/xc/programs/Xserver/os/Imakefile
---- XFree86-4.0.1.orig/xc/programs/Xserver/os/Imakefile Fri May 5 19:47:29 2000
-+++ XFree86-4.0.1/xc/programs/Xserver/os/Imakefile Mon Jul 10 04:01:33 2000
-@@ -110,6 +110,7 @@
- ERROR_DEFINES = ServerErrorDefines
+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 @@
+ #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
-@@ -153,6 +154,14 @@
+@@ -156,6 +157,14 @@
cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
#else
SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES))
#endif
#if HasKrb5
-diff -urN XFree86-4.0.1.orig/xc/programs/Xserver/os/wrapper.c XFree86-4.0.1/xc/programs/Xserver/os/wrapper.c
---- XFree86-4.0.1.orig/xc/programs/Xserver/os/wrapper.c Thu Jan 1 01:00:00 1970
-+++ XFree86-4.0.1/xc/programs/Xserver/os/wrapper.c Mon Jul 10 04:01:33 2000
+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
@@ -0,0 +1,304 @@
+/*
+ * X server wrapper.
+ exit(1);
+}
+
-diff -urN XFree86-4.0.1.orig/xc/programs/xinit/xinit.c XFree86-4.0.1/xc/programs/xinit/xinit.c
---- XFree86-4.0.1.orig/xc/programs/xinit/xinit.c Wed Apr 5 20:14:08 2000
-+++ XFree86-4.0.1/xc/programs/xinit/xinit.c Mon Jul 10 04:01:04 2000
-@@ -143,6 +143,7 @@
+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 @@
#define OK_EXIT 0
#define ERR_EXIT 1
char *default_server = "X";
char *default_display = ":0"; /* choose most efficient */
#ifndef __EMX__
-@@ -312,7 +313,10 @@
+@@ -316,7 +317,10 @@
if (argc == 0 ||
#ifndef __EMX__
(**argv != '/' && **argv != '.')) {
--- /dev/null
+--- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c.lemming Mon Jul 3 02:10:01 2000
++++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c Mon Jul 3 02:10:29 2000
+@@ -289,7 +289,7 @@
+ if (!pciInitialized)
+ pciInit();
+
+- if ((bus < pciNumBuses || inProbe) && pciBusInfo[bus] &&
++ if ((bus < pciNumBuses) && pciBusInfo[bus] &&
+ pciBusInfo[bus]->funcs.pciReadLong) {
+ CARD32 rv = (*pciBusInfo[bus]->funcs.pciReadLong)(tag, offset);
+
-diff -urN xc/programs/xdm~/Imakefile xc/programs/xdm/Imakefile
---- xc/programs/xdm~/Imakefile Sat Jun 17 13:48:22 2000
-+++ xc/programs/xdm/Imakefile Thu Sep 7 18:17:08 2000
-@@ -224,9 +224,9 @@
+diff -Nur XFree86-4.0.2.org/xc/programs/xdm/Imakefile XFree86-4.0.2/xc/programs/xdm/Imakefile
+--- XFree86-4.0.2.org/xc/programs/xdm/Imakefile Wed Nov 29 17:46:07 2000
++++ XFree86-4.0.2/xc/programs/xdm/Imakefile Thu Dec 21 13:10:37 2000
+@@ -225,9 +225,9 @@
'-DDEF_SYSTEM_SHELL="$(BOURNE_SHELL)"' \
'-DDEF_FAILSAFE_CLIENT="$(BINDIR)/xterm"' \
'-DDEF_XDM_CONFIG="$(XDMDIR)/xdm-config"' \
- '-DDEF_CHOOSER="$(XDMDIR)/chooser"' \
- '-DDEF_AUTH_DIR="$(XDMDIR)"' \
- '-DDEF_GREETER_LIB="$(XDMDIR)/libXdmGreet.so"'
-+ '-DDEF_CHOOSER="$(BIN)/chooser"' \
++ '-DDEF_CHOOSER="$(DIR)/chooser"' \
+ '-DDEF_AUTH_DIR="$(XDMVARDIR)"' \
+ '-DDEF_GREETER_LIB="$(USRLIBDIR)/libXdmGreet.so"'
#endif
ComplexProgramTarget_1(xdm,$(LOCAL_LIBRARIES),NullParameter)
-@@ -246,7 +246,7 @@
+@@ -247,7 +247,7 @@
#if BuildChooser
SpecialCObjectRule(chooser, $(ICONFIGFILES), $(SOCK_DEFINES))
NormalProgramTarget(chooser,$(OBJS3),$(DEPLIBS3),$(LIBS3),NullParameter)
InstallAppDefaults(Chooser)
#endif
#if BuildBoth
-diff -urN xc/programs/xdm~/config/Imakefile xc/programs/xdm/config/Imakefile
---- xc/programs/xdm~/config/Imakefile Mon Jan 31 14:33:43 2000
-+++ xc/programs/xdm/config/Imakefile Thu Sep 7 18:17:08 2000
-@@ -25,7 +25,11 @@
+diff -Nur XFree86-4.0.2.org/xc/programs/xdm/config/Imakefile XFree86-4.0.2/xc/programs/xdm/config/Imakefile
+--- XFree86-4.0.2.org/xc/programs/xdm/config/Imakefile Mon Jan 31 20:33:43 2000
++++ XFree86-4.0.2/xc/programs/xdm/config/Imakefile Thu Dec 21 13:20:54 2000
+@@ -5,9 +5,7 @@
+
+ all:: Xservers.ws xdm-config Xservers Xresources
+
+-#if defined(i386Architecture) && (defined(NetBSDArchitecture) || defined(OpenBSDArchitecture))
+-DEFAULTVT=vt05
+-#endif
++DEFAULTVT=vt9
+
+ #ifndef XdmPixmap
+ # define XdmPixmap XFree86.xpm
+@@ -25,7 +23,11 @@
#endif
CppFileTarget(Xservers.ws,Xserv.ws.cpp,-DBINDIR=$(BINDIR) -DDEFAULTVT=$(DEFAULTVT),NullParameter)
CppFileTarget(Xresources,Xres.cpp,$(XPM_DEFINES),NullParameter)
LinkFile(Xservers,Xservers.$(SERVERSTYPE))
-diff -urN xc/programs/xdm~/config/Xres.cpp xc/programs/xdm/config/Xres.cpp
---- xc/programs/xdm~/config/Xres.cpp Sat Mar 13 22:22:24 1999
-+++ xc/programs/xdm/config/Xres.cpp Thu Sep 7 18:23:11 2000
-@@ -5,6 +5,13 @@
- xlogin*login.translations: #override BS
- Ctrl<Key>R: abort-display()NLBS
- <Key>F1: set-session-argument(failsafe) finish-field()NLBS
-+ <Key>Delete: delete-character()NLBS
-+ <Key>Left: move-backward-character()NLBS
-+ <Key>Right: move-forward-character()NLBS
-+ <Key>Home: move-to-begining()NLBS
-+ <Key>End: move-to-end()NLBS
-+ Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()NLBS
-+ <Key>KP_Enter: set-session-argument() finish-field()NLBS
- Ctrl<Key>Return: set-session-argument(failsafe) finish-field()NLBS
- <Key>Return: set-session-argument() finish-field()
- #ifndef XPM
-@@ -29,9 +36,7 @@
+diff -Nur XFree86-4.0.2.org/xc/programs/xdm/config/Xres.cpp XFree86-4.0.2/xc/programs/xdm/config/Xres.cpp
+--- XFree86-4.0.2.org/xc/programs/xdm/config/Xres.cpp Thu Dec 21 13:06:17 2000
++++ XFree86-4.0.2/xc/programs/xdm/config/Xres.cpp Thu Dec 21 13:19:25 2000
+@@ -36,9 +36,7 @@
/**/#endif
#endif /* XPM */
/**/#ifdef COLOR
xlogin*borderWidth: 1
xlogin*frameWidth: 5
xlogin*innerFramesWidth: 2
-@@ -40,6 +45,8 @@
+@@ -47,6 +45,8 @@
xlogin*background: grey
!xlogin*foreground: darkgreen
xlogin*greetColor: Blue3
+#else
-+xlogin*greetColor: CadetBlue
++login*greetColor: CadetBlue
#endif /* XPM */
xlogin*failColor: red
*Foreground: black
-@@ -76,6 +83,6 @@
- Chooser*allowShellResize: false
- Chooser*viewport.forceBars: true
- Chooser*label.font: *-new century schoolbook-bold-i-normal-*-240-*
--Chooser*label.label: XDMCP Host Menu from CLIENTHOST
-+Chooser*label.label: XDMCP Host Menu from CLIENTHOST
- Chooser*list.font: -*-*-medium-r-normal-*-*-230-*-*-c-*-iso8859-1
- Chooser*Command.font: *-new century schoolbook-bold-r-normal-*-180-*
-diff -urN xc/programs/xdm~/greeter/Imakefile xc/programs/xdm/greeter/Imakefile
---- xc/programs/xdm~/greeter/Imakefile Wed Jun 14 14:43:32 2000
-+++ xc/programs/xdm/greeter/Imakefile Thu Sep 7 18:17:08 2000
-@@ -76,8 +76,6 @@
- INCLUDES = -I.. $(KRBIV_INCLUDES) $(KRB5_INCLUDE)
+diff -Nur XFree86-4.0.2.org/xc/programs/xdm/greeter/Imakefile XFree86-4.0.2/xc/programs/xdm/greeter/Imakefile
+--- XFree86-4.0.2.org/xc/programs/xdm/greeter/Imakefile Wed Jun 14 21:43:32 2000
++++ XFree86-4.0.2/xc/programs/xdm/greeter/Imakefile Thu Dec 21 13:20:13 2000
+@@ -77,8 +77,6 @@
DEFINES = $(GREETER_DEFINES) $(XDMAUTH_DEFINES) $(RPC_DEFINES) \
$(KRBIV_DEFINES) $(KRB5_DEFINES) $(PWD_DEFINES) $(PAM_DEFINES)
--
--SHLIBDIR = $(XDMDIR)
+-SHLIBDIR = $(XDMDIR)
+-
SRCS = greet.c verify.c Login.c
OBJS = greet.o verify.o Login.o
---- xc/programs/xdm/config/Imakefile~ Thu Nov 9 23:37:34 2000
-+++ xc/programs/xdm/config/Imakefile Thu Nov 9 23:38:18 2000
-@@ -5,9 +5,7 @@
-
- all:: Xservers.ws xdm-config Xservers Xresources
-
--#if defined(i386Architecture) && (defined(NetBSDArchitecture) || defined(OpenBSDArchitecture))
--DEFAULTVT=vt05
--#endif
-+DEFAULTVT=vt9
- #ifndef XdmPixmap
- # define XdmPixmap XFree86.xpm
---- XFree86-4.0/xc/programs/xdm/xdmcp.c.xdmsecurity.patch Sat Oct 10 11:25:40 1998
-+++ XFree86-4.0/xc/programs/xdm/xdmcp.c Wed Jun 28 18:30:13 2000
+--- XFree86-4.0.2/xc/programs/xdm/xdmcp.c~ Thu Dec 21 19:46:57 2000
++++ XFree86-4.0.2/xc/programs/xdm/xdmcp.c Thu Dec 21 19:47:25 2000
@@ -1128,7 +1128,7 @@
XdmcpHeader header;
ARRAY8 status;
-- sprintf (buf, "Session %ld failed for display %s: %s",
-+ snprintf (buf, sizeof(buf), "Session %ld failed for display %s: %s",
+- sprintf (buf, "Session %ld failed for display %.100s: %.100s",
++ snprintf (buf, sizeof(buf), "Session %ld failed for display %.100s: %.100s",
(long) sessionID, name, reason);
Debug ("Send failed %ld %s\n", (long) sessionID, buf);
status.length = strlen (buf);
--- /dev/null
+diff -Nur XFree86-4.0.2.org/xc/programs/xfs/difs/fonts.c XFree86-4.0.2/xc/programs/xfs/difs/fonts.c
+--- XFree86-4.0.2.org/xc/programs/xfs/difs/fonts.c Thu Dec 14 20:54:53 2000
++++ XFree86-4.0.2/xc/programs/xfs/difs/fonts.c Thu Dec 21 09:26:42 2000
+@@ -108,6 +108,113 @@
+ }
+
+ /*
++ * xf86GetPathElem --
++ * Extract a single element from the font path string starting at
++ * pnt. The font path element will be returned, and pnt will be
++ * updated to point to the start of the next element, or set to
++ * NULL if there are no more.
++ */
++char *
++xf86GetPathElem(pnt)
++ char **pnt;
++{
++ char *p1;
++
++ p1 = *pnt;
++ *pnt = index(*pnt, ',');
++ if (*pnt != NULL) {
++ **pnt = '\0';
++ *pnt += 1;
++ }
++ return(p1);
++}
++
++/*
++ * xf86ValidateFontPath --
++ * Validates the user-specified font path. Each element that
++ * begins with a '/' is checked to make sure the directory exists.
++ * If the directory exists, the existence of a file named 'fonts.dir'
++ * is checked. If either check fails, an error is printed and the
++ * element is removed from the font path.
++ */
++#define DIR_FILE "/fonts.dir"
++#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type))
++static char *
++xf86ValidateFontPath(path)
++ char *path;
++{
++ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
++ struct stat stat_buf;
++ int flag;
++ int dirlen;
++
++ tmp_path = (char *)calloc(1,strlen(path)+1);
++ out_pnt = tmp_path;
++ path_elem = NULL;
++ next = path;
++ while (next != NULL) {
++ path_elem = xf86GetPathElem(&next);
++#ifndef __EMX__
++ if (*path_elem == '/') {
++ dir_elem = (char *)calloc(1, strlen(path_elem) + 1);
++ if ((p1 = strchr(path_elem, ':')) != 0)
++#else
++ /* OS/2 must prepend X11ROOT */
++ if (*path_elem == '/') {
++ path_elem = (char*)__XOS2RedirRoot(path_elem);
++ dir_elem = (char*)calloc(1, strlen(path_elem) + 1);
++ if (p1 = strchr(path_elem+2, ':'))
++#endif
++ dirlen = p1 - path_elem;
++ else
++ dirlen = strlen(path_elem);
++ strncpy(dir_elem, path_elem, dirlen);
++ dir_elem[dirlen] = '\0';
++ flag = stat(dir_elem, &stat_buf);
++ if (flag == 0)
++ if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR))
++ flag = -1;
++ if (flag != 0) {
++ printf("warning!\n");
++ ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem);
++ ErrorF(" Entry deleted from font path.\n");
++ continue;
++ }
++ else {
++ p1 = (char *)malloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
++ strcpy(p1, dir_elem);
++ strcat(p1, DIR_FILE);
++ flag = stat(p1, &stat_buf);
++ if (flag == 0)
++ if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
++ flag = -1;
++#ifndef __EMX__
++ free(p1);
++#endif
++ if (flag != 0) {
++ ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n",
++ dir_elem);
++ ErrorF(" Entry deleted from font path.\n");
++ ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem);
++ continue;
++ }
++ }
++ free(dir_elem);
++ }
++
++ /*
++ * Either an OK directory, or a font server name. So add it to
++ * the path.
++ */
++ if (out_pnt != tmp_path)
++ *out_pnt++ = ',';
++ strcat(out_pnt, path_elem);
++ out_pnt += strlen(path_elem);
++ }
++ return(tmp_path);
++}
++
++/*
+ * note that the font wakeup queue is not refcounted. this is because
+ * an fpe needs to be added when it's inited, and removed when it's finally
+ * freed, in order to handle any data that isn't requested, like FS events.
+@@ -744,8 +851,12 @@
+ *end,
+ *p;
+ int err;
++ char *fixedpath;
++
++ fixedpath = xf86ValidateFontPath(str);
+
+- len = strlen(str) + 1;
++ len = strlen(fixedpath) + 1;
++ str = fixedpath;
+ paths = p = (char *) ALLOCATE_LOCAL(len);
+ npaths = 0;
+
+@@ -765,6 +876,7 @@
+
+ err = set_font_path_elements(npaths, paths, badpath);
+
++ free(fixedpath);
+ DEALLOCATE_LOCAL(paths);
+
+ return err;
+diff -Nur XFree86-4.0.2.org/xc/programs/xfs/difs/main.c XFree86-4.0.2/xc/programs/xfs/difs/main.c
+--- XFree86-4.0.2.org/xc/programs/xfs/difs/main.c Sat Dec 9 05:02:14 2000
++++ XFree86-4.0.2/xc/programs/xfs/difs/main.c Thu Dec 21 09:40:53 2000
+@@ -56,12 +56,18 @@
+ #include "dispatch.h"
+ #include "extentst.h"
+ #include "difs.h"
++#include <unistd.h>
++#include <pwd.h>
++#include <sys/types.h>
+
+ char *ConnectionInfo;
+ int ConnInfoLen;
+
+ Cache serverCache;
+
++int droppriv; /* whether or not to drop root privileges at startup */
++int becomeDaemon; /* whether or not to become a daemon */
++
+ #ifndef DEFAULT_CONFIG_FILE
+ #define DEFAULT_CONFIG_FILE "/usr/lib/X11/fs/config"
+ #endif
+@@ -84,13 +90,39 @@
+
+ argcGlobal = argc;
+ argvGlobal = argv;
+-
++ droppriv = 0;
++ becomeDaemon =0;
++
+ configfilename = DEFAULT_CONFIG_FILE;
+
+ /* init stuff */
+ ProcessCmdLine(argc, argv);
+ InitErrors();
+
++ /* become xfs user, if possible */
++ if ((geteuid() == 0) && droppriv) {
++ pwent = getpwnam("xfs");
++ if (pwent) {
++ if (setgid(pwent->pw_gid)) {
++ ErrorF("fatal: couldn't set groupid to xfs user's group\n");
++ exit(1);
++ }
++
++ if (setgroups(0, 0)) {
++ ErrorF("fatal: couldn't drop supplementary groups\n");
++ exit(1);
++ }
++
++ if (setuid(pwent->pw_uid)) {
++ ErrorF("fatal: couldn't set userid to xfs user\n");
++ exit(1);
++ }
++ }
++ } else if (droppriv) {
++ ErrorF("fatal: droppriv flag specified, but xfs not run as root\n");
++ exit(1);
++ }
++
+ /*
+ * do this first thing, to get any options that only take effect at
+ * startup time. it is read again each time the server resets
+@@ -99,6 +131,10 @@
+ ErrorF("fatal: couldn't read config file\n");
+ exit(1);
+ }
++
++ /* become a daemon if explicitly requested to do so. */
++ if (becomeDaemon)
++ daemon(0, 0);
+
+ /* make sure at least world write access is disabled */
+ if (((oldumask = umask(022)) & 002) == 002)
+diff -Nur XFree86-4.0.2.org/xc/programs/xfs/os/error.c XFree86-4.0.2/xc/programs/xfs/os/error.c
+--- XFree86-4.0.2.org/xc/programs/xfs/os/error.c Tue Dec 5 01:59:41 2000
++++ XFree86-4.0.2/xc/programs/xfs/os/error.c Thu Dec 21 09:26:42 2000
+@@ -81,6 +81,7 @@
+ Bool log_open = FALSE;
+ #endif
+ char ErrorFile[PATH_MAX];
++int log_open = 0;
+
+ static void
+ abort_server(void)
+diff -Nur XFree86-4.0.2.org/xc/programs/xfs/os/utils.c XFree86-4.0.2/xc/programs/xfs/os/utils.c
+--- XFree86-4.0.2.org/xc/programs/xfs/os/utils.c Tue Dec 5 01:59:41 2000
++++ XFree86-4.0.2/xc/programs/xfs/os/utils.c Thu Dec 21 09:26:42 2000
+@@ -317,6 +317,10 @@
+ userId = argv[++i];
+ else
+ usage();
++ } else if (!strcmp(argv[i], "-droppriv")) {
++ droppriv = 1;
++ } else if (!strcmp(argv[i], "-daemon")) {
++ becomeDaemon = 1;
+ } else if (!strcmp(argv[i], "-cf") || !strcmp(argv[i], "-config")) {
+ if (argv[i + 1])
+ configfilename = argv[++i];
--- XFree86-4.0.1/xc/programs/xman/vendor.h.foo Mon Aug 14 15:13:05 2000
+++ XFree86-4.0.1/xc/programs/xman/vendor.h Mon Aug 14 15:13:38 2000
-@@ -60,7 +60,7 @@
+@@ -63,7 +63,7 @@
+ # define MANCONF "/etc/manpath.config"
+ #else
+ # if (defined(BSD) && (BSD >= 199103)) || defined(linux)
+-# define MANCONF "/etc/man.conf"
++# define MANCONF "/etc/man.config"
+ # endif
#endif
- #if (defined(BSD) && (BSD >= 199103)) || defined(linux)
--# define MANCONF "/etc/man.conf"
-+# define MANCONF "/etc/man.config"
- #endif
-
- /*
--- XFree86-4.0.1/xc/programs/xman/xman.man.foo Mon Aug 14 15:13:11 2000
+++ XFree86-4.0.1/xc/programs/xman/xman.man Mon Aug 14 15:13:24 2000
@@ -90,8 +90,8 @@