Thread View: news.software.nntp
2 messages
2 total messages
Started by Dick Chimenti
Fri, 28 Feb 1997 00:00
nnrp.access problem
Author: Dick Chimenti
Date: Fri, 28 Feb 1997 00:00
Date: Fri, 28 Feb 1997 00:00
29 lines
1534 bytes
1534 bytes
I'd like to be able to restrict readers outside a particular domain to read-only for certain newsgroups. I've tinkered with nnrp.access but, as yet, have not been successful. I have the following nnrp.access entries: *.foo.edu:R P:::*,!foo.bar.* *.foo.edu:R:::foo.bar.* *.special.foo.edu:R P:::* I want those machines in the special.foo.edu domain to have read-write access to everything. Everyone in the remaining foo.edu domains should have read-write access to everything except the foo.bar.* newsgroups for which they only have read permission. These entries work fine for the special.foo.edu guys but everyone else is locked out of everything except foo.bar.* where they can read only. The explanation appears to be that the last successful match for someone in the regular.foo.edu domain is entry two so that's the only rule that applies. Is there a way to do this? I'm running inn1.4unoff4. TNX. -dick
Re: nnrp.access problem
Author: 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);
}
}
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