From @uunet.uu.net:sob%bcm.tmc.edu@tmc.edu Fri Apr 29 20:17:10 1988
Received: from BBN.COM (bbn.com.ARPA) by pineapple.bbn.com id AA29351; Fri, 29 Apr 88 20:17:02 edt
Received: from uunet.uu.net by BBN.COM id aa20003; 29 Apr 88 20:11 EDT
Received: from TMC.EDU by uunet.UU.NET (5.54/1.14) 
	id AA00944; Fri, 29 Apr 88 20:09:51 EDT
Received: by TMC.EDU (AA17440); Fri, 29 Apr 88 19:09:39 CDT
Path: bcm!bcm.tmc.edu!sob
From: Stan Barber <sob%bcm.tmc.edu@tmc.edu>
Newsgroups: news.software.nntp
Subject: OFFICIAL PATCH #1 to nntp 1.5
Summary: System V & Excelan Fixes
Keywords: nntp official patch
Message-Id: <1074@gazette.bcm.tmc.edu>
Date: 29 Apr 88 08:13:43 GMT
Sender: usenet%bcm.tmc.edu@tmc.edu
Reply-To: Stan Barber <sob%bcm.tmc.edu@tmc.edu>
Organization: Baylor College of Medicine, Houston, TX
Lines: 350
Apparently-To: source-patches@uunet.uu.net
Status: R

Index: nntp.1.5/server

Description: 
	[ Bugs 1 and 2 were reported by apt@oak.uh.edu. Thanks, Allan!]
	1. If you are using nntp 1.5 on System V (with or without Excelan), you
	will notice the creatiion of zombie processes. This is due
	to the need for the correct handling of SIGCLD.
	2. FASTFORK does not work on System V. System V compilers do not
	do the same type of initialization of data spaces that BSD compilers
	do.
	3. Many System V systems do not have conditionalized include files.
	Including them more than once can cause havok.
	4. Many System V systems do not have u_char defined in <sys/types.h>.
	strcasecmp.c needs this defined.
	5. Some systems (like MASSCOMP) may want to use the USG history
	file format instead of the dbm format. Some of the conditionals
	include more code that needed to allow nntp to use the USG history
	file format on machines that look alot like BSD systems.

Repeat by:
	Bugs 3 and 4 can be seen on many System V system by trying to install
	the original distribution. Lots of compiler complaints.
	Bug 1 is seen following the starting of nntpd at boot and then watching
	ps for awhile. The zombie nntpd's start appearing.
	Bug 2 is observed on System V shortly after starting nntpd. It
	dumps core.
	Bug 5 is seen on a MASSCOMP (namely the machine named "masscomp")
	which uses the USG history file format. nntpd needs to be built
	in the bsd universe under RTU 4.0 (the latest release of MASSCOMP
	UNIX).
Fix:

	cd to nntp.1.5/server and pipe this through patch.

*** main.c	Sat Feb  6 17:45:07 1988
--- ../../nntp_gazette/server/main.c	Fri Apr 29 02:48:49 1988
***************
*** 1,6 ****
- #ifdef EXCELAN
- struct sockaddr_in current_peer = { AF_INET, IPPORT_NNTP };
- #endif
  #ifndef lint
  static char	*sccsid = "@(#)main.c	1.10	(Berkeley) 2/6/88";
  #endif
--- 1,3 ----
***************
*** 18,23 ****
--- 15,22 ----
  #include <netinet/in.h>
  #ifndef EXCELAN
  #include <netdb.h>
+ #else
+ struct sockaddr_in current_peer = { AF_INET, IPPORT_NNTP };
  #endif
  #include <signal.h>
  
***************
*** 50,62 ****
  
  #ifndef EXCELAN
  	sockt = get_socket();		/* should be fd 4 or 5 */
! #endif
! 
! #ifndef USG
  	(void) signal(SIGCHLD, reaper);
  #endif
  
