🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #22984

[INND] blocking incoming articles based on newsgroups line

#22984
From: Aidan Cully [Staff]
Date: Wed, 05 Nov 1997 00:00
180 lines
6054 bytes
This is a patch which modifies the format of hosts.nntp so that in
addition to ignoring newsgroups that don't have explicit posting
permission, an article can be rejected outright if the newsgroups
intersect a certain hierarchy.  IOW, say we had the following
hosts.nntp line:
news.foo.com::*,!net.*
Then a message posted to the following newsgroups
misc.test,net.test
from news.foo.com would locally show up in misc.test, but not net.test.
We would then send this article on to other 2senet sites which would
know us as a sound site and put this article in both misc.test and
net.test (or if they only want to receive net.* articles from us, just
net.test), making us unsound.

After applying this patch, the following hosts.nntp line is legal,
and does what we want (reject the article outright):
news.foo.com::*,@net.*

We're also posting this on our News Gizmo page, which will identify
users and track (across connections) post information from them,
allowing blockers to load per-user blocking configuration and filter
posts using this information (e.g., make it illegal for everyone
but moderators and trusted users to post more than 50 messages/day).
We think everyone should run this as well..  The URL is
<http://www.panix.com/gizmo/>

This patch is against inn-1.5.1, but we installed it with no fuss
into our lightly patched inn setup, and we'll make available an
inn-1.7 version Real Soon Now.  FWIW, I don't foresee any problems
sticking this patch into 1.7, but we haven't even looked at 1.7 yet.
Enjoy.

--aidan

--8<--8<--cut here--8<--8<--
*** ../inn-1.5.1-orig/innd/art.c	Tue Dec 17 09:40:40 1996
--- innd/art.c	Tue Nov  4 19:47:08 1997
***************
*** 1738,1743 ****
--- 1738,1744 ----
      char		ControlWord[SMBUF];
      int			ControlHeader;
      int			oerrno;
+     int 		canpost;
  #if defined(DO_PERL)
      char		*perlrc;
  #endif /* DO_PERL */
***************
*** 1957,1964 ****
      ngptr = GroupPointers;
      j = 0;
      for (GroupMissing = Accepted = FALSE; (p = *groups) != NULL; groups++) {
! 	if (!RCcanpost(cp, p))
  	    continue;
  	if ((ngp = NGfind(p)) == NULL) {
  	    GroupMissing = TRUE;
  	    if (LikeNewgroup && Approved) {
--- 1958,1980 ----
      ngptr = GroupPointers;
      j = 0;
      for (GroupMissing = Accepted = FALSE; (p = *groups) != NULL; groups++) {
!         canpost = RCcanpost(cp, p);
! 	if (!canpost)
  	    continue;
+ 	else if (canpost < 0) {
+ 	    (void)sprintf(buff, "%d Won't accept posts in \"%s\"",
+ 	        NNTP_REJECTIT_VAL, p);
+ 	    ARTlog(&Data, ART_REJECT, buff);
+ #if	defined(DO_REMEMBER_TRASH)
+             if (Mode == OMrunning && !HISwrite(&Data, ""))
+                 syslog(L_ERROR, "%s cant write history %s %m",
+                        LogName, Data.MessageID);
+ #endif	/* defined(DO_REMEMBER_TRASH) */
+ 	    if (distributions)
+ 		DISPOSE(distributions);
+ 	    ARTreject(buff, article);
+ 	    return buff;
+ 	}
  	if ((ngp = NGfind(p)) == NULL) {
  	    GroupMissing = TRUE;
  	    if (LikeNewgroup && Approved) {
*** ../inn-1.5.1-orig/innd/rc.c	Tue Dec 17 09:40:40 1996
--- innd/rc.c	Tue Nov  4 19:43:10 1997
***************
*** 575,588 ****
  /*
  **  Is the remote site allowed to post to this group?
  */
! BOOL
  RCcanpost(cp, group)
      register CHANNEL	*cp;
      register char	*group;
  {
      register REMOTEHOST	*rp;
!     register BOOL	match;
!     register BOOL	subvalue;
      register char	**argv;
      register char	*pat;
      register int	i;
--- 575,588 ----
  /*
  **  Is the remote site allowed to post to this group?
  */
! int
  RCcanpost(cp, group)
      register CHANNEL	*cp;
      register char	*group;
  {
      register REMOTEHOST	*rp;
!     register char	match;
!     register char	subvalue;
      register char	**argv;
      register char	*pat;
      register int	i;
***************
*** 593,608 ****
  	    continue;
  	if (rp->Patterns == NULL)
  	    break;
! 	for (match = TRUE, argv = rp->Patterns; (pat = *argv++) != NULL; ) {
! 	    subvalue = *pat != SUB_NEGATE;
! 	    if (!subvalue)
  		pat++;
! 	    if ((match != subvalue) && wildmat(group, pat))
  		match = subvalue;
  	}
! 	return match;
      }
!     return TRUE;
  }
  
  
--- 593,612 ----
  	    continue;
  	if (rp->Patterns == NULL)
  	    break;
! 	for (match = -1, argv = rp->Patterns; (pat = *argv++) != NULL; ) {
! 	    subvalue = (*pat != SUB_NEGATE) && (*pat != SUB_POISON) ?
! 	      0 : *pat;
! 	    if (subvalue)
  		pat++;
! 	    if ((match != subvalue) && wildmat(group, pat)) {
! 		if (subvalue == SUB_POISON)
! 		    return -1;
  		match = subvalue;
+ 	    }
  	}
! 	return !match;
      }
!     return 1;
  }
  
  
*** ../inn-1.5.1-orig/innd/innd.h	Tue Dec 17 09:40:40 1996
--- innd/innd.h	Wed Oct 22 18:07:18 1997
***************
*** 537,543 ****
  
  extern BOOL		RCnolimit();
  extern BOOL		RCauthorized();
! extern BOOL		RCcanpost();
  extern char		*RChostname();
  extern int		RCismaster();
  extern void		RCclose();
--- 537,543 ----
  
  extern BOOL		RCnolimit();
  extern BOOL		RCauthorized();
! extern int		RCcanpost();
  extern char		*RChostname();
  extern int		RCismaster();
  extern void		RCclose();
-->8-->8--end here-->8-->8--
-- 
Aidan Cully       "I'd rather have a bottle in front of me than a frontal
Panix Staff        lobotomy"
aidan@panix.com      --Tom Waits

Technical Details
Message-ID: <63qrig$ci8@panix4.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <63qrig$ci8@panix4.panix.com>
Subject: [INND] blocking incoming articles based on newsgroups line
Date: Wed, 05 Nov 1997 00:00:00 +0000
From: aidan@panix.com (Aidan Cully [Staff])
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 287258086
Distribution: inet
Organization: Panix
Newsgroups: news.software.nntp
X-Newsposter: Pnews 4.0-test50 (13 Dec 96)