[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

problems compiling xdm on xf-4_3-branch, and Debian's patches to fix them



Hi Matthieu,

I experienced build problems in xc/lib/X11 and xc/programs/xdm after
resyncing with your recent xdm updates to xf-4_3-branch.

Here are the problems I found:
* Using LinkSourceFile() with header files appears to not work as
  intended.  It will write targets to the Makefile to create a symlink
  as it is instructed, but if one is using LinkSourceFile() with both a
  .c and .h file, for instance, nothing creates a dependency of the .c
  file on the .h file, so the .h target is never invoked.  This causes
  the LinkSourceFile()d .c to fail to compile because it cannot locate
  its header.

  I found this problem in both xc/lib/X11 and xc/programs/xdm.

  I kind of kludged around the problem and I'm not sure my fix is ideal
  from an Imake usage standpoint, but I'm pretty sure it's correct from
  a compilation standpoint.  Someone who has a better command of Imake
  should probably review this part of my patch.  I looked in
  xc/config/cf/Imake.rules but could not find an Imake rule that just
  adds dependencies to targets and nothing more.

* xc/programs/xdm/genauth.c only declares the static "key" array if
  none of ARC4_RANDOM, DEV_RANDOM, and HASXDMAUTH are defined, but this
  variable is used if HASXDMAUTH is defined.  See genauth.c:355, :365,
  :380, :394, and :429.

* At xc/programs/xdm/genauth.c:377, prngdPort is compared to NULL, but
  since it is an integer, it should be compared to 0 instead.

* At xc/programs/xdm/genauth.c:378, an undefined variable ("len") is
  used.  It is clear from context that the constant 8 should be passed
  to get_prngd_bytes() instead; this looks like a cut-n-paste error from
  GenerateAuthData().

* At xc/programs/xdm/genauth.c:402, an undefined variable ("i") is used
  as a loop index.  Since it is compared to an integer my fix was to
  declare as one.

Debian's patches to rectify the above problems are attached.  Please let
me know if they are deficient, misguided, or anything else bad.  :)

Thanks for backporting the pam_setcred() security fix to xf-4_3_branch!

-- 
G. Branden Robinson                |      We either learn from history or,
Debian GNU/Linux                   |      uh, well, something bad will
branden@debian.org                 |      happen.
http://people.debian.org/~branden/ |      -- Bob Church
$Id: 067_fix_X11_and_xdm_build_problems.diff 575 2003-09-22 22:27:27Z branden $

This patch by Branden Robinson.  Prompted by recent mysterious breakage
with XDM auth support.  LinkSourceFile(Wrap.h,$(XDMCPLIBSRC)) was writing
targets to the Makefile to create the symlink from the Xdmcp directory but
neither Wrap.o nor Wraphelp.o were depending on Wrap.h, so the Wrap.h
target never got invoked.

xc/programs/xdm/Imakefile has exactly the same problem with exactly the
same file, plus the same problem with the greeter's header files.

xc/programs/xdm/genauth.c had some problems with attempting to use
variables that weren't defined, plus an attempt to compare the integer
prngdPort with NULL.

--- xc/lib/X11/Imakefile~	2003-09-18 01:12:10.000000000 -0500
+++ xc/lib/X11/Imakefile	2003-09-18 01:13:32.000000000 -0500
@@ -49,7 +49,7 @@
      MALLOC_DEFINES = XMalloc0ReturnsNullDefines
 #endif
 #if HasXdmAuth
-        XDMAUTHDEFS = -DHASXDMAUTH
+        XDMAUTHDEFS = -I$(XDMCPLIBSRC) -DHASXDMAUTH
         XDMAUTHOBJS = Wrap.o Wraphelp.o
         XDMAUTHSRCS = Wrap.c Wraphelp.c
 #endif
