Path: uunet!xstor!iverson
From: iverson@xstor.com (Tim Iverson)
Newsgroups: alt.sources
Subject: Patches for NNTP 1.5.11 under SCO Unix
Message-ID: <1991Jun26.000807.7560@xstor.com>
Date: 26 Jun 91 00:08:07 GMT
Reply-To: iverson@xstor.com
Followup-To: alt.sources.d
Organization: Storage Dimensions, Inc.
Lines: 367


This patch file requires patch-2.0.2.0 patchlevel 12u4.  You might have some
success with unipatch or earlier 12u* versions of patch, but you're on your
own there.  It makes the standard nntp-1.5.11 distribution compile and run
under SCO Unix 3.2.2 with TCP/IP 1.1.1b.

What it does:	modify setup (conf.h) and makefiles as used for xstor.com
		modify server/main.c to do a setluid (ugly c2-ism)
		minor mods to several other files (use statfs, etc.)

To apply:	cd nntp-1.5.11
		cp common/conf.h.dist common/conf.h
		patch -p < this_file
		edit conf.h (at least change "xstor.com" to something else)

To compile:	You must have libcnews.a (created when you built cnews) in
		one of the places searched by ld; e.g. /lib or perhaps
		/usr/local/lib/gcc.

N.B.	This patch has only been tested with gcc-1.39-SCO.3 (i.e. 1.39 with
	all of my SCO patches applied).  It will probably work equally well
	with the standard dev-sys.

- Tim Iverson
  iverson@xstor.com -/- uunet!xstor!iverson

