http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=24165

Gary L. Hennigan <glhenni@cs.sandia.gov>

According to the rdist.1 man page, quoting...

    noexec Automatically exclude executable files  that
           are in a.out(5) format from being checked or
           updated.

However, on many systems I noticed that it also excludes ELF
executables, except under Linux. This can be tracked to the file
rdist-6.1.3/config/os-linux.h which defines EXE_TYPE as EXE_AOUT for
Linux. Other os-*.h files allow EXE_TYPE to be EXE_ELF or even a
combination like EXE_ELF_AND_COFF. Unfortunately there isn't a case
like EXE_ELF_AND_AOUT for a sytem like Linux.

My suggestion is to patch rdist-6.1.3 to include a EXE_TYPE of
EXE_ELF_AND_AOUT for Linux so that both executable types are skipped
when the "noexec" option is used.

Attached is a diff of the rdist-6.1.3/config/os-linux.h and
rdist-6.1.3/src/isexec.c which will accomplish the task. This patch is
against the ORIGINAL source, as distributed by debian, so it includes
changes made by other, I suppose, Debian developers.

If I can be of further assitance please don't hesitate to contact me
via email.

Gary Hennigan
glhenni@cs.sandia.gov, gary@ieee.org

Index: rdist-6.1.5/config/os-linux.h
===================================================================
--- rdist-6.1.5.orig/config/os-linux.h
+++ rdist-6.1.5/config/os-linux.h
@@ -58,7 +58,7 @@
 /*
  * Select the type of executable file format.
  */
-#define EXE_TYPE	EXE_AOUT
+#define EXE_TYPE	EXE_ELF_AND_AOUT
 
 /*
  * Select the type of statfs() system call (if any).
@@ -68,7 +68,7 @@
 /*
  * Type of arg functions we have.
  */
-#define ARG_TYPE	ARG_VARARGS
+#define ARG_TYPE	ARG_STDARG
 
 /*
  * Do we have select()?
@@ -131,3 +131,5 @@ typedef void POINTER;
  */
 #define NEED_UNISTD_H
 #define NEED_UTIME_H
+#define NEED_STRING_H
+#define NEED_MNTENT_H
Index: rdist-6.1.5/src/isexec.c
===================================================================
--- rdist-6.1.5.orig/src/isexec.c
+++ rdist-6.1.5/src/isexec.c
@@ -52,24 +52,48 @@ static char copyright[] =
 
 #include "defs.h"
 
-#if	EXE_TYPE == EXE_AOUT
+#if	EXE_TYPE == EXE_AOUT || EXE_TYPE == EXE_ELF_AND_AOUT
 /*
  * BSD style A.OUT
  */
 #include <a.out.h>
 
+#if EXE_TYPE == EXE_ELF_AND_OUT
+#include <elf.h>
+
+#define ISELF(h)	(h.e_type == ET_EXEC)
+
+typedef union {
+	struct exec	aouthdr;
+	Elf32_Ehdr	elfhdr;
+} hdr_t;
+#endif /* EXE_ELF_AND_AOUT */
+
+#if EXE_TYPE == EXE_AOUT
+typedef struct exec	hdr_t;
+#endif /* EXE_AOUT */
+
+#define ISAOUT(h)      (!N_BADMAG(h))
+
 static int _isexec(fd)
 	int fd;
 {
-	struct exec ehdr;
+	hdr_t hdr;
 
-	if ((read(fd, &ehdr, sizeof(ehdr)) == sizeof(ehdr)) && 
-	    !N_BADMAG(ehdr))
-		return(TRUE);
-	else
-		return(FALSE);
-}
+	if (read(fd, &hdr, sizeof(hdr)) == sizeof(hdr)) {
+#if EXE_TYPE == EXE_ELF_AND_AOUT
+		if (ISELF(hdr.elfhdr) || ISAOUT(hdr.aouthdr))
+			return(TRUE);
+#endif /* EXE_ELF_AND_AOUT */
+#if EXE_TYPE == EXE_AOUT
+		if (ISAOUT(hdr))
+			return(TRUE);
 #endif /* EXE_AOUT */
+	}
+
+	return(FALSE);
+}
+#endif /* EXE_AOUT || EXE_ELF_AND_AOUT */
 
 
 #if	EXE_TYPE == EXE_ELF_AND_COFF || EXE_TYPE == EXE_ELF
