🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Eric S. Johnson Mon, 19 Sep 1988 16:11
Access control via wildcard domain name
#80
Author: Eric S. Johnson
Date: Mon, 19 Sep 1988 16:11
87 lines
2823 bytes

Here is a liitle hack I put together to allow the nntp access
to be controled by wildcard domain names. 

A number of different departments on our campus read news off of one
machine (ours). I got REAL tired of having to modify the nntp_access file
every time someone on campus bought a machine.  Access control via
subnets made this a little easier, but many of our physical subnets have
machines from different departments on them. Access control by domain
name was what I needed.

The following diff allows you to put lines like:

*.cis.ufl.edu		read	post
*.math.cis.ufl.edu	read	post	!alt
*.ufnet.ufl.edu		read	post
*.circa.ufl.edu		read	post	!alt,!talk,!soc,!rec,!misc
*.ufl.edu		read	no
default			xfer	no

in your access file. 

The feature is enabled by defining DOMAINWILD in common/conf.h
The following patch is for server/access.c. NNTP version 1.5

Your gethostbyaddr routine on the server will need to 
return full domain names, and you will need to have PTR
records in your nameserver for all the hosts. (but you
should anyway eh?)


Enjoy,
Eric Johnson
<esj@ufl.edu>

*** access.c.orig	Thu Sep 15 16:29:10 1988
--- access.c	Thu Sep 15 16:08:40 1988
***************
*** 174,180 ****
--- 174,184 ----
  			groups[0] = '\0';	/* No groups specified */
  		}
  
+ #ifdef DOMAINWILD
+ 		if (wildhostmatch(hostornet,host_name)) {
+ #else
  		if (!strcasecmp(hostornet, host_name)) {
+ #endif
  			*canread = (readperm[0] == 'r' || readperm[0] == 'R');
  			*canxfer = (*canread || readperm[0] == 'X'
  					     || readperm[0] == 'x');
***************
*** 205,207 ****
--- 209,242 ----
  
  	(void) fclose(acs_fp);
  }
+ 
+ 
+ 
+ #ifdef DOMAINWILD
+ 
+ wildhostmatch(hostwild,hostname)
+ char *hostwild,*hostname;
+ {
+ 	char *i;
+ 	int dlen;
+ 
+ 	if (!strcasecmp(hostwild,hostname)) 
+ 		return (1);
+ 
+ 	if (*hostwild++ != '*')
+ 		return (0);
+ 	if (*hostwild++ != '.' )
+ 		return (0);
+ 
+ 	dlen = strlen(hostwild);
+ 
+ 	hostname += (strlen(hostname)-strlen(hostwild));
+ 
+ 	if (!strcasecmp(hostwild,hostname)) 
+ 		return (1);
+ 
+ 	return (0);
+ }
+ #endif DOMAINWILD
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