INN commit: trunk/nnrpd (newnews.c)
INN Commit
Russ_Allbery at isc.org
Wed Sep 17 19:12:36 UTC 2008
Date: Wednesday, September 17, 2008 @ 12:12:35
Author: iulius
Revision: 8030
Return 501 instead of 502 when the syntax of NEWNEWS is wrong and
the user cannot use NEWNEWS.
Modified:
trunk/nnrpd/newnews.c
-----------+
newnews.c | 64 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 35 insertions(+), 29 deletions(-)
Modified: newnews.c
===================================================================
--- newnews.c 2008-09-16 20:02:14 UTC (rev 8029)
+++ newnews.c 2008-09-17 19:12:35 UTC (rev 8030)
@@ -213,7 +213,7 @@
/*
** NEWNEWS wildmat date time [GMT]
-** Return the Message-ID of any articles after the specified date.
+** Return the message-ID of any articles after the specified date.
*/
void
CMDnewnews(int ac, char *av[])
@@ -227,44 +227,19 @@
int i;
bool local = true;
- if (!PERMaccessconf->allownewnews) {
- Reply("%d NEWNEWS command disabled by administrator\r\n", NNTP_ERR_ACCESS);
- return;
- }
+ TMRstart(TMR_NEWNEWS);
- if (!PERMcanread) {
- Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
- return;
- }
-
- /* Make other processes happier if someone uses NEWNEWS. */
- if (innconf->nicenewnews > 0) {
- nice(innconf->nicenewnews);
- innconf->nicenewnews = 0;
- }
-
+ /* Check the arguments and parse the date. */
if (ac > 4) {
if (strcasecmp(av[4], "GMT") == 0)
local = false;
else {
Reply("%d Syntax error for \"GMT\"\r\n", NNTP_ERR_SYNTAX);
+ TMRstop(TMR_NEWNEWS);
return;
}
}
- snprintf(line, sizeof(line), "%s %s %s %s", av[1], av[2], av[3],
- local ? "local" : "GMT");
- notice("%s newnews %s", Client.host, line);
-
- TMRstart(TMR_NEWNEWS);
- /* Optimization in case client asks for !* (no groups). */
- if (strcmp(av[1], "!*") == 0) {
- Reply("%d No new news\r\n", NNTP_OK_NEWNEWS);
- Printf(".\r\n");
- TMRstop(TMR_NEWNEWS);
- return;
- }
-
/* Parse the newsgroups. */
AllGroups = (strcmp(av[1], "*") == 0);
if (!AllGroups && !NGgetlist(&groups, av[1])) {
@@ -281,6 +256,37 @@
return;
}
+ /* Check authorizations. */
+ if (!PERMaccessconf->allownewnews) {
+ Reply("%d NEWNEWS command disabled by administrator\r\n", NNTP_ERR_ACCESS);
+ TMRstop(TMR_NEWNEWS);
+ return;
+ }
+
+ if (!PERMcanread) {
+ Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+ TMRstop(TMR_NEWNEWS);
+ return;
+ }
+
+ snprintf(line, sizeof(line), "%s %s %s %s", av[1], av[2], av[3],
+ local ? "local" : "GMT");
+ notice("%s newnews %s", Client.host, line);
+
+ /* Optimization in case client asks for !* (no groups). */
+ if (strcmp(av[1], "!*") == 0) {
+ Reply("%d No new news\r\n", NNTP_OK_NEWNEWS);
+ Printf(".\r\n");
+ TMRstop(TMR_NEWNEWS);
+ return;
+ }
+
+ /* Make other processes happier if someone uses NEWNEWS. */
+ if (innconf->nicenewnews > 0) {
+ nice(innconf->nicenewnews);
+ innconf->nicenewnews = 0;
+ }
+
if (strcspn(av[1], "\\!*[?]") == strlen(av[1])) {
/* Optimise case -- don't need to scan the active file pattern
* matching. */
More information about the inn-committers
mailing list