INN commit: trunk/nnrpd (7 files)
INN Commit
Russ_Allbery at isc.org
Wed Aug 27 21:09:21 UTC 2008
Date: Wednesday, August 27, 2008 @ 14:09:21
Author: iulius
Revision: 7979
Use upper case letters for NNTP commands. It is clearer.
Also put "wildmat" instead of "newsgroups" for NEWNEWS and do
not use initial capital letters for arguments in the HELP result.
Modified:
trunk/nnrpd/commands.c
trunk/nnrpd/group.c
trunk/nnrpd/list.c
trunk/nnrpd/newnews.c
trunk/nnrpd/nnrpd.c
trunk/nnrpd/post.c
trunk/nnrpd/sasl.c
------------+
commands.c | 18 ++++++------
group.c | 6 ++--
list.c | 20 ++++++-------
newnews.c | 2 -
nnrpd.c | 87 +++++++++++++++++++++++++++++------------------------------
post.c | 4 +-
sasl.c | 2 -
7 files changed, 70 insertions(+), 69 deletions(-)
Modified: commands.c
===================================================================
--- commands.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ commands.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -173,7 +173,7 @@
char accesslist[BIG_BUFFER];
char errorstr[BIG_BUFFER];
- if (strcasecmp(av[1], "generic") == 0) {
+ if (strcasecmp(av[1], "GENERIC") == 0) {
char *logrec = Glom(av);
strlcpy(PERMuser, "<none>", sizeof(PERMuser));
@@ -202,20 +202,20 @@
}
#ifdef HAVE_SASL
- } else if (strcasecmp(av[1], "sasl") == 0) {
+ } else if (strcasecmp(av[1], "SASL") == 0) {
SASLauth(ac, av);
#endif /* HAVE_SASL */
} else {
/* Each time AUTHINFO USER is used, the new username is cached. */
- if (strcasecmp(av[1], "user") == 0) {
+ if (strcasecmp(av[1], "USER") == 0) {
strlcpy(User, av[2], sizeof(User));
Reply("%d PASS required\r\n", NNTP_CONT_AUTHINFO);
return;
}
/* If it is not AUTHINFO PASS, we do not support the provided subcommand. */
- if (strcasecmp(av[1], "pass") != 0) {
+ if (strcasecmp(av[1], "PASS") != 0) {
Reply("%d bad authinfo param\r\n", NNTP_ERR_COMMAND);
return;
}
@@ -259,7 +259,7 @@
/*
-** The "DATE" command. Useful mainly in conjunction with NEWNEWS.
+** The DATE command. Useful mainly in conjunction with NEWNEWS.
*/
void
CMDdate(int ac UNUSED, char *av[] UNUSED)
@@ -281,13 +281,13 @@
/*
-** Handle the "mode" command.
+** Handle the MODE command.
*/
/* ARGSUSED */
void
CMDmode(int ac UNUSED, char *av[])
{
- if (strcasecmp(av[1], "reader") == 0)
+ if (strcasecmp(av[1], "READER") == 0)
if (PERMcanauthenticate) {
Reply("%d %s InterNetNews NNRP server %s ready (%s).\r\n",
PERMcanpost ? NNTP_OK_BANNER_POST : NNTP_OK_BANNER_NOPOST,
@@ -419,7 +419,7 @@
/*
-** Post an article.
+** Handle the POST and IHAVE commands.
*/
/* ARGSUSED */
void
@@ -440,7 +440,7 @@
static int backoff_inited = false;
bool ihave, permanent;
- ihave = (strcasecmp(av[0], "ihave") == 0);
+ ihave = (strcasecmp(av[0], "IHAVE") == 0);
if (ihave && (!PERMaccessconf->allowihave || !PERMcanpost)) {
syslog(L_NOTICE, "%s noperm ihave without permission", Client.host);
Reply("%s\r\n", NNTP_ACCESS);
Modified: group.c
===================================================================
--- group.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ group.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -102,8 +102,8 @@
ARTclose();
GRPreport();
- /* Doing a "group" command? */
- if (strcasecmp(av[0], "group") == 0) {
+ /* Doing a GROUP command? */
+ if (strcasecmp(av[0], "GROUP") == 0) {
if (count == 0) {
if (ARTlow == 0)
ARTlow = 1;
@@ -159,7 +159,7 @@
} else
GRPcur = xstrdup(group);
} else {
- /* Must be doing a "listgroup" command. We used to just return
+ /* Must be doing a LISTGROUP command. We used to just return
something bland here ("Article list follows"), but reference NNTP
returns the same data as GROUP does and since we have it all
available it shouldn't hurt to return the same thing. */
Modified: list.c
===================================================================
--- list.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ list.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -28,43 +28,43 @@
static void cmd_list_extensions(LISTINFO *lp);
static LISTINFO INFOactive = {
- "active", INN_PATH_ACTIVE, NULL, true, "active newsgroups",
+ "ACTIVE", INN_PATH_ACTIVE, NULL, true, "active newsgroups",
"Newsgroups in form \"group high low flags\""
};
static LISTINFO INFOactivetimes = {
- "active.times", INN_PATH_ACTIVETIMES, NULL, false, "creation times",
+ "ACTIVE.TIMES", INN_PATH_ACTIVETIMES, NULL, false, "creation times",
"Group creations in form \"name time who\""
};
static LISTINFO INFOdistribs = {
- "distributions", INN_PATH_NNRPDIST, NULL, false, "newsgroup distributions",
+ "DISTRIBUTIONS", INN_PATH_NNRPDIST, NULL, false, "newsgroup distributions",
"Distributions in form \"area description\""
};
static LISTINFO INFOsubs = {
- "subscriptions", INN_PATH_NNRPSUBS, NULL, false,
+ "SUBSCRIPTIONS", INN_PATH_NNRPSUBS, NULL, false,
"automatic group subscriptions", "Subscriptions in form \"group\""
};
static LISTINFO INFOdistribpats = {
- "distrib.pats", INN_PATH_DISTPATS, NULL, false, "distribution patterns",
+ "DISTRIB.PATS", INN_PATH_DISTPATS, NULL, false, "distribution patterns",
"Default distributions in form \"weight:pattern:value\""
};
static LISTINFO INFOextensions = {
- "extensions", NULL, cmd_list_extensions, false, "supported extensions",
+ "EXTENSIONS", NULL, cmd_list_extensions, false, "supported extensions",
"Supported NNTP extensions"
};
static LISTINFO INFOgroups = {
- "newsgroups", INN_PATH_NEWSGROUPS, NULL, false, "newsgroup descriptions",
+ "NEWSGROUPS", INN_PATH_NEWSGROUPS, NULL, false, "newsgroup descriptions",
"Descriptions in form \"group description\""
};
static LISTINFO INFOmoderators = {
- "moderators", INN_PATH_MODERATORS, NULL, false, "moderator patterns",
+ "MODERATORS", INN_PATH_MODERATORS, NULL, false, "moderator patterns",
"Newsgroup moderators in form \"group-pattern:mail-address-pattern\""
};
static LISTINFO INFOschema = {
- "overview.fmt", NULL, cmd_list_schema, true, "overview format",
+ "OVERVIEW.FMT", NULL, cmd_list_schema, true, "overview format",
"Order of fields in overview database"
};
static LISTINFO INFOmotd = {
- "motd", INN_PATH_MOTD, NULL, false, "motd",
+ "MOTD", INN_PATH_MOTD, NULL, false, "motd",
"Message of the day text"
};
Modified: newnews.c
===================================================================
--- newnews.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ newnews.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -211,7 +211,7 @@
}
/*
-** NEWNEWS newsgroups date time ["GMT"]
+** NEWNEWS wildmat date time ["GMT"]
** Return the Message-ID of any articles after the specified date
*/
void
Modified: nnrpd.c
===================================================================
--- nnrpd.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ nnrpd.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -3,7 +3,7 @@
** NNTP server for readers (NNRP) for InterNetNews.
**
** This server doesn't do any real load-limiting, except for what has
-** proven empirically necesary (i.e., look at GRPscandir).
+** proven empirically necessary (i.e. look at GRPscandir).
*/
#include "config.h"
@@ -98,67 +98,68 @@
bool PY_use_dynamic = false;
#endif
-static char CMDfetchhelp[] = "[MessageID|Number]";
+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"
+ { "ARTICLE", CMDfetch, true, 1, 2,
+ CMDfetchhelp },
+ { "AUTHINFO", CMDauthinfo, false, 3, CMDany,
+ "USER name|PASS password"
#ifdef HAVE_SASL
- "|sasl <mech> [<init-resp>]"
+ "|SASL mech [init-resp]"
#endif
- "|generic <prog> <args>" },
-#ifdef HAVE_SSL
- { "starttls", CMDstarttls, false, 1, 1,
- NULL },
-#endif
- { "article", CMDfetch, true, 1, 2,
+ "|GENERIC prog args" },
+ { "BODY", CMDfetch, true, 1, 2,
CMDfetchhelp },
- { "body", CMDfetch, true, 1, 2,
- CMDfetchhelp },
- { "date", CMDdate, false, 1, 1,
+ { "DATE", CMDdate, false, 1, 1,
NULL },
- { "group", CMDgroup, true, 2, 2,
+ { "GROUP", CMDgroup, true, 2, 2,
"newsgroup" },
- { "head", CMDfetch, true, 1, 2,
+ { "HEAD", CMDfetch, true, 1, 2,
CMDfetchhelp },
- { "help", CMDhelp, false, 1, 1,
+ { "HELP", CMDhelp, false, 1, 1,
NULL },
- { "ihave", CMDpost, true, 2, 2,
- "MessageID" },
- { "last", CMDnextlast, true, 1, 1,
+ { "IHAVE", CMDpost, true, 2, 2,
+ "messageID" },
+ { "LAST", CMDnextlast, true, 1, 1,
NULL },
- { "list", CMDlist, true, 1, 3,
- "[active [wildmat]|active.times [wildmat]|distrib.pats|distributions|extensions|moderators|motd|newsgroups [wildmat]|overview.fmt|subscriptions]" },
- { "listgroup", CMDgroup, true, 1, 3,
+ { "LIST", CMDlist, true, 1, 3,
+ "[ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS"
+ "|EXTENSIONS|MODERATORS|MOTD|NEWSGROUPS [wildmat]|OVERVIEW.FMT|SUBSCRIPTIONS]" },
+ { "LISTGROUP", CMDgroup, true, 1, 3,
"[newsgroup [range]]" },
- { "mode", CMDmode, false, 2, 2,
- "reader" },
- { "newgroups", CMDnewgroups, true, 3, 4,
+ { "MODE", CMDmode, false, 2, 2,
+ "READER" },
+ { "NEWSGROUPS", CMDnewgroups, true, 3, 4,
"[YY]yymmdd hhmmss [\"GMT\"]" },
- { "newnews", CMDnewnews, true, 4, 5,
- "newsgroups [YY]yymmdd hhmmss [\"GMT\"]" },
- { "next", CMDnextlast, true, 1, 1,
+ { "NEWNEWS", CMDnewnews, true, 4, 5,
+ "wildmat [YY]yymmdd hhmmss [\"GMT\"]" },
+ { "NEXT", CMDnextlast, true, 1, 1,
NULL },
- { "post", CMDpost, true, 1, 1,
+ { "POST", CMDpost, true, 1, 1,
NULL },
- { "quit", CMDquit, false, 1, 1,
+ { "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,
+ { "SLAVE", CMD_unimp, false, 1, 1,
NULL },
- { "stat", CMDfetch, true, 1, 2,
+#ifdef HAVE_SSL
+ { "STARTTLS", CMDstarttls, false, 1, 1,
+ NULL },
+#endif
+ { "STAT", CMDfetch, true, 1, 2,
CMDfetchhelp },
- { "xgtitle", CMDxgtitle, true, 1, 2,
+ { "XGTITLE", CMDxgtitle, true, 1, 2,
"[group_pattern]" },
- { "xhdr", CMDpat, true, 2, 3,
- "header [range|MessageID]" },
- { "xover", CMDxover, true, 1, 2,
+ { "XHDR", CMDpat, true, 2, 3,
+ "header [range|messageID]" },
+ { "XOVER", CMDxover, true, 1, 2,
"[range]" },
- { "xpat", CMDpat, true, 4, CMDany,
- "header range|MessageID pat [morepat...]" },
+ { "XPAT", CMDpat, true, 4, CMDany,
+ "header range|messageID pat [morepat...]" },
{ NULL, CMD_unimp, false, 0, 0,
NULL }
};
@@ -265,7 +266,7 @@
/*
-** The "help" command.
+** The HELP command.
*/
void
CMDhelp(int ac UNUSED, char *av[] UNUSED)
@@ -322,13 +323,13 @@
void
CMD_unimp(int ac UNUSED, char *av[])
{
- Reply("%d \"%s\" not implemented; try \"help\"\r\n",
+ Reply("%d \"%s\" not implemented; try \"HELP\"\r\n",
NNTP_ERR_COMMAND, av[0]);
}
/*
-** The "quit" command.
+** The QUIT command.
*/
void
CMDquit(int ac UNUSED, char *av[] UNUSED)
@@ -1170,7 +1171,7 @@
}
/* 502 if already successfully authenticated, according to RFC 4643. */
- if (!PERMcanauthenticate && (strcasecmp(cp->Name, "authinfo") == 0)) {
+ if (!PERMcanauthenticate && (strcasecmp(cp->Name, "AUTHINFO") == 0)) {
Reply("%d %s\r\n", NNTP_ERR_ACCESS, "Already authenticated");
continue;
}
Modified: post.c
===================================================================
--- post.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ post.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -762,7 +762,7 @@
{
char buff[NNTP_MAXLEN_COMMAND];
- fprintf(ToServer, "quit\r\n");
+ fprintf(ToServer, "QUIT\r\n");
fflush(ToServer);
fclose(ToServer);
fgets(buff, sizeof buff, FromServer);
@@ -778,7 +778,7 @@
{
static char CANTSEND[] = "Can't send %s to server, %s";
- fprintf(ToServer, "ihave %s\r\n", HDR(HDR__MESSAGEID));
+ fprintf(ToServer, "IHAVE %s\r\n", HDR(HDR__MESSAGEID));
if (FLUSH_ERROR(ToServer)
|| fgets(buff, buffsize, FromServer) == NULL) {
snprintf(buff, sizeof(buff), CANTSEND, "IHAVE", strerror(errno));
Modified: sasl.c
===================================================================
--- sasl.c 2008-08-27 20:00:54 UTC (rev 7978)
+++ sasl.c 2008-08-27 21:09:21 UTC (rev 7979)
@@ -40,7 +40,7 @@
int r = SASL_OK;
if (ac < 3 || ac > 4) {
- Reply("%d AUTHINFO SASL <MECH> [<INIT-RESP]>\r\n", NNTP_ERR_COMMAND);
+ Reply("%d AUTHINFO SASL mech [init-resp]>\r\n", NNTP_ERR_COMMAND);
return;
}
More information about the inn-committers
mailing list