Article View: news.software.nntp
Article #80Access control via wildcard domain name
From: Eric S. Johnson
Date: Mon, 19 Sep 1988 16:11
Date: Mon, 19 Sep 1988 16:11
87 lines
2823 bytes
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
Technical Details
Message-ID:
<18278@uflorida.cis.ufl.EDU>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!mailrus!uflorida!banana.cis.ufl.edu!esjShow Full Headers
Complete Article Headers
Message-ID: <18278@uflorida.cis.ufl.EDU> Subject: Access control via wildcard domain name Date: Mon, 19 Sep 1988 16:11:35 +0000 From: esj@banana.cis.ufl.edu (Eric S. Johnson) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!mailrus!uflorida!banana.cis.ufl.edu!esj Newsgroups: news.software.nntp Sender: news@uflorida.cis.ufl.EDU Reply-To: esj@banana.cis.ufl.edu (Eric S. Johnson) Organization: UF CIS Department Lines: 85