[news.software.nntp] Two bugs in nntp 1.5

mcooper@acamar.usc.edu (Michael A. Cooper) (05/03/89)

Enclosed are two fixes for two unrelated bugs I ran across recently
installing nntp 1.5 on a new machine.

The first bug is with the server nntpd.  The problem appeared when I
started running nntp on a new Sun-4/280 running SunOS 4.0.1.  The file
pointer for the history file was never rewound which caused the error
"message: fseek: Bad file number" to occur.  Looking at the problem
I'm not sure why it worked on other machines (such as the VAX 750
running 4.3BSD I ran nntp on for years).

The second bug is a configuration problem in nntpxmit.  It seems that
the SYSLOG logging level specified in common/conf.h is ignored by
nntpxmit which hardwires LOG_LOCAL7 as the level.

The appended shar contains two patch files.  The first is
"nntp.server.patch" which should be applied to misc.c in the server
directory.  The second is "nntp.xmit.patch" which should be applied in
the xmit directory.

Michael A. Cooper, University Computing Services, U of Southern California
  INTERNET: mcooper@usc.edu	            PHONE: (213) 743-2957
  UUCP: ...!uunet!usc!mcooper              BITNET: mcooper@gamera

#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	nntp.server.patch
#	nntp.xmit.patch
# This archive created: Tue May  2 16:12:43 1989
# By:	Michael A. Cooper (USC Computing Services, Los Angeles)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'nntp.server.patch'" '(683 characters)'
if test -f 'nntp.server.patch'
then
	echo shar: over-writing existing file "'nntp.server.patch'"
fi
cat << \SHAR_EOF > 'nntp.server.patch'
*** misc.c.ORIG	Wed Apr 19 19:57:24 1989
--- misc.c	Wed Apr 19 20:05:24 1989
***************
*** 181,192 ****
  #endif SYSLOG
  			return (NULL);
  		}
  	}
  
  	bcopy(content.dptr, (char *)&ltmp, sizeof (long));
  	if (fseek(hfp, ltmp, 0) < 0) {
  #ifdef SYSLOG
! 		syslog(LOG_ERR, "message: fseek: %m");
  #endif SYSLOG
  		return (NULL);
  	}
--- 181,195 ----
  #endif SYSLOG
  			return (NULL);
  		}
+ 	} else {
+ 		rewind(hfp);
  	}
  
  	bcopy(content.dptr, (char *)&ltmp, sizeof (long));
  	if (fseek(hfp, ltmp, 0) < 0) {
  #ifdef SYSLOG
! 		syslog(LOG_ERR, "message: %s: fseek to %ld on %d: %m", 
! 		       historyfile, ltmp, hfp);
  #endif SYSLOG
  		return (NULL);
  	}
SHAR_EOF
echo shar: extracting "'nntp.xmit.patch'" '(1553 characters)'
if test -f 'nntp.xmit.patch'
then
	echo shar: over-writing existing file "'nntp.xmit.patch'"
fi
cat << \SHAR_EOF > 'nntp.xmit.patch'
*** nntpxmit.c.ORIG	Fri Apr 21 13:27:22 1989
--- nntpxmit.c	Fri Apr 21 13:33:09 1989
***************
*** 59,64 ****
--- 59,65 ----
  ** Erik E. Fair <fair@ucbarpa.berkeley.edu>, Dec 4, 1987
  */
  
+ #include "../common/conf.h"
  #include "nntpxmit.h"
  #include <stdio.h>
  #include <errno.h>
***************
*** 187,197 ****
  
  #ifdef	SYSLOG
  	/* 4.2 BSD openlog has only two args */
! #ifdef	LOG_LOCAL7
! 	(void) openlog(Pname, LOG_PID, LOG_LOCAL7);
! #else
  	(void) openlog(Pname, LOG_PID);
! #endif	LOG_LOCAL_7
  #endif	SYSLOG
  #ifdef	USELOG
  	if ((Logfp = fopen(NNTPlog, amode)) == (FILE *)NULL) {
--- 188,198 ----
  
  #ifdef	SYSLOG
  	/* 4.2 BSD openlog has only two args */
! #ifdef	BSD_42
  	(void) openlog(Pname, LOG_PID);
! #else
! 	(void) openlog(Pname, LOG_PID, SYSLOG);
! #endif	BSD_42
  #endif	SYSLOG
  #ifdef	USELOG
  	if ((Logfp = fopen(NNTPlog, amode)) == (FILE *)NULL) {
*** nntpxmit.h.ORIG	Fri Apr 21 13:33:36 1989
--- nntpxmit.h	Fri Apr 21 15:12:21 1989
***************
*** 10,15 ****
--- 10,18 ----
  
  #define	dprintf	if (Debug) fprintf
  
+ #ifdef TIMEOUT
+ #undef TIMEOUT
+ #endif TIMEOUT
  #define	TIMEOUT	3600		/* seconds to read timeout in sfgets */
  
  #ifndef	TRUE
***************
*** 60,66 ****
  
  #ifdef	BSD4_2			/* look at all these goodies we get! */
  #define	FTRUNCATE
! #define	SYSLOG
  #define	RELSIG
  #endif	BSD4_2
  
--- 63,69 ----
  
  #ifdef	BSD4_2			/* look at all these goodies we get! */
  #define	FTRUNCATE
! /*#define	SYSLOG*/	/* Done in ../common/conf.h */
  #define	RELSIG
  #endif	BSD4_2
  
SHAR_EOF
#	End of shell archive
exit 0



Michael A. Cooper, University Computing Services, U of Southern California
  INTERNET: mcooper@usc.edu	            PHONE: (213) 743-2957
  UUCP: ...!uunet!usc!mcooper              BITNET: mcooper@gamera