🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by Igor Vinokurov Wed, 20 May 1998 00:00
CIDR aware addresses in nnrp.access
#28276
Author: Igor Vinokurov
Date: Wed, 20 May 1998 00:00
9 lines
588 bytes
Hello.

How I can use CIDR addresses in nnrp.access for innd?

-- 
Igor Vinokurov

Re: CIDR aware addresses in nnrp.access
#28271
Author: stare master
Date: Wed, 20 May 1998 00:00
120 lines
4912 bytes
In article <6jue7q$c7s$1@escape.rtsnet.ru>,
Igor Vinokurov  <igor@zynaps.ru> wrote:
>How I can use CIDR addresses in nnrp.access for innd?

=====
From: mskucher@vertex.tor.hookup.net (Murray S. Kucherawy)
Subject: Patch to nnrpd to allow netmasks in nnrp.access
Date: 1996/12/11
Message-ID: <58lljp$92c@vertex.tor.hookup.net>#1/1
Organization: HookUp Communication Corporation, Oakville, Ontario, CANADA
Newsgroups: news.software.nntp

The following patch will allow you to do a netmask in your nnrp.access
file so that you can offer news access to pieces of what are commonly
known as subnetted class Cs.  For example, you can currently do this:

165.154.*:RP:::*,!clari*

...or this:

165.154.1.*:RP:::*,!clari*

...but you can't get any more specific than that with wildcards in any
reasonable fashion.  If you split this network at a bit boundary beyond
24 bits, you start to require multiple lines to do the trick.  With
this patch, you can do this:

165.154.1.0/255.255.255.224:RP:::*,!clari*

...or this:

165.154.1.0/27:RP:::*,!clari*

It's worked for me so far.  Let me know if you have any problems with it.

*** nnrpd.c	1996/11/19 19:59:00	1.2
--- nnrpd.c	1996/12/11 01:03:29
***************
*** 347,357 ****
  	    /* Malformed line. */
  	    continue;
  
! 	if (hp)
  	    /* Got an address; try to match either the IP address or as
  	     * a text hostname. */
  	    if (!(ip && wildmat(ip, fields[0])) && !wildmat(hp, fields[0]))
  		continue;
  
  	/* See if we should lookup a specific user in the passwd file */
  	if (user && pass && EQ(fields[2], "+")) {
--- 347,401 ----
  	    /* Malformed line. */
  	    continue;
  
! 	if (hp) {
  	    /* Got an address; try to match either the IP address or as
  	     * a text hostname. */
+ #if defined(HOOKUP)
+             int ipmatch = FALSE;
+             int hostmatch = FALSE;
+             int netmatch = FALSE;
+ 
+             /* compare IP number and first field */
+             if (ip && wildmat(ip, fields[0]))
+                 ipmatch = TRUE;
+ 
+             /* compare hostname and first field */
+             if (hp && wildmat(hp, fields[0]))
+                 hostmatch = TRUE;
+ 
+             /* try a netmask match */
+             if (ip && (p = strchr(fields[0],'/')) != (char *)NULL) {
+                 int bits;
+                 int c;
+                 struct in_addr ia;
+                 unsigned int mask;
+                 struct in_addr net;
+                 char *q;
+ 
+                 *p = '\0';
+                 mask = inet_addr(p+1);
+                 if (mask == (unsigned int)INADDR_NONE) {
+                     bits = strtoul(p+1,&q,10);
+                     for (c = 0; c <= bits; c++)
+                         mask |= (1 << (32-c));
+                     mask = htonl(mask);
+                 }
+                 ia.s_addr = inet_addr(ip);
+                 net.s_addr = inet_addr(fields[0]);
+                 if (ia.s_addr != (unsigned int)INADDR_NONE &&
+                     net.s_addr != (unsigned int)INADDR_NONE &&
+                     bits > 0 &&
+                     *q == '\0' &&
+                     (ia.s_addr & mask) == (net.s_addr & mask))
+                     netmatch = TRUE;
+             }
+ 	    if (!ipmatch && !hostmatch && !netmatch)
+ 		continue;
+ #else
  	    if (!(ip && wildmat(ip, fields[0])) && !wildmat(hp, fields[0]))
  		continue;
+ #endif
+ 	}
  
  	/* See if we should lookup a specific user in the passwd file */
  	if (user && pass && EQ(fields[2], "+")) {
-- 
Murray S. Kucherawy ====================================== mskucher@hookup.net
Vice-President, Software Services             HookUp Communication Corporation
(905) 847-8000                NIC Handle "MSK"       Oakville, Ontario, CANADA
--        No matter who you vote for, the government always gets in.        --
=====
-- 
fuck, i'm so fucking full of angst i think i'll go read generation x so many
times i have it memorized and it just oozes out of my pores like so much of
the empty pseudophilosphy and religion i willingly embrace and espouse to my
peers and mentors.	- Patrick J. Finerty <zinc@zifi.genetics.utah.edu>

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads