🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #3600

Patches: tin 1.1pl9 + inn1.4

#3600
From: Doug Sewell
Date: Mon, 29 Mar 1993 15:37
412 lines
13917 bytes
The following is the set of patches and sources necessary to install the
tin 1.1pl9 NNTP extensions on INN 1.4.  Unshar it into a new directory,
read the README file (which explains everything), and install it.  Oh,
and if you built tin without the NNTP extensions, then XMOTD, XUSER,
XINDEX, XOVERVIEW, and LIST SUBSCRIPTIOSN won't help you any.

As I've noted in the README file, it hasn't been heavily tested, but it
appears to work just fine.  We use tin heavily here, both via NFS and
NNTP, and we've also hacked some of these extensions into other readers.

#! /bin/sh
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by news.ysu.edu!news on Mon Mar 29 10:24:23 EST 1993
# Contents:  README tin119.tin-open.c.pch tin119.nnrpd-Makefile.pch
#	tin119.nnrpd-commands.c.pch tin119.nnrpd-nnrpd.c.pch dtol.c common.h
#	tininn.h
 
echo x - README
sed 's/^@//' > "README" <<'@//E*O*F README//'
The enclosed set of source files and patches add the tin NNTP extensions (LIST
SUBSCRIPTIONS, XOVERVIEW, XUSER, XINDEX, and XMOTD) to INN 1.4.  As we use
tin heavily at our site, both from NFS and NNTP, and since we've hacked a
couple of these commands into other newsreaders, it was worth my time to
implement them.

Important notes: (1) this code is supported by neither Rich Salz (rsalz@uunet.
uu.net), author of INN, nor Iain Lea (Iain.Lea%anl433.uucp@germany.eu.net),
author of tin. (2) they haven't been exhaustively tested yet.  I'm confident
they work right, however.  If you have problems e-mail me (doug@cc.ysu.edu).

The baseline tin software is tin 1.1pl9, and you'll need these files from
that distribution:
xoverview.c	- adds XOVERVIEW command (deprecated, see below)
xuser.c		- adds XUSER command (log user info to syslog)
xindex.c	- adds XINDEX command (retrieve tin indexes)
xmotd.c		- adds XMOTD command (retrieve netnews motd)

In addition, a patch (tin119.tin-open.c.pch) must be applied to tin's open.c.
This patch will work with both reference and INN NNTP implementations, and
should also work with others as well.  The reason it's needed is that the
existing open.c code assumes that if XINDEX is supported it can't be an INN
server at the other end, so there's no need to issue a MODE READER.

The remainder of the files are either additional source files needed, or
patches to the nnrpd sources.  You need to put these three files in your
INNSRC/nnrpd directory:

tininn.h	- defines configuration of extensions.  You probably will
@		  have to edit this.
common.h	- takes the place of the reference NNTP's server/common.h
@		  for use in x*.c, to avoid changes to x*.c.
dtol.c		- calls INN's NNTPtoGMT function after rearranging args,
@		  to avoid changes in x*.c.
tin119-nnrpd-Makefile.pch	- apply this patch to nnrpd's Makefile
tin119-nnrpd-nnrpd.c.pch	- apply this patch to nnrpd's nnrpd.c
tin119-nnrpd-commands.c.pch	- apply this patch to nnrpd's commands.c
@		  
@//E*O*F README//
chmod u=rw,g=r,o=r README
 
