INN commit: trunk/nnrpd (commands.c group.c)
INN Commit
Russ_Allbery at isc.org
Tue Sep 16 18:52:15 UTC 2008
Date: Tuesday, September 16, 2008 @ 11:52:14
Author: iulius
Revision: 8026
GROUP and LISTGROUP bug-fixes:
* answer 501 instead of 502 when the syntax of the command is not good;
* send 502 instead of 480 when already authenticated.
Modified:
trunk/nnrpd/commands.c
trunk/nnrpd/group.c
------------+
commands.c | 2 +-
group.c | 32 ++++++++++++++++++--------------
2 files changed, 19 insertions(+), 15 deletions(-)
Modified: commands.c
===================================================================
--- commands.c 2008-09-13 15:29:35 UTC (rev 8025)
+++ commands.c 2008-09-16 18:52:14 UTC (rev 8026)
@@ -120,7 +120,7 @@
execv(path, av);
/* RFC 2980 requires 500 if there are unspecified errors during
* the execution of the provided program. */
- Reply("%d %s\r\n", NNTP_ERR_COMMAND, "Program error occurred");
+ Reply("%d Program error occurred\r\n", NNTP_ERR_COMMAND);
syslog(L_FATAL, "can't execv %s %m", path);
_exit(1);
Modified: group.c
===================================================================
--- group.c 2008-09-13 15:29:35 UTC (rev 8025)
+++ group.c 2008-09-16 18:52:14 UTC (rev 8026)
@@ -34,14 +34,6 @@
hookpresent = PY_use_dynamic;
#endif /* DO_PYTHON */
- if (!hookpresent && !PERMcanread) {
- if (PERMspecified)
- Reply("%d Permission denied\r\n", NNTP_ERR_ACCESS);
- else
- Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
- return;
- }
-
/* Parse arguments. */
if (ac == 1) {
if (GRPcur == NULL) {
@@ -60,6 +52,15 @@
return;
}
+ /* Check authorizations. */
+ if (!hookpresent && !PERMcanread) {
+ if (PERMspecified)
+ Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+ else
+ Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
+ return;
+ }
+
/* FIXME: Temporarily work around broken API. */
if (!OVgroupstats(group, &low, &high, &count, NULL)) {
Reply("%s %s\r\n", NOSUCHGROUP, group);
@@ -73,7 +74,7 @@
if (PY_use_dynamic) {
char *reply;
- /* Authorize user using Python module method dynamic*/
+ /* Authorize user using Python module method dynamic. */
if (PY_dynamic(PERMuser, group, false, &reply) < 0) {
syslog(L_NOTICE, "PY_dynamic(): authorization skipped due to no Python dynamic method defined.");
} else {
@@ -93,12 +94,15 @@
grplist[0] = group;
grplist[1] = NULL;
if (!PERMmatch(PERMreadlist, grplist)) {
- Reply("%d Permission denied\r\n", NNTP_ERR_ACCESS);
+ Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
free(group);
return;
}
} else {
- Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
+ if (PERMcanauthenticate)
+ Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
+ else
+ Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
free(group);
return;
}
@@ -115,7 +119,7 @@
ARTlow = 1;
Reply("%d 0 %lu %lu %s\r\n", NNTP_OK_GROUP, ARTlow, ARTlow-1, group);
} else {
- /* if we are an NFS reader, check the last nfsreaderdelay
+ /* If we are an NFS reader, check the last nfsreaderdelay
* articles in the group to see if they arrived in the
* last nfsreaderdelay (default 60) seconds. If they did,
* don't report them as we don't want them to appear too
@@ -268,7 +272,7 @@
p = av[1];
if (!PERMspecified) {
- Printf("%d list follows\r\n", NNTP_OK_XGTITLE);
+ Printf("%d No descriptions follow\r\n", NNTP_OK_XGTITLE);
Printf(".\r\n");
return;
}
@@ -279,7 +283,7 @@
Printf("%d Can't open %s\r\n", NNTP_FAIL_XGTITLE, NEWSGROUPS);
return;
}
- Printf("%d list follows\r\n", NNTP_OK_XGTITLE);
+ Printf("%d Descriptions in form \"group description\"\r\n", NNTP_OK_XGTITLE);
/* Print all lines with matching newsgroup name. */
while ((line = QIOread(qp)) != NULL) {
More information about the inn-committers
mailing list