freebsd-ports/news/nntp/files/patch-ag
Chris Piazza 050486602a Update to 1.5.12.2 and add a y2k patch
PR:		16073
Submitted by:	Dirk Meyer <dirk.meyer@dinoex.sub.org>
2000-01-12 05:51:25 +00:00

387 lines
12 KiB
Plaintext

--- xfer/Makefile.orig Thu Nov 17 19:15:22 1994
+++ xfer/Makefile Sun Jan 9 10:21:54 2000
@@ -28,7 +28,8 @@
nntpxfer.o: nntpxfer.c ../conf.h ../server/fakesyslog.h
install: nntpxfer
- cp nntpxfer ${BINDIR}
+ cp nntpxfer ${BINDIR}/nntpxfer
+ chmod 755 ${BINDIR}/nntpxfer
clean:
-rm -f *.o nntpxfer make*.out *.BAK *.CKP *~
--- Makefile.orig Tue Jan 9 08:30:24 1996
+++ Makefile Sun Jan 9 09:35:59 2000
@@ -4,7 +4,7 @@
# The program that knows how to deal with makefiles. [Uncomment if needed.]
# MAKE=make
# set CFLAGS to be -Ipath/to/special/includes if needed
-CFLAGS= -O
+CFLAGS= -O -I/usr/local/include
#Uncomment the following for Solaris (and similiar SVR4 systems)
#NETLIBS = -lsocket -lnsl
#Uncomment the following if the previous one does not work
@@ -13,6 +13,7 @@
#DBLIBS = -ldbz
#DBLIBS = /usr/local/lib/dbz.o #/usr/local/lib/dbzdbm.o
#DBLIBS = -ldbm
+DBLIBS = /usr/local/lib/libcnews.a -lcrypt -lutil
# add the resolver library if needed
#RESLIB = -lresolv
# add the kmem library if needed
@@ -21,9 +21,9 @@
#Uncomment the following for Solaris (and similiar SVR4 systems)
#KVMLIB = -lelf
# Where nntpd is going to live
-ETCDIR = /etc
+ETCDIR = /usr/local/sbin
# Where nntpxmit and nntpxfer is going to live
-BINDIR = /usr/local/bin
+BINDIR = /usr/local/news/cnewsbin
# Where manual pages live
MANDIR = /usr/local/man
#
--- server/common.h.orig Thu Nov 17 19:15:18 1994
+++ server/common.h Sun Jan 9 09:30:03 2000
@@ -161,7 +161,11 @@
void debugup(), debugdown();
#endif
#ifdef SETPROCTITLE
+#ifdef HAVE_PROCTITLE
+#include <libutil.h>
+#else
void setproctitle();
+#endif
#endif
extern char spooldir[];
--- conf.h.orig Sun Jan 9 09:30:02 2000
+++ conf.h Sun Jan 9 10:02:19 2000
@@ -8,10 +8,12 @@
*/
-#undef ALONE /* True if we're running without inetd */
+#define ALONE /* True if we're running without inetd */
#ifdef ALONE
-#undef FASTFORK /* True if we don't want to read active file on start*/
+#define FASTFORK /* True if we don't want to read active file on start*/
+#define NEWS_GID 8
+#define NEWS_UID 8
#endif
#define LOAD 5 /* Loadav above which server refuses connections */
@@ -40,23 +42,23 @@
#undef TLI /* Define this if you want to use TLI instead of */
/* 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 */
/* IF YOU DEFINE THIS, change CFLAGS in makefile to */
/* 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 */
#undef USGHIST /* Use USG style history file (no DBM) */
/* IF YOU DO NOT DEFINE NDBM or DBM, this is DEFAULT!*/
-#undef CNEWS /* define this if you are running C News */
-#undef CNEWS_CLEARTEXT /* define this if you have a modern C News that handles
+#define CNEWS /* define this if you are running C News */
+#define CNEWS_CLEARTEXT /* define this if you have a modern C News that handles
input files ending in ".t" as cleartext */
-#undef BATCHED_INPUT /* define if you want to support C News style
+#define BATCHED_INPUT /* define if you want to support C News style
batched input (not supported by B-NEWS) */
#undef MSGID /* define this if you want to run msgidd to keep
track of recent msgids via daemon */
@@ -70,7 +72,7 @@
/* typedefs for u_long */
#define VOIDSIG /* Newfangled signal() returns void, old returns int */
-#undef MMAP /* if your OS supports mmap() */
+#define MMAP /* if your OS supports mmap() */
#undef DIRENT /* If you have <dirent.h> define this */
@@ -89,7 +91,8 @@
/*#define MINFILES MINFREE/4*/
/* NNTP will not allow an XFER if there is less */
/* than this many inodes on the SPOOLDIR filesystem */
-#undef SETPROCTITLE /* if you want status visable via ps */
+#define SETPROCTITLE /* if you want status visable via ps */
+#define HAVE_PROCTITLE /* if the OS has setproctitle() */
#undef IHAVE_DEBUG /* Copious debugging output from ihave */
@@ -110,7 +113,7 @@
* if you are running BNEWS. At least, not yet. :-)
*/
-/* #define UMASK 022 */
+#define UMASK 022
/*
* If you have the syslog library routine, define SYSLOG to
@@ -177,13 +180,13 @@
#define XOVER /* xover -- Return .overview data */
#define OVER_XREFS /* overview files have xref data in them */
#define OVER_XREF_PREFIX /* the xref field (if present) includes xref: */
-#define OVER_FMT_FILE "/usr/lib/news/overview.fmt"
+#define OVER_FMT_FILE "/usr/local/news/lib/overview.fmt"
/* Leave this undefined to indicate that overview files go in the spool
* directory. However, if you want a separate hierarchy of overview
* files, define it here.
*/
-/*#define OVERVIEW_DIR "/usr/spool/overviews" /* base directory */
+#define OVERVIEW_DIR "/var/news/over.view" /* base directory */
#define XROVER /* xrover -- Return reference overview data */
@@ -191,10 +194,10 @@
* spool directory. However, if you want a separate hierarchy of rover
* files, define it here.
*/
-/*#define ROVER_DIR "/usr/spool/overviews" /* base directory */
+/*define ROVER_DIR "/var/news/r.over" /* base directory */
#undef XINDEX /* Optional support for tin's index files */
-#define XINDEX_DIR "/usr/spool/news/.index"
+#define XINDEX_DIR "/var/news/.index"
/* XTHREAD defines: if XTHREAD is defined, THREAD_DIR controls where the
* thread files will be read from.
@@ -244,27 +247,27 @@
/*
* This file is where access information is stored
*/
-#define ACCESS_FILE "/usr/lib/news/nntp_access"
+#define ACCESS_FILE "/usr/local/news/lib/nntp_access"
/*
* The file where the newgroup creation times are kept. If you don't
* have C News or INN, you can run acttimes (see the support directory)
* to maintain an active.times file.
*/
-#define ACTIVE_TIMES_FILE "/usr/lib/news/active.times"
+#define ACTIVE_TIMES_FILE "/usr/local/news/lib/active.times"
/*
* Some commonly used programs and files.
*/
-#define ACTIVE_FILE "/usr/lib/news/active"
-#define DISTRIBUTIONS_FILE "/usr/lib/news/distributions"
-#define SUBSCRIPTIONS_FILE "/usr/lib/news/subscriptions"
-#define NEWSGROUPS_FILE "/usr/lib/news/newsgroups"
-#define HISTORY_FILE "/usr/lib/news/history"
-#define SPOOLDIR "/usr/spool/news"
-#define INEWS "/usr/lib/news/inews"
-#define RNEWS "/usr/bin/rnews" /* Link to inews? */
+#define ACTIVE_FILE "/usr/local/news/lib/active"
+#define DISTRIBUTIONS_FILE "/usr/local/news/lib/distributions"
+#define SUBSCRIPTIONS_FILE "/usr/local/news/lib/subscriptions"
+#define NEWSGROUPS_FILE "/usr/local/news/lib/newsgroups"
+#define HISTORY_FILE "/usr/local/news/lib/history"
+#define SPOOLDIR "/var/news"
+#define INEWS "/usr/local/news/lib/inews"
+#define RNEWS "/usr/local/bin/rnews" /* Link to inews? */
/*
* Support for C News style batching
@@ -277,15 +280,15 @@
#else
#define TOOBIG 300000L /* batch > TOOBIG bytes, kick rnews */
#define TOOMANY 1024 /* batch > TOOMANY articles, kick rnews */
-#define NEWSRUN "/usr/lib/newsbin/input/newsrun"
+#define NEWSRUN "/usr/local/news/cnewsbin/input/newsrun"
#endif
#define TOOOLD (5*60) /* batch > TOOOLD seconds old, kick rnews */
#define COPYSIZE 8192 /* bytes to copy at one time */
#define MAXDIGITS 25 /* lg(maxlongint) + epsilon */
#define MAXSTR 1024
-#define INDIR "/usr/spool/news/in.coming"
+#define INDIR "/var/news/in.coming"
/* You may wish to delete the pathname from the front of BATCH_FILE */
-#define BATCH_FILE "/usr/spool/news/in.coming/nntp.XXXXXX"
+#define BATCH_FILE "/var/news/in.coming/nntp.XXXXXX"
/************************************************************************/
/* We don't recommend that you make changes in anything after this line */
--- doc/config.sh.orig Tue Nov 1 06:36:57 1994
+++ doc/config.sh Sun Jan 9 09:30:03 2000
@@ -11,11 +11,11 @@
# (modify these lines to suit your system)
#
# the location of inetd on your system (usually /etc/inetd)
-MINETD=/etc/inetd
+MINETD=/usr/sbin/inetd
# the location of the inetd configuration file (usually /etc/inetd.conf)
MINETDCONFIG=/etc/inetd.conf
# the location of nntpd following installation (usually /etc/nntpd)
-MNNTPD=/etc/nntpd
+MNNTPD=/usr/local/sbin/nntpd
# the location of the hosts file (usually /etc/hosts)
MHOSTFILE=/etc/hosts
# the location of the services file (usually /etc/services)
@@ -23,12 +23,12 @@
# the location of the networks file (usually /etc/networks)
MNETWORKFILE=/etc/networks
# The location of the news spool directory (usually /usr/spool/news)
-MNEWSSPOOL=/usr/spool/news
+MNEWSSPOOL=/var/news
# The location of the news library directory (usually /usr/lib/news)
-MNEWSLIB=/usr/lib/news
+MNEWSLIB=/usr/local/news/lib
# The location of the file containing the name of the nntp server machine
# (usually /usr/local/lib/rn/server)
-MSERVERFILE=/usr/local/lib/rn/server
+MSERVERFILE=/usr/local/etc/nntpserver
# The location of rn's local library (usually /usr/local/lib/rn)
MRNLIB=/usr/local/lib/rn
#
--- server/main.c.orig Thu Nov 17 19:15:19 1994
+++ server/main.c Sun Jan 9 09:30:03 2000
@@ -35,8 +35,10 @@
#endif
#ifdef SETPROCTITLE
+#ifndef HAVE_PROCTITLE
char **Argv = NULL; /* pointer to argument vector */
char *LastArgv = NULL; /* end of argv */
+#endif
#endif /* SETPROCTITLE */
int
@@ -81,6 +83,22 @@
#ifndef EXCELAN
sockt = get_socket(); /* should be fd 4 or 5 */
+ if ( getuid() == 0 ) { /* Running as root */
+
+ if (setgid((gid_t) NEWS_GID) == -1) {
+#ifdef SYSLOG
+ syslog(LOG_ERR, "setgid: %m");
+#endif
+ exit(1);
+ }
+
+ if (setuid((uid_t) NEWS_UID) == -1) {
+#ifdef SYSLOG
+ syslog(LOG_ERR, "setuid: %m");
+#endif
+ exit(1);
+ }
+ }
#ifdef USG
(void) signal(SIGCLD, SIG_IGN);
#else /* !USG */
@@ -101,6 +119,7 @@
#endif /* EXCELAN */
#ifdef SETPROCTITLE
+#ifndef HAVE_PROCTITLE
/*
* Save start and extent of argv for setproctitle.
*/
@@ -113,6 +132,7 @@
envp++;
LastArgv = envp[-1] + strlen(envp[-1]);
#endif /*SDD*/
+#endif
#endif /* SETPROCTITLE */
#if defined(LOAD) && defined(SETPROCTITLE)
/* If LOAD and SETPROCTITLE, display load before first accept() */
@@ -243,6 +263,7 @@
}
#endif /* LOAD */
#ifdef SETPROCTITLE
+#ifndef HAVE_PROCTITLE
/*
* Save start and extent of argv for setproctitle.
*/
@@ -255,6 +276,7 @@
envp++;
LastArgv = envp[-1] + strlen(envp[-1]);
#endif /*SDD*/
+#endif
#endif /* SETPROCTITLE */
#ifdef USG
@@ -271,6 +293,7 @@
* stolen from sendmail
*/
#ifdef SETPROCTITLE
+#ifndef HAVE_PROCTITLE
#if defined(sun) || defined(hpux)
/*VARARGS*/
void
@@ -330,4 +353,5 @@
*p++ = ' ';
}
#endif /* hpux */
+#endif
#endif /* SETPROCTITLE */
--- xfer/nntpxfer.c.orig Tue Jan 9 08:28:03 1996
+++ xfer/nntpxfer.c Sun Jan 9 09:30:03 2000
@@ -60,6 +60,9 @@
#include <sys/time.h>
#endif
+#ifdef BSD_44
+#define _ANSI_SOURCE
+#endif
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
--- xmit/nntpxmit.c.orig Sat Dec 3 23:37:58 1994
+++ xmit/nntpxmit.c Sun Jan 9 10:13:10 2000
@@ -64,6 +64,9 @@
*/
#include "../conf.h"
+#ifdef BSD_44
+#define _ANSI_SOURCE
+#endif
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
--- xmit/nntpxmit.h.orig Thu Nov 3 04:51:34 1994
+++ xmit/nntpxmit.h Sun Jan 9 09:30:04 2000
@@ -7,6 +7,7 @@
*/
#ifdef MMAP
+#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#endif
--- xmit/shlock.c.orig Tue Nov 1 06:54:32 1994
+++ xmit/shlock.c Sun Jan 9 09:30:04 2000
@@ -28,7 +28,6 @@
** Erik E. Fair <fair@apple.com>, November 12, 1989
*/
-#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h> /* Needed on hpux */
#include <sys/file.h>
@@ -36,6 +35,10 @@
#ifdef NNTPSRC
#include "../conf.h"
#endif
+#ifdef BSD_44
+#define _ANSI_SOURCE
+#endif
+#include <stdio.h>
#define LOCK_SET 0
#define LOCK_FAIL 1