echo x - tin119.tin-open.c.pch
sed 's/^@//' > "tin119.tin-open.c.pch" <<'@//E*O*F tin119.tin-open.c.pch//'
*** open.c.orig	Mon Mar 22 11:31:45 1993
--- open.c	Tue Mar 23 14:08:05 1993
***************
*** 82,87 ****
--- 82,133 ----
@  			exit (1);
@  		}
@  
+ 	/* In the event the server at the other end is INN, we need to make
+ 	   sure we get connected to an nnrpd (read/post server) rather than
+ 	   staying connected to innd.  Issue a 'MODE READER'.
+ 		- Non-INN NNTP connections won't return a 200/201/502.
+ 		  Usually but not always it will be a 500 (unrec command).
+ 		- If this machine is not in hosts.nntp, innd will have
+ 		  already connected us to an nnrpd.  Nnrpd responds with
+ 		  with the same code/message it did at original connect
+ 		  time (200, 201, or 502 as appropriate from nnrp.access).
+ 		- If this machine is in hosts.nntp, innd will spawn an 
+ 		  nnrpd, which will respond with 200, 201, or 502 as
+ 		  appropriate from nnrp.access.  Doug Sewell,
+ 		  doug@cc.ysu.edu */
+ 
+ 		debug_nntp ("nntp_open", "mode reader");
+ 		put_server ("mode reader");	
+ 		ret = get_respcode();
+ 		debug_nntp_respcode (ret);
+ 
+ 		switch (ret) {
+ 		case OK_CANPOST:
+ 		/* nnrpd now listening, posting OK */
+ #ifndef NO_POSTING		
+ 			can_post = TRUE;
+ #endif			
+ 			inn_nntp_server = TRUE;
+ 			break;
+ 
+ 		/* nnrpd now listening, can't post */
+ 		case OK_NOPOST:
+ 			can_post = FALSE;
+ 			inn_nntp_server = TRUE;
+ 			break;	
+ 
+ 		/* nnrpd denies read/post access */
+ 		case ERR_ACCESS:
+ 			sprintf (msg, "%s: %s", progname, nntp_respcode (ret));
+ 			error_message (msg, "");
+ 			exit (1);
+ 
+ 		/* must not be INN.  No biggie. */
+ 		default:
+ 			inn_nntp_server = FALSE;
+ 			break;
+ 		}
+ 			
@  		/*
@  		 * Check if NNTP supports my XINDEX & XUSER commands
@  		 */
***************
*** 103,119 ****
@  		 */
@  		authorization (nntp_server, userid);
@  		 
! 		/*
! 		 * If INN NNTP & XINDEX not supported switch to mode reader
! 		 */
! 		if (! xindex_supported) {
! 			debug_nntp ("nntp_open", "mode reader");
! 			put_server ("mode reader");	
! 			if (get_respcode () != ERR_COMMAND) {
! 				inn_nntp_server = TRUE;
! 			}
! 		}
! 	}
@  #ifndef DONT_HAVE_NNTP_EXTS
@  	/*
@  	 * Find out if NNTP supports SPOOLDIR command
--- 149,155 ----
@  		 */
@  		authorization (nntp_server, userid);
@  		 
! 	} /* read_news_via_nntp */
@  #ifndef DONT_HAVE_NNTP_EXTS
@  	/*
@  	 * Find out if NNTP supports SPOOLDIR command
***************
*** 120,126 ****
@  	 */
@  	get_spooldir ();
@  #endif	/* DONT_HAVE_NNTP_EXTS */		
- 
@  #endif	
@  }
@  
--- 156,161 ----
@//E*O*F tin119.tin-open.c.pch//
chmod u=rw,g=r,o= tin119.tin-open.c.pch
 
echo x - tin119.nnrpd-Makefile.pch
sed 's/^@//' > "tin119.nnrpd-Makefile.pch" <<'@//E*O*F tin119.nnrpd-Makefile.pch//'
*** Makefile.orig	Sun Mar 21 14:57:48 1993
--- Makefile	Sat Mar 27 17:03:07 1993
***************
*** 32,41 ****
@  LINTLIB	= ../llib-linn.ln
@  
@  SOURCES	= \
! 	article.c group.c commands.c misc.c newnews.c nnrpd.c post.c loadave.c
@  
@  OBJECTS	= \
! 	article.o group.o commands.o misc.o newnews.o nnrpd.o post.o loadave.o
@  
@  ALL	= nnrpd
@  
--- 32,41 ----
@  LINTLIB	= ../llib-linn.ln
@  
@  SOURCES	= \
! 	article.c group.c commands.c misc.c newnews.c nnrpd.c post.c loadave.c dtol.c xindex.c xmotd.c xoverview.c xuser.c
@  
@  OBJECTS	= \
! 	article.o group.o commands.o misc.o newnews.o nnrpd.o post.o loadave.o dtol.o xindex.o xmotd.o xoverview.o xuser.o
@  
@  ALL	= nnrpd
@  
***************
*** 87,92 ****
--- 87,93 ----
@  
@  # DO NOT DELETE THIS LINE -- make depend depends on it.
@  $(OBJECTS):	nnrpd.h \
+ 		common.h tininn.h\
@  		../include/clibrary.h ../include/configdata.h \
@  		../include/libinn.h ../include/logging.h \
@  		../include/macros.h ../include/nntp.h \
@//E*O*F tin119.nnrpd-Makefile.pch//
chmod u=rw,g=r,o=r tin119.nnrpd-Makefile.pch
 