@@ -997,6 +997,7 @@
 LinkFile(ximtrans.c,$(TRANSCOMMSRC)/transport.c)
 SpecialCLibObjectRule(OpenDis,$(ICONFIGFILES),$(BC_DEFINES) $(OPEN_DEFINES) $(XTRANS_X_DEFINES) $(XKB_DEFINES))
 SpecialCLibObjectRule(Wrap,$(ICONFIGFILES),$(XDMAUTHDEFS))
+SpecialCLibObjectRule(Wraphelp,$(ICONFIGFILES),$(XDMAUTHDEFS))
 SpecialCLibObjectRule(XlibInt,$(ICONFIGFILES),$(CONN_DEFINES) $(POLL_DEFINES) $(XTRANS_X_DEFINES))
 SpecialCLibObjectRule(Font,$(ICONFIGFILES),$(SHM_DEFINES) $(XF86BIGFONT_DEFINES))
 SpecialCLibObjectRule(FontInfo,$(ICONFIGFILES),$(SHM_DEFINES) $(XF86BIGFONT_DEFINES))
@@ -1044,7 +1045,6 @@
 LinkSourceFile(k5encode.c,$(XAUTHSRC))
 #endif
 #if HasXdmAuth
-LinkSourceFile(Wrap.h,$(XDMCPLIBSRC))
 LinkSourceFile(Wrap.c,$(XDMCPLIBSRC))
 LinkSourceFile(Wraphelp.c,$(XDMCPLIBSRC))
 #endif
--- xc/programs/xdm~/Imakefile	2003-09-22 16:23:20.000000000 -0500
+++ xc/programs/xdm/Imakefile	2003-09-22 17:15:01.000000000 -0500
@@ -25,7 +25,7 @@
 #endif
 
 #if HasXdmAuth
-XDMAUTH_DEFINES = -DHASXDMAUTH
+XDMAUTH_DEFINES = -I$(XDMCPLIBSRC) -DHASXDMAUTH
 XDMAUTHOBJS = xdmauth.o
 XDMAUTHSRCS = xdmauth.c
 #endif
@@ -323,6 +323,7 @@
 LinkSourceFile(Login.c,greeter)
 LinkSourceFile(Login.h,greeter)
 LinkSourceFile(LoginP.h,greeter)
+SpecialCObjectRule(greet,Login.h LoginP.h,-I.)
 #if BuildBoth
 ObjectFromSpecialSource(greetsh,greet,-DUSESHADOW)
 ObjectFromSpecialSource(verifysh,verify,-DUSESHADOW)
--- xc/programs/xdm~/genauth.c	2003-09-22 14:00:07.000000000 -0500
+++ xc/programs/xdm/genauth.c	2003-09-22 16:57:56.000000000 -0500
@@ -47,9 +47,7 @@
 #include <time.h>
 #define Time_t time_t
 
-#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) && !defined(HASXDMAUTH)
 static unsigned char	key[8];
-#endif
 
 #ifdef DEV_RANDOM
 extern char	*randomDevice;
@@ -370,8 +368,8 @@
     }
 #endif    
     /*  Try some pseudo-random number genrator daemon next */
-    if (prngdSocket != NULL || prngdPort != NULL) {
-	    if (get_prngd_bytes(tmpkey, len, prngdPort, prngdSocket) == 0) {
+    if (prngdSocket != NULL || prngdPort != 0) {
+	    if (get_prngd_bytes(tmpkey, 8, prngdPort, prngdSocket) == 0) {
 		    tmpkey[0] = 0;
 		    _XdmcpWrapperToOddParity(tmpkey, key);
 		    return;
@@ -398,7 +396,7 @@
 GenerateAuthData (char *auth, int len)
 {
 #ifdef HASXDMAUTH
-    int		    bit;
+    int		    i, bit;
     auth_wrapper_schedule    schedule;
     unsigned char	    data[8];
     static int	    xdmcpAuthInited;

Attachment: signature.asc
Description: Digital signature


Reply to: