+++ /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);
-
+++ /dev/null
-diff -Nur XFree86-4.0.2.org/xc/Makefile XFree86-4.0.2/xc/Makefile
---- XFree86-4.0.2.org/xc/Makefile Wed Mar 22 22:23:30 2000
-+++ XFree86-4.0.2/xc/Makefile Wed Dec 20 13:41:02 2000
-@@ -5,10 +5,10 @@
- # or add "MAKE = make" to this file.
-
- RELEASE = "Release 6.4"
--SHELL = /bin/sh
-+SHELL = /bin/sh -e
- RM = rm -f
- MV = mv
--WORLDOPTS = -k
-+WORLDOPTS =
- WIN32WORLDOPTS = -i
- TOP = .
- CURRENT_DIR = .
-diff -Nur XFree86-4.0.2.org/xc/config/cf/Imake.cf XFree86-4.0.2/xc/config/cf/Imake.cf
---- XFree86-4.0.2.org/xc/config/cf/Imake.cf Mon Nov 6 23:53:47 2000
-+++ XFree86-4.0.2/xc/config/cf/Imake.cf Wed Dec 20 13:41:02 2000
-@@ -689,6 +689,10 @@
- # define s390Architecture
- # undef __s390__
- # endif /* s390 */
-+# ifdef alpha
-+# define AlphaArchitecture
-+# undef alpha
-+# endif /* alpha */
- # ifdef __alpha
- # define AlphaArchitecture
- # undef __alpha
-diff -Nur XFree86-4.0.2.org/xc/config/cf/Imake.tmpl XFree86-4.0.2/xc/config/cf/Imake.tmpl
---- XFree86-4.0.2.org/xc/config/cf/Imake.tmpl Tue Dec 5 01:45:28 2000
-+++ XFree86-4.0.2/xc/config/cf/Imake.tmpl Wed Dec 20 13:41:02 2000
-@@ -220,7 +220,7 @@
-
- #ifndef BuildHtmlManPages
- #ifdef RmanCmd
--#define BuildHtmlManPages YES
-+#define BuildHtmlManPages NO
- #else
- #define BuildHtmlManPages NO
- #endif
-@@ -686,11 +686,7 @@
- #define LintlibDir $(USRLIBDIR)/lint
- #endif
- #ifndef SystemManDirectory
--#if SystemV4
- #define SystemManDirectory /usr/share/man
--#else
--#define SystemManDirectory /usr/man
--#endif
- #endif
- #ifndef ManDirectoryRoot
- #ifdef ProjectRoot
-@@ -817,7 +813,7 @@
- #define NoRConst NO /* YES if const for structs of funcs is bad */
- #endif
- #ifndef InstPgmFlags
--#define InstPgmFlags -s
-+#define InstPgmFlags
- #endif
- #ifndef InstBinFlags
- #define InstBinFlags -m 0755
-@@ -958,7 +954,7 @@
- #define CppCmd /lib/cpp
- #endif
- #ifndef RawCppCmd
--#define RawCppCmd CppCmd -undef
-+#define RawCppCmd CppCmd
- #endif
- #ifndef CppNoLineInfoOption
- #define CppNoLineInfoOption /**/
-diff -Nur XFree86-4.0.2.org/xc/config/cf/X11.tmpl XFree86-4.0.2/xc/config/cf/X11.tmpl
---- XFree86-4.0.2.org/xc/config/cf/X11.tmpl Sat Dec 16 07:39:25 2000
-+++ XFree86-4.0.2/xc/config/cf/X11.tmpl Wed Dec 20 13:41:02 2000
-@@ -882,8 +882,12 @@
- #endif
- #endif
-
-+#ifndef EtcX11Directory
-+#define EtcX11Directory /etc/X11
-+#endif
-+
- #ifndef DefaultFSConfigFile
--#define DefaultFSConfigFile $(LIBDIR)/fs/config
-+#define DefaultFSConfigFile $(ETCX11DIR)/fs/config
- #endif
-
- /* X-TrueType settings */
-@@ -1002,7 +1006,7 @@
- #define ConfigDir $(LIBDIR)/config
- #endif
- #ifndef DocDir
--#define DocDir $(LIBDIR)/doc
-+#define DocDir $(LIBDIR)/share/doc
- #endif
- #ifndef DocHtmlDir
- #define DocHtmlDir $(DOCDIR)/html
-@@ -1011,31 +1015,31 @@
- #define DocPsDir $(DOCDIR)/PostScript
- #endif
- #ifndef FontDir
--#define FontDir $(LIBDIR)/fonts
-+#define FontDir /usr/share/fonts
- #endif
- #ifndef AdmDir
--#define AdmDir /usr/adm
-+#define AdmDir /var/log
- #endif
- #ifndef XinitDir
--#define XinitDir $(LIBDIR)/xinit
-+#define XinitDir $(ETCX11DIR)/xinit
- #endif
- #ifndef XdmDir
--#define XdmDir $(LIBDIR)/xdm
-+#define XdmDir $(ETCX11DIR)/xdm
- #endif
- #ifndef XdmVarDir
- #define XdmVarDir $(VARLIBDIR)/xdm
- #endif
- #ifndef XdmAuthDir
--#define XdmAuthDir $(LIBDIR)/xdm
-+#define XdmAuthDir $(ETCX11DIR)/xdm
- #endif
- #ifndef XdmConfigurationSubdirectory /* under xdm sources */
- #define XdmConfigurationSubdirectory config
- #endif
- #ifndef TwmDir
--#define TwmDir $(LIBDIR)/twm
-+#define TwmDir $(ETCX11DIR)/twm
- #endif
- #ifndef XsmDir
--#define XsmDir $(LIBDIR)/xsm
-+#define XsmDir $(ETCX11DIR)/xsm
- #endif
- #ifndef NlsDir
- #define NlsDir $(LIBDIR)/nls
-@@ -1047,23 +1051,20 @@
- #define PexApiDir $(LIBDIR)/PEX
- #endif
- #ifndef LbxproxyDir
--#define LbxproxyDir $(LIBDIR)/lbxproxy
-+#define LbxproxyDir $(ETCX11DIR)/lbxproxy
- #endif
- #ifndef LbxproxyConfigSubdir /* under lbxproxy sources */
- #define LbxproxyConfigSubdir config
- #endif
- #ifndef ProxyManagerDir
--#define ProxyManagerDir $(LIBDIR)/proxymngr
-+#define ProxyManagerDir $(ETCX11DIR)/proxymngr
- #endif
- #ifndef ServerConfigDir
--#define ServerConfigDir $(LIBDIR)/xserver
-+#define ServerConfigDir $(ETCX11DIR)/xserver
- #endif
- #ifndef XPrintDir
- #define XPrintDir ServerConfigDir
- #endif
--#ifndef EtcX11Directory
--#define EtcX11Directory /etc/X11
--#endif
- #ifndef InstallSecurityConfig
- #define InstallSecurityConfig YES /* Install sample security policy */
- #endif
-@@ -1095,10 +1096,10 @@
- #define OsNameDefines /* as nothing */
- #endif
- #ifndef DefaultUserPath /* for xdm */
--#define DefaultUserPath :/bin:/usr/bin:$(BINDIR):/usr/ucb
-+#define DefaultUserPath /usr/local/bin:/bin:/usr/bin:$(BINDIR)
- #endif
- #ifndef DefaultSystemPath /* for xdm */
--#define DefaultSystemPath /etc:/bin:/usr/bin:$(BINDIR):/usr/ucb
-+#define DefaultSystemPath /sbin:/bin:/usr/sbin:/usr/bin:$(BINDIR)
- #endif
- #ifndef DefaultSystemShell /* for xdm to set in SHELL */
- #define DefaultSystemShell BourneShell
-@@ -1211,7 +1212,7 @@
-
- HTMLINDEXCMD = HtmlIndexCmd
-
-- DOCUTILSRC = $(XTOP)/doc/util
-+ DOCUTILSRC = $(XTOP)/share/doc/util
- CLIENTSRC = $(TOP)/clients
- DEMOSRC = $(TOP)/demos
- XDOCMACROS = $(DOCUTILSRC)/macros.t
-@@ -1225,7 +1226,7 @@
- SERVERSRC = $(XTOP)/programs/Xserver
- CONTRIBSRC = ContribDir
- UNSUPPORTEDSRC = UnsupportedDir
-- DOCSRC = $(XTOP)/doc
-+ DOCSRC = $(XTOP)/share/doc
- RGBSRC = $(XTOP)/programs/rgb
- BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf
- MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir
-diff -Nur XFree86-4.0.2.org/xc/config/cf/linux.cf XFree86-4.0.2/xc/config/cf/linux.cf
---- XFree86-4.0.2.org/xc/config/cf/linux.cf Thu Dec 14 20:24:08 2000
-+++ XFree86-4.0.2/xc/config/cf/linux.cf Wed Dec 20 13:45:03 2000
-@@ -276,7 +276,7 @@
- # if defined(i386Architecture) || defined(ia64Architecture)
- # if OSMajorVersion == 2
- /* Only tested for Linux 2.2.0 through 2.2.12 */
--# if OSMinorVersion == 2 && OSTeenyVersion <= 12
-+# if OSMinorVersion == 2
- # define BuildXF86DRM YES
- # else
- /* Only tested for Linux 2.3.0 through 2.3.18 */
-@@ -565,7 +565,7 @@
- #define StandardCppDefines StandardDefines
-
- #define HasVarRun YES
--#define VarDbDirectory $(VARDIR)/lib
-+#define VarDbDirectory /var/lib
-
- #ifndef XF86OSCardDrivers
- # define XF86OSCardDrivers v4l
-@@ -704,10 +704,10 @@
- #endif
-
- #ifndef LinkGLToUsrLib
--# define LinkGLToUsrLib YES
-+# define LinkGLToUsrLib NO
- #endif
- # ifndef LinkGLToUsrInclude
--# define LinkGLToUsrInclude YES
-+# define LinkGLToUsrInclude NO
- #endif
-
-
-diff -Nur XFree86-4.0.2.org/xc/config/cf/site.def XFree86-4.0.2/xc/config/cf/site.def
---- XFree86-4.0.2.org/xc/config/cf/site.def Tue Jun 27 02:55:45 2000
-+++ XFree86-4.0.2/xc/config/cf/site.def Wed Dec 20 13:41:02 2000
-@@ -131,10 +131,13 @@
- #define HasSentinel YES
- */
-
--/*
- #undef DefaultUserPath
--#define DefaultUserPath /bin:/usr/bin:$(BINDIR):/usr/ucb:/usr/local/bin
--*/
-+#define DefaultUserPath /usr/local/bin:/bin:/usr/bin:$(BINDIR)
-+#undef DefaultSystemPath
-+#define DefaultSystemPath /sbin:/bin:/usr/sbin:/usr/bin:$(BINDIR)
-+
-+
-+#define HasPam YES
-
-
- /* You do NOT need SetUID if you only run the server under xdm */
-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 14 20:24:16 2000
-+++ XFree86-4.0.2/xc/config/cf/xf86site.def Wed Dec 20 13:41:03 2000
-@@ -134,16 +134,16 @@
- * Some Linux releases don't have a libtermcap. In this case you may need
- * to uncomment the following
- *
--#define TermcapLibrary -lncurses
- */
-+#define TermcapLibrary -lncurses
-
- /*
- * If you have Tk (which is required to build XF86Setup), uncomment this
- * Note: version 4.0 or 4.1 is required, and XF86Setup links it statically by
- * default.
- *
--#define HasTk YES
- */
-+#define HasTk YES
-
- /*
- * Set the paths and names for your Tk library if they don't match the
-@@ -156,25 +156,25 @@
- *
- * Some Linux releases need TkLibDir set to /usr/X11R6/lib
- *
--#define TkLibDir /usr/local/lib
--#define TkIncDir /usr/local/include
--#define TkLibName tk
- */
-+#define TkLibDir /usr/lib
-+#define TkIncDir /usr/include
-+#define TkLibName tk
-
- /*
- * By default, XF86Setup is linked with a static Tk library. To change
- * that, uncomment the following line.
- *
--#define XF86SetupUsesStaticTk NO
- */
-+#define XF86SetupUsesStaticTk NO
-
- /*
- * If you have Tcl (which is required to build XF86Setup), uncomment this
- * Note: version 7.4 or 7.5 is required, and XF86Setup links it statically by
- * default.
- *
--#define HasTcl YES
- */
-+#define HasTcl YES
-
- /*
- * Set the paths and names for your Tcl library if they don't match the
-@@ -184,17 +184,17 @@
- *
- * Some Linux releases need TclIncDir set to /usr/include/tcl.
- *
--#define TclLibDir /usr/local/lib
--#define TclIncDir /usr/local/include
--#define TclLibName tcl
- */
-+#define TclLibDir /usr/lib
-+#define TclIncDir /usr/include
-+#define TclLibName tcl
-
- /*
- * By default, XF86Setup is linked with a static Tcl library. To change
- * that, uncomment the following line.
- *
--#define XF86SetupUsesStaticTcl NO
- */
-+#define XF86SetupUsesStaticTcl NO
-
- /*
- * Build a server that dynamically loads the modules by setting
-@@ -436,8 +436,8 @@
- /*
- * To not build/install the Cyrillic fonts, uncomment the following
- *
--#define BuildCyrillicFonts NO
- */
-+#define BuildCyrillicFonts YES
-
- /*
- * To not build/install the Latin2 fonts, uncomment the following
-@@ -626,8 +626,8 @@
- * To forceably build static libraries in addition to shared libraries,
- * uncomment this.
- *
--#define ForceNormalLib YES
- */
-+#define ForceNormalLib YES
-
- /*
- * Uncomment this if your default tools (eg, gcc, ld, as, etc) are
-@@ -713,26 +713,26 @@
- * HasGlide2 to YES and set the Glide2IncDir variable.
- * HasGlide2 is per default NO.
- *
--#define HasGlide2 YES
- */
-+#define HasGlide2 YES
-
- /*
- * Set the path to your Glide include files.
- *
--#define Glide2IncDir /usr/include/glide
- */
-+#define Glide2IncDir /usr/include/glide
-
- /*
- * The 3Dfx 3D DRI driver requires glide 3.
- *
--#define HasGlide3 YES
- */
-+#define HasGlide3 YES
-
- /*
- * Set the path to your Glide 3 include files.
- *
--#define Glide3IncDir /usr/include/glide3
- */
-+#define Glide3IncDir /usr/include/glide3
-
- /*
- * Undefine the following if you don't want to have config files and
-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 14 20:24:17 2000
-+++ XFree86-4.0.2/xc/config/cf/xfree86.cf Wed Dec 20 13:52:03 2000
-@@ -28,7 +28,7 @@
- #define XConfigFile XF86Config
- #endif
- #ifndef XConfigDir
--#define XConfigDir $(LIBDIR)
-+#define XConfigDir $(ETCX11DIR)
- #endif
- #ifndef XLogFile
- #define XLogFile XFree86
-@@ -520,9 +520,10 @@
-
- /* Pure PCI drivers should go first */
- # ifndef XF86CardDrivers
--# define XF86CardDrivers mga glint s3virge sis savage\
-- trident chips fbdev \
-- DevelDrivers vga \
-+# define XF86CardDrivers mga glint nv tga s3virge sis savage\
-+ neomagic i740 tdfx trident chips fbdev \
-+ DevelDrivers vga cirrus tseng apm ati\
-+ r128 ati v4l vga\
- XF86OSCardDrivers XF86ExtraCardDrivers
- # endif
- #endif
-diff -Nur XFree86-4.0.2.org/xc/config/imake/imake.c XFree86-4.0.2/xc/config/imake/imake.c
---- XFree86-4.0.2.org/xc/config/imake/imake.c Wed Nov 29 17:33:50 2000
-+++ XFree86-4.0.2/xc/config/imake/imake.c Wed Dec 20 13:41:03 2000
-@@ -952,6 +952,7 @@
- static char* yast = "/sbin/YaST";
- static char* redhat = "/etc/redhat-release";
- static char* debian = "/etc/debian_version";
-+ static char* pld = "/etc/pld-release";
-
- fprintf (inFile, "%s\n", "#define LinuxUnknown 0");
- fprintf (inFile, "%s\n", "#define LinuxSuSE 1");
-@@ -966,6 +967,7 @@
- fprintf (inFile, "%s\n", "#define LinuxTurbo 10");
- fprintf (inFile, "%s\n", "#define LinuxWare 11");
- fprintf (inFile, "%s\n", "#define LinuxYggdrasil 12");
-+ fprintf (inFile, "%s\n", "#define LinuxPLD 13");
-
- if (lstat (yast, &sb) == 0) {
- fprintf (inFile, "%s\n", "#define DefaultLinuxDistribution LinuxSuSE");
-@@ -982,6 +984,11 @@
- fprintf (inFile, "%s\n", "#define DefaultLinuxDistName Debian");
- /* You could also try to get the version of the Debian distrib by looking
- * at the content of /etc/debian_version */
-+ return;
-+ }
-+ if (lstat (pld, &sb) == 0) {
-+ fprintf (inFile, "%s\n", "#define DefaultLinuxDistribution LinuxPLD");
-+ fprintf (inFile, "%s\n", "#define DefaultLinuxDistName PLD");
- return;
- }
- /* what's the definitive way to tell what any particular distribution is? */
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile
---- XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile Sat Sep 4 15:04:28 1999
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile Wed Dec 20 13:41:03 2000
-@@ -118,7 +118,7 @@
-
- XCONFIG_DEFINES = $(EXT_DEFINES) -DXF86SETUP \
- '-DPROJECTROOT="$(PROJECTROOT)"' \
-- '-DSERVER_CONFIG_FILE="$(LIBDIR)/$(XCONFIGFILE)"' \
-+ '-DSERVER_CONFIG_FILE="/etc/X11/$(XCONFIGFILE)"' \
- $(SITE_FONT_PATH) $(SITE_RGB_DB) \
- -DNO_WRAPPERS
-
-diff -Nur XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl
---- XFree86-4.0.2.org/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl Sun Apr 5 18:15:52 1998
-+++ XFree86-4.0.2/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl Wed Dec 20 13:41:03 2000
-@@ -38,7 +38,7 @@
- set devid [lindex $DeviceIDs $idx]
- global Device_$devid
- set server [set Device_${devid}(Server)]
-- set linkname $Xwinhome/bin/X
-+ set linkname /etc/X11/X
- set lastlink $linkname
- for {set nlinks 0} \
- {[file exists $linkname] && [file type $linkname]=="link" \
-@@ -74,7 +74,7 @@
- set CWD [pwd]
- cd $linkdir
- catch "unlink X" ret
-- if [catch "link $Xwinhome/bin/XF86_$server X" ret] {
-+ if [catch "link ../../usr/X11R6/bin/XF86_$server X" ret] {
- mesg $messages(phase5.4) okay
- } else {
- mesg $messages(phase5.5) okay
-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 Wed Nov 29 17:46:09 2000
-+++ XFree86-4.0.2/xc/programs/xdm/config/Xres.cpp Wed Dec 20 13:41:03 2000
-@@ -66,9 +66,9 @@
- /**/#endif
- #ifdef XPM
- /**/#if PLANES >= 8
--xlogin*logoFileName: BITMAPDIR/**//XDM_PIXMAP
-+xlogin*logoFileName: BITMAPDIR/**//xdm-pld-logo.xpm
- /**/#else
--xlogin*logoFileName: BITMAPDIR/**//XDM_BWPIXMAP
-+xlogin*logoFileName: BITMAPDIR/**//xdm-pld-logo-bw.xpm
- /**/#endif
- xlogin*useShape: true
- xlogin*logoPadding: 10
-diff -Nur XFree86-4.0.2.org/xc/programs/xdm/resource.c XFree86-4.0.2/xc/programs/xdm/resource.c
---- XFree86-4.0.2.org/xc/programs/xdm/resource.c Sun Dec 6 07:08:49 1998
-+++ XFree86-4.0.2/xc/programs/xdm/resource.c Wed Dec 20 13:41:03 2000
-@@ -70,31 +70,31 @@
- */
- #ifndef __EMX__
- #ifndef DEF_SERVER_LINE
--#define DEF_SERVER_LINE ":0 local /usr/bin/X11/X :0"
-+#define DEF_SERVER_LINE ":0 local /usr/X11R6/bin/X :0"
- #endif
- #ifndef XRDB_PROGRAM
--#define XRDB_PROGRAM "/usr/bin/X11/xrdb"
-+#define XRDB_PROGRAM "/usr/X11R6/X11/xrdb"
- #endif
- #ifndef DEF_SESSION
--#define DEF_SESSION "/usr/bin/X11/xterm -ls"
-+#define DEF_SESSION "/usr/X11R6/bin/xterm -ls"
- #endif
- #ifndef DEF_USER_PATH
--#define DEF_USER_PATH ":/bin:/usr/bin:/usr/bin/X11:/usr/ucb"
-+#define DEF_USER_PATH "/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin"
- #endif
- #ifndef DEF_SYSTEM_PATH
--#define DEF_SYSTEM_PATH "/etc:/bin:/usr/bin:/usr/bin/X11:/usr/ucb"
-+#define DEF_SYSTEM_PATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"
- #endif
- #ifndef DEF_SYSTEM_SHELL
- #define DEF_SYSTEM_SHELL "/bin/sh"
- #endif
- #ifndef DEF_FAILSAFE_CLIENT
--#define DEF_FAILSAFE_CLIENT "/usr/bin/X11/xterm"
-+#define DEF_FAILSAFE_CLIENT "/usr/X11R6/bin/xterm"
- #endif
- #ifndef DEF_XDM_CONFIG
--#define DEF_XDM_CONFIG "/usr/lib/X11/xdm/xdm-config"
-+#define DEF_XDM_CONFIG "/etc/X11/xdm/xdm-config"
- #endif
- #ifndef DEF_CHOOSER
--#define DEF_CHOOSER "/usr/lib/X11/xdm/chooser"
-+#define DEF_CHOOSER "/etc/X11/xdm/chooser"
- #endif
- #ifndef DEF_AUTH_NAME
- #ifdef HASXDMAUTH
-@@ -104,7 +104,7 @@
- #endif
- #endif
- #ifndef DEF_AUTH_DIR
--#define DEF_AUTH_DIR "/usr/lib/X11/xdm"
-+#define DEF_AUTH_DIR "/etc/X11/xdm"
- #endif
- #ifndef DEF_USER_AUTH_DIR
- #define DEF_USER_AUTH_DIR "/tmp"
-diff -Nur XFree86-4.0.2.org/xc/programs/xinit/Imakefile XFree86-4.0.2/xc/programs/xinit/Imakefile
---- XFree86-4.0.2.org/xc/programs/xinit/Imakefile Tue Dec 5 01:59:44 2000
-+++ XFree86-4.0.2/xc/programs/xinit/Imakefile Wed Dec 20 13:41:03 2000
-@@ -41,11 +41,13 @@
- InstallNamedProg(startx,startx,$(BINDIR))
- InstallManPage(startx,$(MANDIR))
-
--#if InstallXinitConfig
--InstallNonExecFile($(SAMPLECONFIG),$(XINITDIR))
--#else
--InstallNonExecFileNoClobber($(SAMPLECONFIG),$(XINITDIR))
--#endif
-+XCOMM Red Hat gets this from a different package
-+XCOMM #if InstallXinitConfig
-+XCOMM InstallNonExecFile($(SAMPLECONFIG),$(XINITDIR))
-+XCOMM #else
-+XCOMM InstallNonExecFileNoClobber($(SAMPLECONFIG),$(XINITDIR))
-+XCOMM #endif
-+
- #endif
-
- LinkConfDirectory(xinit,.,xinit,.)
-diff -Nur XFree86-4.0.2.org/xc/programs/xterm/Imakefile XFree86-4.0.2/xc/programs/xterm/Imakefile
---- XFree86-4.0.2.org/xc/programs/xterm/Imakefile Tue Dec 5 02:00:14 2000
-+++ XFree86-4.0.2/xc/programs/xterm/Imakefile Wed Dec 20 13:43:30 2000
-@@ -36,6 +36,10 @@
- #define XkbClientLibs /**/
- #endif
-
-+#if InstallXtermSetUID
-+#undef InstallXtermSetUID
-+#endif
-+
- #ifndef SpecialCObjectRule
- #define SpecialCObjectRule(module,ignore,defines) \
- module.o: ; $(CC) -c defines $(CFLAGS) module.c
-@@ -57,6 +61,8 @@
- PTYLIB = -lpucc
- #endif
-
-+ PTYLIB = -lutil
-+
- #if ((LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1))
- PTYLIB = -lutil
- #endif
-@@ -109,7 +115,7 @@
- -DOSMINORVERSION=$(OSMINORVERSION)
- MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */
- XKB_DEFINES = XkbClientDefines
-- DEFINES = -I. $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF)
-+ DEFINES = -I. -I/usr/include/ncurses $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF)
-
- #ifdef OS2Architecture
- MAINSRC = os2main.c
-diff -Nur XFree86-4.0.2.org/xc/programs/xterm/xterm.h XFree86-4.0.2/xc/programs/xterm/xterm.h
---- XFree86-4.0.2.org/xc/programs/xterm/xterm.h Sat Dec 9 05:02:44 2000
-+++ XFree86-4.0.2/xc/programs/xterm/xterm.h Wed Dec 20 13:41:03 2000
-@@ -62,7 +62,7 @@
- #endif
-
- #ifndef DFT_TERMTYPE
--#define DFT_TERMTYPE "xterm"
-+#define DFT_TERMTYPE "xterm-color"
- #endif
-
- #ifndef X_NOT_POSIX
+++ /dev/null
-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
-+#ifndef XserverNeedsSetUID
-+#define XserverNeedsSetUID NO
-+#endif
-+#ifndef UseXserverWrapper
-+#define UseXserverWrapper XserverNeedsSetUID
-+#endif
- #ifndef InstallServerSetUID
--#define InstallServerSetUID 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 @@
- */
-
- /*
-- * 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.
-+ * 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
-+ * If you're only starting the Xservers with xdm set this to 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 @@
- #endif
-
- /*
-- * The default is to install the X servers setuid-root on most OSs.
-- * It the servers are only started by xdm, they should not be setuid-root.
-+ * 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.
- */
- #if !defined(i386MachArchitecture) && !defined(OS2Architecture)
--# ifndef InstallXserverSetUID
--# define InstallXserverSetUID YES
-+# ifndef XserverNeedsSetUID
-+# define XserverNeedsSetUID YES
- # 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
-@@ -4,11 +4,6 @@
- */
- XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.205 2000/12/11 20:29:31 dawes Exp $
-
--#ifndef InstallXserverSetUID
--#define InstallXserverSetUID NO
--#endif
--#define InstallServerSetUID InstallXserverSetUID
--
- #include <Server.tmpl>
-
- #ifdef XFree86Version
-@@ -264,7 +259,7 @@
- EXTRASYSLIBS = ServerExtraSysLibs
- #endif
- #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
-+SetUIDProgramTarget(Xwrapper,os/wrapper.o,NullParameter,$(PAMLIBS),NullParameter)
-+InstallProgramWithFlags(Xwrapper,$(BINDIR),$(INSTUIDFLAGS))
-+#endif
-
- #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)
- {
-- FatalError("xf86OpenConsole: Server must be suid root\n");
-+ FatalError("xf86OpenConsole: Server must be running with root "
-+ "permissions\n"
-+ "You should be using Xwrapper to start the server or xdm.\n"
-+ "We strongly advise against making the server SUID root!\n");
- }
-
- /*
-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
-
-@@ -156,6 +157,14 @@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
- #else
- SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES))
-+#endif
-+
-+#if UseXserverWrapper
-+AllTarget(wrapper.o)
-+
-+ WRAPPER_DEFINES = -DXSERVER_PATH=\"/etc/X11/X\"
-+
-+SpecialCObjectRule(wrapper,NullParameter,$(WRAPPER_DEFINES))
- #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
-@@ -0,0 +1,304 @@
-+/*
-+ * X server wrapper.
-+ *
-+ * This wrapper makes some sanity checks on the command line arguments
-+ * and environment variables when run with euid == 0 && euid != uid.
-+ * If the checks fail, the wrapper exits with a message.
-+ * If they succeed, it exec's the Xserver.
-+ */
-+
-+/*
-+ * Copyright (c) 1998 by The XFree86 Project, Inc. All Rights Reserved.
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining
-+ * a copy of this software and associated documentation files (the
-+ * "Software"), to deal in the Software without restriction, including
-+ * without limitation the rights to use, copy, modify, merge, publish,
-+ * distribute, sublicense, and/or sell copies of the Software, and to
-+ * permit persons to whom the Software is furnished to do so, subject
-+ * to the following conditions:
-+ *
-+ * The above copyright notice and this permission notice shall be included
-+ * in all copies or substantial portions of the Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-+ * IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES
-+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-+ * OR OTHER DEALINGS IN THE SOFTWARE.
-+ *
-+ * Except as contained in this notice, the name of the XFree86 Project
-+ * shall not be used in advertising or otherwise to promote the sale,
-+ * use or other dealings in this Software without prior written
-+ * authorization from the XFree86 Project.
-+ */
-+
-+/* $XFree86: xc/programs/Xserver/os/wrapper.c,v 1.1.2.5 1998/02/27 15:28:59 dawes Exp $ */
-+
-+/* This is normally set in the Imakefile */
-+#ifndef XSERVER_PATH
-+#define XSERVER_PATH "/etc/X11/X"
-+#endif
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <unistd.h>
-+#include <sys/types.h>
-+#ifdef USE_PAM
-+#include <security/pam_appl.h>
-+#include <security/pam_misc.h>
-+#include <pwd.h>
-+#endif /* USE_PAM */
-+
-+/* Neither of these should be required for XFree86 3.3.2 */
-+#ifndef REJECT_CONFIG
-+#define REJECT_CONFIG 0
-+#endif
-+#ifndef REJECT_XKBDIR
-+#define REJECT_XKBDIR 0
-+#endif
-+
-+/* Consider LD* variables insecure ? */
-+#ifndef REMOVE_ENV_LD
-+#define REMOVE_ENV_LD 1
-+#endif
-+
-+/* Remove long environment variables? */
-+#ifndef REMOVE_LONG_ENV
-+#define REMOVE_LONG_ENV 1
-+#endif
-+
-+/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
-+#ifndef CHECK_EUID
-+#define CHECK_EUID 1
-+#endif
-+
-+/*
-+ * Maybe the locale can be faked to make isprint(3) report that everything
-+ * is printable? Avoid it by default.
-+ */
-+#ifndef USE_ISPRINT
-+#define USE_ISPRINT 0
-+#endif
-+
-+#define MAX_ARG_LENGTH 128
-+#define MAX_ENV_LENGTH 256
-+#define MAX_ENV_PATH_LENGTH 2048
-+
-+#if USE_ISPRINT
-+#include <ctype.h>
-+#define checkPrintable(c) isprint(c)
-+#else
-+#define checkPrintable(c) (((c) & 0x7f) >= 0x20 && ((c) & 0x7f) != 0x7f)
-+#endif
-+
-+enum BadCode {
-+ NotBad = 0,
-+ UnsafeArg,
-+ ArgTooLong,
-+ UnprintableArg,
-+ EnvTooLong,
-+ InternalError,
-+#ifdef USE_PAM
-+ PamFailed,
-+ PamAuthFailed,
-+#endif /* USE_PAM */
-+};
-+
-+#define ARGMSG \
-+ "\nIf the arguments used are valid, and have been rejected incorrectly\n" \
-+ "please send details of the arguments and why they are valid to\n" \
-+ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
-+ "the \"super user\" (root).\n"
-+
-+#define ENVMSG \
-+ "\nIf the environment is valid, and have been rejected incorrectly\n" \
-+ "please send details of the environment and why it is valid to\n" \
-+ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
-+ "the \"super user\" (root).\n"
-+
-+#ifdef USE_PAM
-+static struct pam_conv conv = {
-+ misc_conv,
-+ NULL
-+};
-+#endif /* USE_PAM */
-+
-+
-+int
-+main(int argc, char **argv, char **envp)
-+{
-+ enum BadCode bad = NotBad;
-+ int i, j;
-+ char *a, *e;
-+#ifdef USE_PAM
-+ pam_handle_t *pamh = NULL;
-+ struct passwd *pw;
-+ int retval;
-+
-+ pw = getpwuid(getuid());
-+ if (pw == NULL) {
-+ bad = InternalError;
-+ }
-+
-+ if (!bad) {
-+ retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
-+ if (retval != PAM_SUCCESS)
-+ bad = PamFailed;
-+ }
-+
-+ if (!bad) {
-+ retval = pam_authenticate(pamh, 0);
-+ if (retval != PAM_SUCCESS) {
-+ pam_end(pamh, retval);
-+ bad = PamAuthFailed;
-+ }
-+ }
-+
-+ if (!bad) {
-+ retval = pam_acct_mgmt(pamh, 0);
-+ if (retval != PAM_SUCCESS) {
-+ pam_end(pamh, retval);
-+ bad = PamAuthFailed;
-+ }
-+ }
-+
-+ /* this is not a session, so do not do session management */
-+
-+ if (!bad) pam_end(pamh, PAM_SUCCESS);
-+#endif /* USE_PAM */
-+
-+#if CHECK_EUID
-+ if (!bad && geteuid() == 0 && getuid() != geteuid()) {
-+#else
-+ if (!bad) {
-+#endif
-+ /* Check each argv[] */
-+ for (i = 1; i < argc; i++) {
-+
-+ /* Check for known bad arguments */
-+#if REJECT_CONFIG
-+ if (strcmp(argv[i], "-config") == 0) {
-+ bad = UnsafeArg;
-+ break;
-+ }
-+#endif
-+#if REJECT_XKBDIR
-+ if (strcmp(argv[i], "-xkbdir") == 0) {
-+ bad = UnsafeArg;
-+ break;
-+ }
-+#endif
-+ if (strlen(argv[i]) > MAX_ARG_LENGTH) {
-+ bad = ArgTooLong;
-+ break;
-+ }
-+ a = argv[i];
-+ while (*a) {
-+ if (checkPrintable(*a) == 0) {
-+ bad = UnprintableArg;
-+ break;
-+ }
-+ a++;
-+ }
-+ if (bad)
-+ break;
-+ }
-+ /* Check each envp[] */
-+ if (!bad)
-+ for (i = 0; envp[i]; i++) {
-+
-+ /* Check for bad environment variables and values */
-+#if REMOVE_ENV_LD
-+ while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
-+ for (j = i; envp[j]; j++) {
-+ envp[j] = envp[j+1];
-+ }
-+ }
-+#endif
-+ if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
-+#if REMOVE_LONG_ENV
-+ for (j = i; envp[j]; j++) {
-+ envp[j] = envp[j+1];
-+ }
-+ i--;
-+#else
-+ char *eq;
-+ int len;
-+
-+ eq = strchr(envp[i], '=');
-+ if (!eq)
-+ continue;
-+ len = eq - envp[i];
-+ e = malloc(len + 1);
-+ if (!e) {
-+ bad = InternalError;
-+ break;
-+ }
-+ strncpy(e, envp[i], len);
-+ e[len] = 0;
-+ if (len >= 4 &&
-+ (strcmp(e + len - 4, "PATH") == 0 ||
-+ strcmp(e, "TERMCAP") == 0)) {
-+ if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
-+ bad = EnvTooLong;
-+ break;
-+ } else {
-+ free(e);
-+ }
-+ } else {
-+ bad = EnvTooLong;
-+ break;
-+ }
-+#endif
-+ }
-+ }
-+ }
-+ switch (bad) {
-+ case NotBad:
-+ execve(XSERVER_PATH, argv, envp);
-+ fprintf(stderr, "execve failed for %s (errno %d)\n", XSERVER_PATH,
-+ errno);
-+ break;
-+ case UnsafeArg:
-+ fprintf(stderr, "Command line argument number %d is unsafe\n", i);
-+ fprintf(stderr, ARGMSG);
-+ break;
-+ case ArgTooLong:
-+ fprintf(stderr, "Command line argument number %d is too long\n", i);
-+ fprintf(stderr, ARGMSG);
-+ break;
-+ case UnprintableArg:
-+ fprintf(stderr, "Command line argument number %d contains unprintable"
-+ " characters\n", i);
-+ fprintf(stderr, ARGMSG);
-+ break;
-+ case EnvTooLong:
-+ fprintf(stderr, "Environment variable `%s' is too long\n", e);
-+ fprintf(stderr, ENVMSG);
-+ break;
-+ case InternalError:
-+ fprintf(stderr, "Internal Error\n");
-+ break;
-+#ifdef USE_PAM
-+ case PamFailed:
-+ fprintf(stderr, "Authentication System Failure, "
-+ "missing or mangled PAM configuration file or module?\n");
-+ break;
-+ case PamAuthFailed:
-+ fprintf(stderr, "PAM authentication failed\n");
-+ break;
-+#endif
-+ default:
-+ fprintf(stderr, "Unknown error\n");
-+ fprintf(stderr, ARGMSG);
-+ fprintf(stderr, ENVMSG);
-+ break;
-+ }
-+ 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 @@
- #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 @@
- if (argc == 0 ||
- #ifndef __EMX__
- (**argv != '/' && **argv != '.')) {
-- *sptr++ = default_server;
-+ if (access(default_wrapper, X_OK) == 0)
-+ *sptr++ = default_wrapper;
-+ else
-+ *sptr++ = default_server;
- #else
- (**argv != '/' && **argv != '\\' && **argv != '.' &&
- !(isalpha(**argv) && (*argv)[1]==':'))) {
+++ /dev/null
-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="$(DIR)/chooser"' \
-+ '-DDEF_AUTH_DIR="$(XDMVARDIR)"' \
-+ '-DDEF_GREETER_LIB="$(USRLIBDIR)/libXdmGreet.so"'
- #endif
-
- ComplexProgramTarget_1(xdm,$(LOCAL_LIBRARIES),NullParameter)
-@@ -247,7 +247,7 @@
- #if BuildChooser
- SpecialCObjectRule(chooser, $(ICONFIGFILES), $(SOCK_DEFINES))
- NormalProgramTarget(chooser,$(OBJS3),$(DEPLIBS3),$(LIBS3),NullParameter)
--InstallProgram(chooser,$(XDMDIR))
-+InstallProgram(chooser,$(BINDIR))
- InstallAppDefaults(Chooser)
- #endif
- #if BuildBoth
-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(xdm-config,xdm-conf.cpp,-DXDMDIR=$(XDMDIR) -DXDMLOGDIR=$(XDMLOGDIR) -DXDMPIDDIR=$(XDMPIDDIR),NullParameter)
-+#ifdef LinuxArchitecture
-+CppFileTarget(xdm-config,xdm-conf.cpp,$(XPM_DEFINES) -DLINUX=1 -DXDMDIR=$(XDMDIR) -DXDMLOGDIR=$(XDMLOGDIR) -DXDMPIDDIR=$(XDMPIDDIR) -DXDMVARDIR=$(XDMVARDIR),NullParameter)
-+#else
-+CppFileTarget(xdm-config,xdm-conf.cpp,$(XPM_DEFINES) -DXDMDIR=$(XDMDIR) -DXDMLOGDIR=$(XDMLOGDIR) -DXDMPIDDIR=$(XDMPIDDIR),NullParameter)
-+#endif /* LinuxArchitecture */
- CppFileTarget(Xresources,Xres.cpp,$(XPM_DEFINES),NullParameter)
-
- LinkFile(Xservers,Xservers.$(SERVERSTYPE))
-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
--#ifndef XPM
--xlogin*greetColor: CadetBlue
--#else
-+#ifdef XPM
- xlogin*borderWidth: 1
- xlogin*frameWidth: 5
- xlogin*innerFramesWidth: 2
-@@ -47,6 +45,8 @@
- xlogin*background: grey
- !xlogin*foreground: darkgreen
- xlogin*greetColor: Blue3
-+#else
-+login*greetColor: CadetBlue
- #endif /* XPM */
- xlogin*failColor: red
- *Foreground: black
-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)
--
- SRCS = greet.c verify.c Login.c
- OBJS = greet.o verify.o Login.o
-
+++ /dev/null
-diff -Nur XFree86-4.0.2.org/xc/programs/xdm/greeter/verify.c XFree86-4.0.2/xc/programs/xdm/greeter/verify.c
---- XFree86-4.0.2.org/xc/programs/xdm/greeter/verify.c Wed Nov 29 17:46:09 2000
-+++ XFree86-4.0.2/xc/programs/xdm/greeter/verify.c Thu Dec 21 12:02:33 2000
-@@ -114,6 +114,7 @@
-
- #ifdef USE_PAM
- static char *PAM_password;
-+extern pam_handle_t *pamh;
- static int pam_error;
-
- static int PAM_conv (int num_msg,
-@@ -162,12 +163,8 @@
- Verify (struct display *d, struct greet_info *greet, struct verify_info *verify)
- {
- struct passwd *p;
--#ifdef USE_PAM
-- pam_handle_t **pamhp = thepamhp();
--#else
- #ifdef USESHADOW
- struct spwd *sp;
--#endif
- #endif
- #ifdef __OpenBSD__
- char *s;
-diff -Nur XFree86-4.0.2.org/xc/programs/xdm/session.c XFree86-4.0.2/xc/programs/xdm/session.c
---- XFree86-4.0.2.org/xc/programs/xdm/session.c Tue Dec 5 01:59:35 2000
-+++ XFree86-4.0.2/xc/programs/xdm/session.c Thu Dec 21 12:06:41 2000
-@@ -97,9 +97,9 @@
- extern char *crypt(CRYPT_ARGS);
- #endif
- #ifdef USE_PAM
-+pam_handle_t *pamh;
- pam_handle_t **thepamhp()
- {
-- static pam_handle_t *pamh = NULL;
- return &pamh;
- }
-
-@@ -472,9 +472,6 @@
- SessionExit (struct display *d, int status, int removeAuth)
- {
- #ifdef USE_PAM
-- pam_handle_t *pamh = thepamh();
--#endif
--#ifdef USE_PAM
- if (pamh) {
- /* shutdown PAM session */
- pam_close_session(pamh, 0);
-@@ -535,9 +532,6 @@
- int pid;
- #ifdef HAS_SETUSERCONTEXT
- struct passwd* pwd;
--#endif
--#ifdef USE_PAM
-- pam_handle_t *pamh = thepamh();
- #endif
-
- if (verify->argv) {
+++ /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];
+++ /dev/null
---- 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
-@@ -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
-
---- 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 @@
- .SH "BSD AND LINUX SYSTEMS"
- .PP
- In newer BSD and Linux systems, \fIXman\fP will search for a file named
--\fI/etc/man.conf\fP which will contain the list of directories containing
--manual pages. See \fIman.conf\fP(5) for a complete description of the file
-+\fI/etc/man.config\fP which will contain the list of directories containing
-+manual pages. See \fIman.config\fP(5) for a complete description of the file
- format.
- .SH "THE MANDESC FILE"
- .PP