🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #15225

Fix for hosts.nntp.nolimit

#15225
From: Julio Sanchez
Date: Fri, 21 Feb 1997 00:00
43 lines
2087 bytes

I gotta be missing something, but has anyone ever tried lowering
parameter i and defining exceptions in hosts.nntp.nolimit?

Did it work?  As far as I can see from the code, the call to RCnolimit
to check if the host is in the exception list happens before the
cp->Address field is set.  Quick and dirty fix follows (calling get
getpeername is ugly, because we got the address at the accept, only
that passing it to CHANcreate requires changing the interfaces and
that should be done by someone else):

diff -u ../innd.orig/nc.c ./nc.c
--- ../innd.orig/nc.c	Tue Dec 17 15:40:40 1996
+++ ./nc.c	Fri Feb 21 13:33:46 1997
@@ -1386,6 +1386,8 @@
 {
     register CHANNEL	*cp;
     int			i;
+    struct sockaddr_in  wherefrom;
+    int			wherefroml;
 
     /* Create the channel. */
     cp = CHANcreate(fd, CTnntp, MustAuthorize ? CSgetauth : CSgetcmd,
@@ -1427,6 +1429,10 @@
 	NCwriteshutdown(cp, RejectReason);
 	return cp;
     }
+
+    wherefroml = sizeof wherefrom;
+    getpeername(cp->fd, (struct sockaddr *)&wherefrom, &wherefroml);
+    cp->Address = wherefrom.sin_addr;
 
     /* See if we have too many channels. */
     if (!IsLocal && MaxIncoming && NCcount >= MaxIncoming && !RCnolimit(cp)) {

-- 
Julio Sanchez, SGI Soluciones Globales Internet
Tel: (91) 804 28 37 Fax: (91) 804 14 05  WWW: http://www.esegi.es
jsanchez@esegi.es jsanchez@gmv.es
 PGP Key fingerprint =  E5 29 93 6F 41 4E 00 E2  90 11 A1 8C 72 D0 DE 71 

Technical Details
Message-ID: <x0hgj6timj.fsf@pcjjsf.gmv.es>
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: <x0hgj6timj.fsf@pcjjsf.gmv.es>
Subject: Fix for hosts.nntp.nolimit
Date: Fri, 21 Feb 1997 00:00:00 +0000
From: Julio Sanchez <jsanchez@esegi.es>
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: 220404115
Sender: jjsf@pcjjsf.gmv.es
Content-Type: text/plain; charset=US-ASCII
Organization: GMV, SA., Tres Cantos, Spain
Mime-Version: 1.0 (generated by tm-edit 7.92)
Newsgroups: news.software.nntp