INN commit: trunk/nnrpd (nnrpd.c nnrpd.h)
INN Commit
Russ_Allbery at isc.org
Sat Aug 23 17:35:35 UTC 2008
Date: Saturday, August 23, 2008 @ 10:35:35
Author: iulius
Revision: 7955
Add the QUIT command to the list of available commands :-)
Also fix a bug causing "QUIT other_argument" to be recognized as QUIT
whereas nnrpd must then send a 501 error code.
Modified:
trunk/nnrpd/nnrpd.c
trunk/nnrpd/nnrpd.h
---------+
nnrpd.c | 26 +++++++++++++++++++++-----
nnrpd.h | 1 +
2 files changed, 22 insertions(+), 5 deletions(-)
Modified: nnrpd.c
===================================================================
--- nnrpd.c 2008-08-23 13:45:17 UTC (rev 7954)
+++ nnrpd.c 2008-08-23 17:35:35 UTC (rev 7955)
@@ -100,6 +100,8 @@
static char CMDfetchhelp[] = "[MessageID|Number]";
+/* { command base name, function to call, need authentication,
+ min args, max args, help string } */
static CMDENT CMDtable[] = {
{ "authinfo", CMDauthinfo, false, 3, CMDany,
"user Name|pass Password"
@@ -141,6 +143,8 @@
NULL },
{ "post", CMDpost, true, 1, 1,
NULL },
+ { "quit", CMDquit, false, 1, 1,
+ NULL },
/* SLAVE (which was ill-defined in RFC 977) was removed from the NNTP
protocol in RFC 3977. */
{ "slave", CMD_unimp, false, 1, 1,
@@ -324,6 +328,17 @@
/*
+** The "quit" command.
+*/
+void
+CMDquit(int ac UNUSED, char *av[] UNUSED)
+{
+ Reply("%s\r\n", NNTP_GOODBYE_ACK);
+ ExitWithStats(0, false);
+}
+
+
+/*
** Convert an address to a hostname. Don't trust the reverse lookup since
** since anyone can fake reverse DNS entries.
*/
@@ -1112,7 +1127,7 @@
/* Client gone? */
if (r == RTeof)
break;
- if (ac == 0 || strcasecmp(av[0], "quit") == 0)
+ if (ac == 0)
break;
/* Find command. */
@@ -1143,8 +1158,10 @@
continue;
}
setproctitle("%s %s", Client.host, av[0]);
- (*cp->Function)(ac, av);
- if (PushedBack)
+
+ (*cp->Function)(ac, av);
+
+ if (PushedBack)
break;
if (PERMaccessconf)
clienttimeout = PERMaccessconf->clienttimeout;
@@ -1152,9 +1169,8 @@
clienttimeout = innconf->clienttimeout;
}
- Reply("%s\r\n", NNTP_GOODBYE_ACK);
+ CMDquit(ac, av);
- ExitWithStats(0, false);
/* NOTREACHED */
return 1;
}
Modified: nnrpd.h
===================================================================
--- nnrpd.h 2008-08-23 13:45:17 UTC (rev 7954)
+++ nnrpd.h 2008-08-23 17:35:35 UTC (rev 7955)
@@ -243,6 +243,7 @@
extern void CMDnewnews (int ac, char** av);
extern void CMDnextlast (int ac, char** av);
extern void CMDpost (int ac, char** av);
+extern void CMDquit (int ac, char** av);
extern void CMDxgtitle (int ac, char** av);
extern void CMDxover (int ac, char** av);
extern void CMDpat (int ac, char** av);
More information about the inn-committers
mailing list