Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 1996 19:50:59 -0700 (MST)
From:      Don Yuniskis <dgy@rtd.com>
To:        freebsd-ports@freefall.FreeBSD.org (FreeBSD ports)
Subject:   nntp diffs
Message-ID:  <199610110250.TAA04092@seagull.rtd.com>

next in thread | raw e-mail | index | archive | help
Greetings!
     These diffs apply to the patched port of nntp distributed with 2.1R
(yes, I'm out of date -- so sue me...).  They add support for tin's index
files, trn's threads, the msgid daemon, more verbose logging, fix (???)
the process title display to include a preface of "nntpd: ", add hooks
to allow the AUTHINFO commands to work when run suid(root), pretty-up the
nntp_access file, build the remaining utilities (etc.), fix the load
average code, silence some pesky compiler warnings -- all this *without*
breaking anything (heh heh heh... or so he says!)
     I *hope* I handled the seteuid() stuff right... it *seems* to
do what I think it should... :>
     Apologies for not being -current but it's just too damn hard
to keep up!  :-(
    Thanx!
--don
------------------8<---------------8<--------------------
diff -r work/nntp-t5/Makefile work.new/nntp-t5/Makefile
27c27
< #	cd support; $(MAKE) $(MFLAGS) "LIBS=${LIBS}" "CFLAGS=${CFLAGS}"
---
> 	cd support; $(MAKE) $(MFLAGS) "LIBS=${LIBS}" "CFLAGS=${CFLAGS}"
30c30
< #	cd xfer; $(MAKE) $(MFLAGS) "LIBS=${LIBS}" "CFLAGS=${CFLAGS}"
---
> 	cd xfer; $(MAKE) $(MFLAGS) "LIBS=${LIBS}" "CFLAGS=${CFLAGS}"
diff -r work/nntp-t5/conf.h work.new/nntp-t5/conf.h
17c17
< #undef LOAD 5	        /* Loadav above which server refuses connections */
---
> #define LOAD 5	        /* Loadav above which server refuses connections */
56c56
< #undef MSGID		/* define this if you want to run msgidd to keep
---
> #define MSGID		/* define this if you want to run msgidd to keep
89c89
< #undef MINFILES  MINFREE/4
---
> #define MINFILES  (MINFREE/4)
94c94
< #undef	IHAVE_DEBUG	/* Copious debugging output from ihave */
---
> #define	IHAVE_DEBUG	/* Copious debugging output from ihave */
143c143
< #undef	 LOG		/* undef it if you don't */
---
> #define	 LOG		/* undef it if you don't */
216,217c216,217
< #undef XINDEX		/* Optional support for tin's index files */
< #define XINDEX_DIR	"/usr/spool/news/.index"
---
> #define XINDEX		/* Optional support for tin's index files */
> #define XINDEX_DIR	"/var/news/.index"
222c222
< #undef XTHREAD		/* Optional XTHREAD command.  This allows trn to
---
> #define XTHREAD		/* Optional XTHREAD command.  This allows trn to
229c229
< /*#define THREAD_DIR	"/usr/spool/threads"		/* base directory */
---
> #define THREAD_DIR	"/var/news/threads"		/* base directory */
246c246
< #define	POSTER		"usenet"
---
> #define	POSTER		"news"
259c259
< # define	PASSFILE	"/etc/nntp.sys"
---
> # define	PASSFILE	"/usr/local/etc/nntp.sys"
372c372
< #	define SUFFIX ".th"
---
> #	define SUFFIX "/.thread"
diff -r work/nntp-t5/server/auth.c work.new/nntp-t5/server/auth.c
29a30
> extern uid_t	whoIwas;
117a119
> 	seteuid(whoIwas);		/* reclaim privilege */
118a121
> 	setuid(getuid());		/* forsake all further privilege */
132a136
> 
diff -r work/nntp-t5/server/batch.c work.new/nntp-t5/server/batch.c
472c472
< 		newsrun = "/usr/lib/newsbin/input/newsrun";
---
> 		newsrun = "/usr/local/libexec/news/input/newsrun";
diff -r work/nntp-t5/server/main.c work.new/nntp-t5/server/main.c
34a35,38
> #if defined(AUTH)
> uid_t whoIwas;
> #endif
> 
39a44,45
> 	whoIwas = geteuid();
> 	seteuid(getuid());		/* relinquish privilege */
273c279
< #if defined(sun) || defined(hpux)
---
> #if defined(sun) || defined(hpux) || defined(__FreeBSD__)
274a281,282
> #include <varargs.h>
> 
283a292,296
>     /* cloned from sendmail... */
>     p = buf;
>     strcpy(p, "nntpd: ");
>     p += strlen(p);
> 
286,291c299,300
<     
<     (void) vsprintf(buf, fmt, ap);
< 
<     /* make ps print "(nntpd)" */
<     p = Argv[0];
<     *p++ = '-';
---
>     vsprintf(p, fmt, ap);
>     va_end(ap);
294,295c303,304
<     if (i > LastArgv - p - 2) {
< 	i = LastArgv - p - 2;
---
>     if (i > LastArgv - Argv[0] - 2) {
> 	i = LastArgv - Argv[0] - 2;
298,299c307,310
<     strcpy(p, buf);
<     p += i;
---
> 
>     strcpy(Argv[0], buf);
> 
>     p = &Argv[0][i];
303d313
<     va_end(ap);
diff -r work/nntp-t5/server/misc.c work.new/nntp-t5/server/misc.c
969a970,984
> #elif defined(__FreeBSD__)
> int
> getla()
> {
> 	double avenrun;
> 
> 	if (1 > getloadavg(&avenrun, 1)) {
> #ifdef SYSLOG
> 		syslog(LOG_ERR,"can't get load average");
> #endif
> 		return(-1);
> 	}
> 
> 	return ((int) (avenrun + 0.5));
> }
diff -r work/nntp-t5/server/msgid.c work.new/nntp-t5/server/msgid.c
72c72
<     if (0 > connect(s, &n, strlen(n.sun_path) + sizeof n.sun_family)) {
---
>     if (0 > connect(s, (struct sockaddr *) &n, strlen(n.sun_path) + sizeof n.sun_family)) {
diff -r work/nntp-t5/server/msgid.h work.new/nntp-t5/server/msgid.h
4,5c4,5
< #define SOCKNAME	"/usr/lib/news/nntp_msgid"
< #define PIDFILE         "/usr/lib/news/msgidd.pid"
---
> #define SOCKNAME	"/usr/local/lib/news/nntp_msgid"
> #define PIDFILE         "/var/run/msgidd.pid"
diff -r work/nntp-t5/server/msgidd.c work.new/nntp-t5/server/msgidd.c
175c175
< int onpipe();
---
> SIGRET onpipe();
238c238
<     ASSERT(0<=bind(s, &n, strlen(n.sun_path) +sizeof n.sun_family),n.sun_path);
---
>     ASSERT(0<=bind(s, (struct sockaddr *) &n, strlen(n.sun_path) +sizeof n.sun_family),n.sun_path);
274c274
< 		    if ((fd = accept(s, &in, &fromlen)) == -1) {
---
> 		    if ((fd = accept(s, (struct sockaddr *) &in, &fromlen)) == -1) {
540c540
< onpipe()
---
> SIGRET onpipe()
diff -r work/nntp-t5/server/spawn.c work.new/nntp-t5/server/spawn.c
65c65
< 	int		xfer_timeout();
---
> 	SIGRET		xfer_timeout();
67c67
< #ifdef USG
---
> #if defined(USG) || defined(__FreeBSD__)
274c274
< #ifdef USG
---
> #if defined(USG) || defined(__FreeBSD__)
320c320
< xfer_timeout()
---
> SIGRET xfer_timeout()
diff -r work/nntp-t5/support/access_file work.new/nntp-t5/support/access_file
0a1,2
> # This is the nntpd() access control file.
> # It should be installed as /usr/local/lib/news/nntp_access
2,5c4,5
< # Sample NNTP access file. 
< # Note that "default" must be the first entry in the
< # table. Order is important. Put the most restictive
< # entried just behind "default"
---
> # Blank lines are ignored.
> # Comments are introduced with `#'.
7,9c7,8
< # If you defined SUBNET when you compiled the server,
< # this file can have subnets as well as class A, B, C
< # networks, hosts, and domains.
---
> # If you defined SUBNET when you compiled the server, this file can
> # have subnets as well as class A, B, C networks, hosts, and domains.
11c10,28
< # host/net		read/xfer/no	post/no
---
> # Each entry is of the form:
> #	<client>	<access>	<posting>	<newsgroups>
> # where:
> #	<access>	::= read | xfer | both | no
> #	<address>	::= an IP address
> #	<client>	::= <hostname> | <netname> | <address> | *.<domain>
> #	<domain>	::= a (possibly dotted) domain name
> #	<hostname>	::= a valid host name from /etc/hosts
> #	<netname>	::= a valid network name from /etc/networks
> #	<newsgroup>	::= <group> | !<group>
> #	<newsgroups>	::= <newsgroup> | <newsgroup>,<newsgroups>
> #	<posting>	::= post | no
> # Specifying an uppercase variant of the <posting> or <access> parameters
> # indicates the requirement for authentication of the client.
> 
> # Note that "default" must be the first entry in the list.
> # In the absence of a ``default'' entry, each <client> named herein is
> # allowed reading but not posting of news articles.  All others are denied
> # reading and posting privileges.
12a30,36
> # The absence of a <newsgroup> field is interpreted as ``all''.
> 
> # A <hostname> entry takes precedence over a <netname> criteria.
> # The first satisfied <hostname> entry is used.
> # A satisfied <domain> entry is interpreted as a satisfied <hostname>.
> 
> 
14,23c38,49
< default			xfer		no
< # bugs, a notorious undergraduate machine, is not allowed
< # to read or post news at all.
< bugs.berkeley.edu	no		no
< # ic can read and post news, but users on ic cannot read
< # articles in the group ucb.postgres or any of its decendents
< # (e.g., ucb.postgres.core)
< ic			read		post	!ucb.postgres
< # hosts on the Berkeley campus can read and post news
< *.berkeley.edu		read		post
---
> default			xfer			no
> 
> # localhost can read, transfer and post news, but users on localhost cannot
> # read articles in the group ucb.postgres or any of its decendents
> localhost.my.domain	both			post		!ucb.postgres
> 
> # hosts within my domain can read, transfer and post news but require
> # proper authorization.
> *.my.domain		BOTH			POST
> 
> # bugs is not allowed to read or post news at all.
> bugs.berkeley.edu	no			no
diff -r work/nntp-t5/support/acttimes.c work.new/nntp-t5/support/acttimes.c
70a71
> #if !defined(__FreeBSD__)
71a73
> #endif
diff -r work/nntp-t5/xfer/nntpxfer.c work.new/nntp-t5/xfer/nntpxfer.c
625a626
> #if !defined(__FreeBSD__)
627a629
> #endif
634c636
< 		return sys_errlist[code];
---
> 		return (char *) sys_errlist[code];
diff -r work/nntp-t5/xmit/nntpsend.csh work.new/nntp-t5/xmit/nntpsend.csh
5,7c5,7
< set newsspool=/usr/spool/news
< set batchdir=/usr/spool/news/batch libdir=/usr/spool/news/lib
< set path=( $libdir /usr/ucb /usr/bin /bin $path )
---
> set newsspool=/var/news
> set batchdir=/var/news/batch libdir=/usr/local/libexec/news
> set path=( $libdir /usr/bin /bin $path )
diff -r work/nntp-t5/xmit/nntpsend.sh work.new/nntp-t5/xmit/nntpsend.sh
5,8c5,8
< newsspool=/usr/spool/news
< batchdir=/usr/spool/news/batch
< libdir=/usr/spool/news/lib
< PATH=${libdir}:/usr/ucb:/usr/bin:/bin:${PATH}
---
> newsspool=/var/news
> batchdir=/var/news/batch
> libdir=/usr/local/libexec/news
> PATH=${libdir}:/usr/bin:/bin:${PATH}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610110250.TAA04092>