- #ifndef EXCELAN
  	if (listen(sockt, SOMAXCONN) < 0) {
  #ifdef SYSLOG
  		syslog(LOG_ERR, "main: listen: %m");
--- 49,60 ----
  
  #ifndef EXCELAN
  	sockt = get_socket();		/* should be fd 4 or 5 */
! #ifdef USG
! 	(void) signal(SIGCLD, SIG_IGN);
! #else
  	(void) signal(SIGCHLD, reaper);
  #endif
  
  	if (listen(sockt, SOMAXCONN) < 0) {
  #ifdef SYSLOG
  		syslog(LOG_ERR, "main: listen: %m");
***************
*** 64,76 ****
  		exit(1);
  	}
  #endif
- 
  	for (;;) {
  #ifdef EXCELAN
  		int status;
  		sockt = get_socket();
  		if (sockt < 0)
  			continue;
  		client = accept(sockt, &from);
  #else
  		length = sizeof (from);
--- 62,78 ----
  		exit(1);
  	}
  #endif
  	for (;;) {
  #ifdef EXCELAN
  		int status;
+ 		sockt = 3;
  		sockt = get_socket();
  		if (sockt < 0)
  			continue;
+ #ifdef USG
+ 		(void) signal(SIGCLD, SIG_IGN);
+ #endif
+ 		bzero((char *)&from,sizeof(from));
  		client = accept(sockt, &from);
  #else
  		length = sizeof (from);
***************
*** 78,84 ****
--- 80,90 ----
  #endif EXCELAN
  		if (client < 0) {
  #ifdef SYSLOG
+ #ifdef EXCELAN
+ 			if (errno != EINTR && errno != 60 )
+ #else
  			if (errno != EINTR)
+ #endif
  				syslog(LOG_ERR, "accept: %m\n");
  #endif
  #ifdef EXCELAN
***************
*** 109,114 ****
--- 115,123 ----
  				(void) close(sockt);
  				make_stdio(client);
  #endif
+ #ifdef USG
+ 				(void) signal(SIGCLD,SIG_DFL);
+ #endif
  				serve();
  				break;
  
***************
*** 115,121 ****
  		default:
  #ifdef EXCELAN
  				(void) close(sockt);
- 				(void) wait(&status);
  #else
  				(void) close(client);
  #endif
--- 124,129 ----
*** active.c	Tue Jan 12 01:53:08 1988
--- ../../nntp_gazette/server/active.c	Sat Apr 23 15:01:45 1988
***************
*** 32,38 ****
  {
  	register int	i;
  	register int	act_fd;
! 	register char	*actbuf, *cp, *end;
  	char		*malloc();
  	struct stat	statbuf;
  
--- 32,38 ----
  {
  	register int	i;
  	register int	act_fd;
! 	register char	*cp, *end;
  	char		*malloc();
  	struct stat	statbuf;
  
***************
*** 42,48 ****
  	 */
  
  	if (num_groups != 0) {
! 		(void) free(group_array[0]);	/* Assume [0] -> actbuf */
  		(void) free(group_array);
  	}
  
--- 42,48 ----
  	 */
  
  	if (num_groups != 0) {
! 		(void) free(actbuf);
  		(void) free(group_array);
  	}
  

*** common.h	Wed Feb 10 10:37:41 1988
--- ../../nntp_gazette/server/common.h	Sat Apr 23 16:18:32 1988
***************
*** 114,119 ****
--- 114,120 ----
  extern	char	rnews[];
  
  extern	char	**group_array;
+ extern	char	*actbuf;
  extern	int	num_groups;
  extern	char	*homedir;
  extern	int	ingroup;
*** globals.c	Sat Jul 18 01:38:30 1987
--- ../../nntp_gazette/server/globals.c	Sat Apr 23 15:00:23 1988
***************
*** 25,30 ****
--- 25,31 ----
   */
  
  char	**group_array;
+ char 	*actbuf;
  int	num_groups;
  int	ingroup = 0;
  int	art_ptr;
*** strcasecmp.c	Sun Feb  7 01:38:45 1988
--- ../../nntp_gazette/server/strcasecmp.c	Tue Mar  8 10:07:21 1988
***************
*** 15,20 ****
--- 15,23 ----
  #endif /* LIBC_SCCS and not lint */
  
  #include <sys/types.h>
+ #ifndef u_char
+ #define u_char  unsigned char;
+ #endif
  
  /*
   * This array is designed for mapping upper and lower case letter
*** access_dnet.c	Sun Jan 24 00:52:44 1988
--- ../../nntp_gazette/server/access_dnet.c	Tue Mar  8 09:57:07 1988
***************
*** 1,9 ****
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/types.h>
- 
  #include "common.h"
! 
  #ifdef DECNET
  
  #ifndef lint
--- 1,5 ----
  #include "common.h"
! #include <sys/socket.h>
  #ifdef DECNET
  
  #ifndef lint
*** misc.c	Sun Feb  7 00:29:33 1988
--- ../../nntp_gazette/server/misc.c	Sat Apr 23 14:55:05 1988
***************
*** 2,9 ****
  static char	*sccsid = "@(#)misc.c	1.25	(Berkeley) 2/6/88";
  #endif
  
- #include "../common/conf.h"
- 
  #include "common.h"
  
  /*
--- 2,7 ----
***************
*** 292,299 ****
  		}
  	}
  
  	(void) rewind(fp);
! 
  	if (ngcount == 0)	/* Either no newgroups or null entry */
  		return (1);
  
--- 290,300 ----
  		}
  	}
  
+ #ifndef USG
  	(void) rewind(fp);
! #else
! 	rewind(fp);
! #endif
  	if (ngcount == 0)	/* Either no newgroups or null entry */
  		return (1);
  
***************
*** 416,428 ****
--- 417,437 ----
  					(void) strcpy(id, cp + 1);
  					if ((cp = index(id, '\n')) != NULL)
  						*cp = '\0';
+ #ifndef USG
  					(void) rewind(art_fp);
+ #else
+ 					rewind(art_fp);
+ #endif
  					return;
  				}
  			}
  		}
  	}
+ #ifndef USG
  	(void) rewind(art_fp);
+ #else
+ 	rewind(art_fp);
+ #endif
  	(void) strcpy(id, "<0>");
  }
  		
***************
*** 541,547 ****
  
  /* the following is from news 2.11 */
  
! #ifdef USG
  /*
  ** Generate the appropriate history subfile name
  */
--- 550,556 ----
  
  /* the following is from news 2.11 */
  
! #ifdef USGHIST
  /*
  ** Generate the appropriate history subfile name
  */
***************
*** 572,577 ****
--- 581,588 ----
  		chr = '0';
  	return chr;
  }
+ #endif USGHIST
+ #ifdef USG
  bcopy(s, d, l)
  	register char *s, *d;
  	register int l;
*** spawn.c	Sat Feb  6 17:45:12 1988
--- ../../nntp_gazette/server/spawn.c	Tue Mar  8 10:08:37 1988
***************
*** 2,9 ****
  static	char	*sccsid = "@(#)spawn.c	1.6	(Berkeley) 2/6/88";
  #endif
  
- #include "../common/conf.h"
- 
  #include "common.h"
  
  #include <signal.h>
--- 2,7 ----
Stan           internet: sob@tmc.edu          Baylor College of Medicine
Olan           uucp: {rice,killer,hoptoad}!academ!sob
Barber         Opinions expressed are only mine.

