Article View: news.software.nntp
Article #15461Re: nnrp.access problem
From: Jan Rychter
Date: Sun, 02 Mar 1997 00:00
Date: Sun, 02 Mar 1997 00:00
184 lines
6175 bytes
6175 bytes
>>>>> "Dick" == Dick Chimenti <chimenti@vacuum.stl.ibm.com> writes:
Dick> I'd like to be able to restrict readers outside a particular
Dick> domain to read-only for certain newsgroups. I've tinkered with
Dick> nnrp.access but, as yet, have not been successful.
Perhaps this will help you. I've had a similar problem, I wanted to
restrict access for certain domains so that people be able to read all
newsgroups, but only post to pl.* groups. I had to modify nnrpd, patch
against inn1.5.1 enclosed below.
The patch lets me specify: (for example)
*.somedomain.com:Read Post Conditional:::*,&pl.*,!alt.*
which means that people from somedomain.com will be able to read
everything except alt.*, but post only to pl.*.
If you take this approach and fiddle with the order of entries in
nnrp.access, I believe it will get you what you want.
good luck,
--Jan.
diff -ur nnrpd-1.5-original/commands.c nnrpd/commands.c
--- nnrpd-1.5-original/commands.c Tue Dec 17 15:40:40 1996
+++ nnrpd/commands.c Sun Dec 22 14:12:03 1996
@@ -170,6 +170,7 @@
PERMcanread = strchr(fields[1], 'R') != NULL;
PERMcanpost = strchr(fields[1], 'P') != NULL;
+ PERMcondpost = strchr(fields[1], 'C') != NULL;
sprintf(PERMuser, "%s@%s", fields[2], fields[0]);
(void)strcpy(PERMpass, fields[3]);
(void)strcpy(accesslist, fields[4]);
@@ -402,7 +403,7 @@
if (PERMspecified) {
grplist[0] = p;
- if (!PERMmatch(PERMdefault, PERMlist, grplist))
+ if (!PERMmatch(PERMdefault, PERMlist, grplist, 0))
continue;
}
if (wildarg && !wildmat(p, wildarg))
@@ -510,7 +511,7 @@
if (PERMspecified) {
grplist[0] = p;
grplist[1] = NULL;
- if (!PERMmatch(PERMdefault, PERMlist, grplist))
+ if (!PERMmatch(PERMdefault, PERMlist, grplist, 0))
continue;
}
else if (!PERMdefault)
diff -ur nnrpd-1.5-original/group.c nnrpd/group.c
--- nnrpd-1.5-original/group.c Tue Dec 17 15:40:40 1996
+++ nnrpd/group.c Sun Dec 22 14:12:03 1996
@@ -296,7 +296,7 @@
if (PERMspecified) {
grplist[0] = group;
grplist[1] = NULL;
- if (!PERMmatch(PERMdefault, PERMlist, grplist)) {
+ if (!PERMmatch(PERMdefault, PERMlist, grplist, 0)) {
Reply("%s\r\n", NOSUCHGROUP);
return;
}
diff -ur nnrpd-1.5-original/misc.c nnrpd/misc.c
--- nnrpd-1.5-original/misc.c Tue Dec 17 15:40:40 1996
+++ nnrpd/misc.c Sun Dec 22 14:13:21 1996
@@ -94,10 +94,11 @@
** func is called to see if there is a match.
*/
BOOL
-PERMmatch(match, Pats, list)
+PERMmatch(match, Pats, list, post)
register BOOL match;
char **Pats;
char **list;
+ BOOL post;
{
register int i;
register char *p;
@@ -105,21 +106,29 @@
if (Pats[0] == NULL)
return TRUE;
- for ( ; *list; list++) {
+ match = FALSE;
+
+ for ( ; *list; list++)
for (i = 0; (p = Pats[i]) != NULL; i++) {
if (p[0] == '!') {
if (wildmat(*list, ++p))
match = FALSE;
}
- else if (wildmat(*list, p))
- match = TRUE;
+ else {
+ if(post && PERMcondpost) {
+ if (p[0] == '&') {
+ if (wildmat(*list, ++p))
+ match = TRUE;
+ }
+ else if (wildmat(*list, p))
+ match = FALSE;
+ }
+ else if (wildmat(*list, p))
+ match = TRUE;
+ }
}
- if (match)
- /* If we can read it in one group, we can read it, period. */
- return TRUE;
- }
- return FALSE;
+ return match;
}
@@ -166,7 +175,7 @@
/* No newgroups or null entry. */
return 1;
- return PERMmatch(PERMdefault, PERMlist, grplist);
+ return PERMmatch(PERMdefault, PERMlist, grplist, 0);
}
diff -ur nnrpd-1.5-original/newnews.c nnrpd/newnews.c
--- nnrpd-1.5-original/newnews.c Tue Dec 17 15:40:40 1996
+++ nnrpd/newnews.c Sun Dec 22 14:12:03 1996
@@ -271,7 +271,7 @@
continue;
/* Check permissions. */
- if (!AllGroups && !PERMmatch(FALSE, groups, files))
+ if (!AllGroups && !PERMmatch(FALSE, groups, files, 0))
continue;
if (!AllDists && !DistMatches(distribs, files))
continue;
diff -ur nnrpd-1.5-original/nnrpd.c nnrpd/nnrpd.c
--- nnrpd-1.5-original/nnrpd.c Tue Dec 17 15:40:40 1996
+++ nnrpd/nnrpd.c Sun Dec 22 14:14:14 1996
@@ -326,6 +326,7 @@
PERMcanread = FALSE;
PERMcanpost = FALSE;
+ PERMcondpost = FALSE;
found = FALSE;
accesslist[0] = '\0';
while (fgets(buff, sizeof buff, F) != NULL) {
@@ -365,6 +366,7 @@
PERMcanread = strchr(fields[1], 'R') != NULL;
PERMcanpost = strchr(fields[1], 'P') != NULL;
+ PERMcondpost = strchr(fields[1], 'C') != NULL;
(void)strcpy(PERMuser, user ? user : fields[2]);
(void)strcpy(PERMpass, pass ? pass : fields[3]);
(void)strcpy(accesslist, fields[4]);
diff -ur nnrpd-1.5-original/nnrpd.h nnrpd/nnrpd.h
--- nnrpd-1.5-original/nnrpd.h Tue Dec 17 15:40:40 1996
+++ nnrpd/nnrpd.h Sun Dec 22 14:12:04 1996
@@ -85,6 +85,7 @@
EXTERN BOOL PERMauthorized;
EXTERN BOOL PERMcanpost;
+EXTERN BOOL PERMcondpost;
EXTERN BOOL PERMcanread;
EXTERN BOOL PERMneedauth;
EXTERN BOOL PERMspecified;
diff -ur nnrpd-1.5-original/post.c nnrpd/post.c
--- nnrpd-1.5-original/post.c Tue Dec 17 15:40:40 1996
+++ nnrpd/post.c Sun Dec 22 14:12:04 1996
@@ -616,7 +616,7 @@
if (PERMspecified) {
grplist[0] = p;
grplist[1] = NULL;
- if (!PERMmatch(PERMdefault, PERMlist, grplist)) {
+ if (!PERMmatch(PERMdefault, PERMlist, grplist, 1)) {
sprintf(Error,"%s: %s\r\n", NNTP_NOSUCHGROUP,p);
}
}
Technical Details
Message-ID:
<wsw7mjq167u.fsf@icm.edu.pl>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-mailReferences:
<5f7n6r$jb6@sjnews.sanjose.ibm.com>Show Full Headers
Complete Article Headers
Message-ID: <wsw7mjq167u.fsf@icm.edu.pl> Subject: Re: nnrp.access problem Date: Sun, 02 Mar 1997 00:00:00 +0000 From: Jan Rychter <jwr@icm.edu.pl> References: <5f7n6r$jb6@sjnews.sanjose.ibm.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 X-Deja-AN: 222570377 X-Operating-System: SunOS 5.5 Generic Sender: jwr@krzak Organization: Interdyscyplinarne Centrum Modelowania Newsgroups: news.software.nntp