#
################ patch starts here
##
Prereq: "1.5.11a (1 April 1991)";
Index: common/version.c
@@ -3,3 +3,3 @@
= */
=
-char	nntp_version[] = "1.5.11a (1 April 1991)";
+char	nntp_version[] = "1.5.11a (1 April 1991) SCO.0";
Index: Makefile
@@ -7,5 +7,5 @@
=CFLAGS= -O 
=# set LIBS to be -lneededlibrary if needed
-LIBS=-ldbm
+LIBS=-lcnews -lsocket -lx -lprot
=
=DISTFILES = Makefile README CHANGES
Index: common/conf.h
@@ -22,5 +22,5 @@
= * at some sites, so it is an option. Please report problems to "nntp@tmc.edu"
= */
-#undef DYNAMIC_ART_ARRAY
+#define DYNAMIC_ART_ARRAY
=
=#undef	BSD_42		/* 4.2 compatability code -- if this is defined, */
@@ -27,9 +27,9 @@
=			/* DBM probably wants to be defined as well. */
=
-#define BSD_43		/* Define if you are running on BSD 4.3 */
+#undef	BSD_43		/* Define if you are running on BSD 4.3 */
=
=#undef CMU_MACH		/* Use CMU's MACH ioctl(FIOCFSPARAM) for dfree(). */
=
-#undef	USG		/* System V support */
+#define	USG		/* System V support */
=
=#undef TLI		/* Define this if you want to use TLI instead of */
@@ -36,5 +36,5 @@
=			/* sockets */
=
-#define NDBM		/* Use new-style (4.3) ndbm(3x) libraries */
+#undef	NDBM		/* Use new-style (4.3) ndbm(3x) libraries */
=
=#undef	DBM		/* True if we want to use the old dbm(3x) libraries */
@@ -42,5 +42,5 @@
=			/* be -ldbm */
=
-#undef	DBZ		/* True if we want to use dbz libraries */
+#define	DBZ		/* True if we want to use dbz libraries */
=			/* IF YOU DEFINE THIS, change CFLAGS in makefile to */
=			/* be /usr/lib/dbz.o and install dbz.h */
@@ -49,6 +49,6 @@
=			/* IF YOU DO NOT DEFINE NDBM or DBM, this is DEFAULT!*/
=
-#undef CNEWS		/* define this if you are running C-NEWS */
-#undef BATCHED_INPUT	/* define if you want to support C-NEWS style 
+#define	CNEWS		/* define this if you are running C-NEWS */
+#undef	BATCHED_INPUT	/* define if you want to support C-NEWS style 
=				batched input (not supported by B-NEWS,yet)  */
=
@@ -63,6 +63,6 @@
=#define SIGRET void	/* Newfangled signal() returns void, old returns int */
=
-#define	GHNAME		/* Define if you have gethostname() */
-#undef	UUNAME		/* Define to use /etc/uucpname */
+#undef	GHNAME		/* Define if you have gethostname() */
+#define	UUNAME		/* Define to use /etc/uucpname */
=			/* If neither of these are defined, */
=			/* inews will use the contents of */
@@ -76,10 +76,10 @@
= */
=
-/* #define	vfork fork */
+#define	vfork fork
=
=/* Controlling disk and inode consumption */
-#define MINFREE 4000	/* NNTP will not allow an XFER if there is less */
+#define MINFREE 500	/* NNTP will not allow an XFER if there is less */
=			/* than this much diskspace (in blocks or kbytes) */
-#define POSTBUFFER 1000 /* NNTP will allow local posting until */
+#define POSTBUFFER 100	/* NNTP will allow local posting until */
=			/* MINFREE-POSTBUFFER blocks or kbytes are left */
=#undef MINFILES  MINFREE/4
@@ -112,5 +112,5 @@
= */
=
-/* #define UMASK 022 */
+#define UMASK 022
=
=/*
@@ -134,6 +134,6 @@
= */
=
-#undef	FAKESYSLOG	"/usr/lib/news/nntplog"
-#undef	FAKEAPPEND
+#define	FAKESYSLOG	"/usr/lib/news/nntplog"
+#define	FAKEAPPEND
=
=#define	SYSLOG	LOG_NEWS
@@ -140,5 +140,5 @@
=
=#ifdef SYSLOG		/* Define LOG if you want copious logging info */
-#undef	 LOG		/* undef it if you don't */
+# undef	LOG		/* undef it if you don't */
=#endif			/* but you can only have LOG if you have SYSLOG */
=
@@ -182,6 +182,6 @@
= */
=
-#define	DOMAIN	"uucp"
-#undef HIDDENNET
+#define	DOMAIN	"xstor.com"
+#define	HIDDENNET
=
=/*
@@ -201,5 +201,5 @@
=/* Things that relate to authentication and access */
=/* Define AUTH to use the proposed NNTP Version 2 authentication protocol. */
-#define	AUTH	
+#undef	AUTH	
=/*
= * A file containing the name of the host which is running
@@ -208,5 +208,5 @@
= */
=
-#define	SERVER_FILE	"/usr/local/lib/rn/server"
+#define	SERVER_FILE	"/usr/local/lib/trn/server"
=
=/*
@@ -214,5 +214,5 @@
= */
=
-#define	POSTER		"usenet"
+#define POSTER		"news"
=
=/*
@@ -340,13 +340,13 @@
=
=#ifdef USG
-# define	FCNTL			/* If O_etc is defined in <fcntl.h> */
-#ifdef dgux
-#define		FTRUNCATE
-#else
-# define	NDIR			/* If you  need ndir library support */
-#ifdef hpux
-#define		DIRSIZ_MACRO
-#endif
-#endif
+# define	FCNTL		/* If O_etc is defined in <fcntl.h> */
+# ifdef dgux
+#  define	FTRUNCATE
+# else
+#  define	NDIR		/* If you  need ndir library support */
+#  ifdef hpux
+#   define	DIRSIZ_MACRO
+#  endif
+# endif
=# define	index	strchr
=# define	rindex	strrchr
@@ -365,4 +365,2 @@
=#define	MAX_ARTICLES	4096		/* Maximum number of articles/group */
=#define READINTVL	60 * 10		/* 10 minutes b/n chking active file */
-
-
Index: doc/Makefile
@@ -29,7 +29,7 @@
=
=install: $(MANPAGES)
-	mv nntpd.8c $(MANDIR)/man8/nntpd.8c
-	mv mkgrdates.8c $(MANDIR)/man8/mkgrdates.8c
-	mv nntpxmit.1 $(MANDIR)/man1/nntpxmit.1
+	mv nntpd.8c $(MANDIR)/man.N/nntpd.N
+	mv mkgrdates.8c $(MANDIR)/man.N/mkgrdates.N
+	mv nntpxmit.1 $(MANDIR)/man.N/nntpxmit.N
=
=print: $(MANPAGES)
Index: inews/Makefile
@@ -14,5 +14,5 @@
=
=inews:  $(OBJS) $(HFILES)
-	$(CC) $(CFLAGS) $(OBJS) -o inews $(LIBS)
+	$(CC) -s $(CFLAGS) $(OBJS) -o inews $(LIBS)
=
=uname.o: uname.c ../common/conf.h
Index: inews/uname.c
@@ -57,4 +57,6 @@
=	FILE *uucpf;
=	register char *p;
+	extern	char *index();
+
=	/* uucp name is stored in /etc/uucpname or /local/uucpname */
=
Index: server/Makefile
@@ -31,5 +31,5 @@
=
=nntpd: ${SRVROBJ} ${SRVRINC} ${THREADS}
-	${CC} ${CFLAGS} -o nntpd ${SRVROBJ} ${THREADS} ${LIBS}
+	${CC} -s ${CFLAGS} -o nntpd ${SRVROBJ} ${THREADS} ${LIBS}
=
=${SRVROBJ}: ${SRVRINC}
Index: server/main.c
@@ -36,5 +36,33 @@
=char **argv, **envp;
={
+#ifdef	M_UNIX
+	extern int	errno;
+	extern char	*sys_errlist[];
+	register int	luid, lgid;
=
+# ifdef	POSTER	/* try to get the desired luid */
+	{
+		struct passwd *p = getpwnam(POSTER);
+
+		if (p)
+			luid = p->pw_uid, lgid = p->pw_gid;
+		else
+			luid = lgid = 0;
+
+		if (setluid(luid))
+			setluid(luid = lgid = 0);
+	}
+# else
+	setluid(luid = lgid = 0);
+# endif
+
+	if (setgid(lgid) || setuid(luid))
+	{
+		printf("LUID not set! syserr[%d]=%s\n",
+			errno, sys_errlist[errno]);
+		exit(1);
+	}
+#endif
+
=#ifdef ALONE	/* If no inetd */
=
Index: server/misc.c
@@ -615,5 +615,5 @@
=}
=#endif USGHIST
-#ifdef USG
+#if defined(USG) && !defined(M_UNIX)
=#ifndef GAZETTE
=bcopy(s, d, l)
@@ -724,5 +724,5 @@
=#endif 
=
-#if defined(apollo)
+#if defined(apollo) || defined(M_UNIX)
=#include <sys/types.h>
=#include <sys/statfs.h>
@@ -753,5 +753,5 @@
=#endif 
=
-#if defined(USG) && !defined(hpux)
+#if defined(USG) && !defined(hpux) && !defined(M_UNIX)
=#include <ustat.h>
=typedef struct ustat statfs_type;
Index: server/spawn.c
@@ -62,5 +62,5 @@
=#endif
=#ifdef XFER_TIMEOUT
-	int		xfer_timeout();
+	SIGRET		xfer_timeout();
=#endif
=#ifdef USG
@@ -260,5 +260,5 @@
=				if (errbuf) {
=					if (cp = index(line, '\n'))
-						*cp = '\0';
+						*cp = '\\';
=					(void) strcat(errbuf, line);
=				}
@@ -317,4 +317,5 @@
=#ifdef XFER_TIMEOUT
=
+SIGRET
=xfer_timeout()
={
Index: server/timer.c
@@ -70,5 +70,5 @@
=	register struct timer *tp;
=	register long secs;
-#ifdef USG
+#if defined(USG) && !defined(FD_SET)
=	long timeout;
=	long readfds;
@@ -84,5 +84,5 @@
=
=	/* Length of next timeout is minimum of all "timers" */
-#ifdef USG
+#if defined(USG) && !defined(FD_SET)
=	timeout = -1;
=	for (i = ntimer, tp = timers; i > 0; --i, ++tp)
Index: support/Makefile
@@ -18,5 +18,5 @@
=
=mkgrdates: mkgrdates.o
-	$(CC) ${CFLAGS} -o mkgrdates mkgrdates.o
+	$(CC) -s ${CFLAGS} -o mkgrdates mkgrdates.o
=
=install: mkgrdates
Index: xfer/Makefile
@@ -11,5 +11,5 @@
=
=nntpxfer: ${SRVROBJ}
-	${CC} ${LDFLAGS} ${SRVROBJ} -o nntpxfer ${LIBS}
+	${CC} -s ${LDFLAGS} ${SRVROBJ} -o nntpxfer ${LIBS}
=
=get_tcp_conn.o: ../xmit/get_tcp_conn.c ../xmit/get_tcp_conn.h
Index: xmit/Makefile
@@ -23,8 +23,8 @@
=
=nntpxmit: ${SRVROBJ} ${SRVRINC}
-	${CC} ${CFLAGS} -o nntpxmit ${SRVROBJ} ${LIBS}
+	${CC} -s ${CFLAGS} -o nntpxmit ${SRVROBJ} ${LIBS}
=
=shlock: shlock.c
-	cc ${CFLAGS} -DNNTPSRC -o shlock shlock.c
+	$(CC) -s ${CFLAGS} -DNNTPSRC -o shlock shlock.c
=
=${SRVROBJ}: ${SRVRINC}
Index: xmit/get_tcp_conn.c
@@ -143,5 +143,5 @@
=#endif	NONETDB
=
-#ifdef	USG
+#if defined(USG) && !defined(M_UNIX)
=void
=bcopy(s, d, l)
Index: xmit/nntpxmit.c
@@ -156,5 +156,5 @@
=extern	char	*strcat();
=
-#ifdef	USG
+#if defined(USG) && !defined(M_UNIX)
=void
=bzero(s, l)
##
################ patch ends here
#