echo x - tin119.nnrpd-commands.c.pch
sed 's/^@//' > "tin119.nnrpd-commands.c.pch" <<'@//E*O*F tin119.nnrpd-commands.c.pch//'
*** commands.c.orig	Thu Mar 18 16:04:42 1993
--- commands.c	Mon Mar 29 09:36:25 1993
***************
*** 4,9 ****
--- 4,10 ----
@  */
@  #include "nnrpd.h"
@  #include <time.h>
+ #include "tininn.h"
@  
@  
@  typedef struct _LISTINFO {
***************
*** 37,44 ****
@      _PATH_SCHEMA, "overview schema",
@      "Order of fields in overview database"
@  };
@  
- 
@  /* ARGSUSED */
@  FUNCTYPE
@  CMDauthinfo(ac, av)
--- 38,50 ----
@      _PATH_SCHEMA, "overview schema",
@      "Order of fields in overview database"
@  };
+ #ifdef LISTSUBS
+ STATIC LISTINFO		INFOsubscriptions = {
+ 	SUBSCRIPTIONS_FILE, "default subscriptions",
+ 	"Default subscriptions in form \"group\""
+ };
+ #endif
@  
@  /* ARGSUSED */
@  FUNCTYPE
@  CMDauthinfo(ac, av)
***************
*** 147,152 ****
--- 153,162 ----
@  	lp = &INFOgroups;
@      else if (caseEQ(p, "overview.fmt"))
@  	lp = &INFOschema;
+ #ifdef LISTSUBS
+     else if (caseEQ(p, "subscriptions"))
+ 	lp = &INFOsubscriptions;
+ #endif
@      else {
@  	Reply("%s\r\n", NNTP_SYNTAX_USE);
@  	return;
@//E*O*F tin119.nnrpd-commands.c.pch//
chmod u=rw,g=r,o=r tin119.nnrpd-commands.c.pch
 
echo x - tin119.nnrpd-nnrpd.c.pch
sed 's/^@//' > "tin119.nnrpd-nnrpd.c.pch" <<'@//E*O*F tin119.nnrpd-nnrpd.c.pch//'
*** nnrpd.c.orig	Thu Mar 18 16:04:44 1993
--- nnrpd.c	Sat Mar 27 17:32:55 1993
***************
*** 12,17 ****
--- 12,18 ----
@  #if	defined(HPUX)
@  #include <sys/pstat.h>
@  #endif	/* defined(HPUX) */
+ #include "tininn.h"
@  
@  
@  #define CMDany		-1
***************
*** 63,68 ****
--- 64,81 ----
@  #if	defined(DO_DO_XTHREAD)
@  extern FUNCTYPE	CMDxthread();
@  #endif	/* defined(DO_DO_XTHREAD) */
+ #if	defined(XUSER)
+ extern FUNCTYPE xuser();
+ #endif
+ #if	defined(XMOTD)
+ extern	FUNCTYPE xmotd();
+ #endif
+ #if	defined(XOVERVIEW)
+ extern	FUNCTYPE xoverview();
+ #endif
+ #if	defined(XINDEX)
+ extern	FUNCTYPE xindex();
+ #endif
@  
@  STATIC char	CMDfetchhelp[] = "[MessageID|Number]";
@  
***************
*** 85,92 ****
--- 98,110 ----
@  	NULL },
@      {	"last",		CMDnextlast,	FALSE,	1,	1,
@  	NULL },
+ #ifdef LISTSUBS
@      {	"list",		CMDlist,	FALSE,	1,	2,
+ 	"[active|newsgroups|distributions|schema|subscriptions]" },
+ #else
+     {	"list",		CMDlist,	FALSE,	1,	2,
@  	"[active|newsgroups|distributions|schema]" },
+ #endif
@      {	"listgroup",	CMDgroup,	FALSE,	1,	2,
@  	"newsgroup" },
@      {	"mode",		CMDmode,	FALSE,	2,	2,
***************
*** 117,122 ****
--- 135,156 ----
@      {	"xthread",	CMDxthread,	FALSE,	1,	2,
@  	"[dbinit|thread]" },
@  #endif	/* defined(DO_DO_XTHREAD) */
+ #if	defined(XUSER)
+     {	"xuser",	xuser,		FALSE,	2,	CMDany,
+ 	"<user info>" },
+ #endif
+ #if	defined(XMOTD)
+     {	"xmotd",	xmotd,		FALSE,	3,	4,
+ 	"yymmdd hhmmss [GMT]" },
+ #endif
+ #if	defined(XOVERVIEW)
+     {	"xoverview",	xoverview,	FALSE,	1,	2,
+ 	"newsgroup" },
+ #endif
+ #if	defined(XINDEX)
+     {	"xindex",	xindex,		FALSE,	1,	2,
+ 	"newsgroup" },
+ #endif
@      {	NULL }
@  };
@  
@//E*O*F tin119.nnrpd-nnrpd.c.pch//
chmod u=rw,g=r,o=r tin119.nnrpd-nnrpd.c.pch
 
echo x - dtol.c
sed 's/^@//' > "dtol.c" <<'@//E*O*F dtol.c//'
#include "common.h"
/* XMOTD used dtol().  This cludge uses INN's NNTPtoGMT function to turn */
/* the string into a long. DMS */
long dtol(nntp_date)
char *nntp_date;
{
char yymmdd[7];
char hhmmss[7];
strncpy(yymmdd,nntp_date,6);
strncpy(hhmmss,nntp_date+6,6);
yymmdd[6] = 0;
hhmmss[6] = 0;
return (NNTPtoGMT(yymmdd,hhmmss));
}
@//E*O*F dtol.c//
chmod u=rw,g=r,o=r dtol.c
 
echo x - common.h
sed 's/^@//' > "common.h" <<'@//E*O*F common.h//'
/* this file takes the place of the reference NNTP implementation's common.h */
/* It allows the tin routines to compile clean with no changes for INN. */
#include "tininn.h"
#include "nnrpd.h"
#define hostname ClientHost
/* since INN requires a syslog, we'll define it here */
#define SYSLOG
#define SPOOLDIR	_PATH_SPOOL
#define ERR_CMDSYN	NNTP_SYNTAX_VAL	/* command syntax error */
/* these routines come from the NNTP distribution, but have INN analogues */
#define	putline(s)	fputs((s), stdout); putchar('\r'); putchar('\n');
#define local_to_gmt LOCALtoGMT
@//E*O*F common.h//
chmod u=rw,g=r,o=r common.h
 
echo x - tininn.h
sed 's/^@//' > "tininn.h" <<'@//E*O*F tininn.h//'
/* this file contains information required to be incorporated into nnrpd */
/* this is a degenerate command IMHO.  Some may have clients that use it -DMS */
#define XOVERVIEW 		/* retieve .overview index files from server */
#define XINDEX			/* retieve tin index files from server       */
#define XMOTD			/* retieve message of the day from server    */
#define XUSER			/* log clients username to nntp logfile      */
#define LISTSUBS		/* list subscriptions extension */

#define XINDEX_DIR		"/usr/spool/news/.index"
#define XMOTD_FILE		"/usr/lib/news/motd"
#define SUBSCRIPTIONS_FILE	"/usr/lib/news/subscriptions"

#ifdef XMOTD
#define	OK_XMOTD	217	/* Motd (message of the day) file follows */
#endif
#ifdef XINDEX
#define	OK_XINDEX	218	/* Tin style group index file follows */
#endif
#ifdef XOVERVIEW
#define	OK_XOVERVIEW	219	/* .overview style group index file follows */
#endif
#ifdef XMOTD
#define	ERR_XMOTD	417	/* No motd (message of the day) file */
#endif
#ifdef XINDEX
#define	ERR_XINDEX	418	/* No tin style index file for newsgroup */
#endif
#ifdef XOVERVIEW
#define	ERR_XOVERVIEW	419	/* No .overview style index file for newsgroup */
#endif
@//E*O*F tininn.h//
chmod u=rw,g=r,o= tininn.h
 
exit 0
-- 
Doug Sewell, Tech Support, Computer Center, Youngstown State University
doug@cc.ysu.edu	   doug@ysub.bitnet	<internet>!cc.ysu.edu!doug

uuencode bunny.dropping < core | mail jp@tygra.michigan.com
Technical Details
Message-ID: <C4nq2x.BJs@news.ysu.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!wupost!uwm.edu!zaphod.mps.ohio-state.edu!malgudi.oar.net!news.ysu.edu!doug

Show Full Headers
Complete Article Headers
Message-ID: <C4nq2x.BJs@news.ysu.edu>
Subject: Patches: tin 1.1pl9 + inn1.4
Date: Mon, 29 Mar 1993 15:37:44 GMT
From: doug@cc.ysu.edu (Doug Sewell)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!wupost!uwm.edu!zaphod.mps.ohio-state.edu!malgudi.oar.net!news.ysu.edu!doug
Newsgroups: news.software.nntp,news.software.readers,alt.sources
Followup-To: news.software.nntp,news.software.readers
Summary: adds tin 1.1pl9 NNTP extensions to INN 1.4.
Keywords: tin inn xuser xmotd xindex xoverview list subscriptions
Sender: news@news.ysu.edu (Usenet News Admin)
Nntp-Posting-Host: unix1.cc.ysu.edu
Organization: Youngstown State/Youngstown Free-Net
X-Newsreader: TIN [version 1.1 PL8]
Archive-Name: tin119-inn14-extensions-v1.0
Lines: 411