INN commit: trunk/nnrpd (commands.c nnrpd.c)

INN Commit Russ_Allbery at isc.org
Sun Aug 31 11:45:15 UTC 2008


    Date: Sunday, August 31, 2008 @ 04:45:15
  Author: iulius
Revision: 7991

In RFC 3977:

   o  If it advertises the READER capability, it MUST return a 200 or
      201 response with the same meaning as for the initial greeting; in
      this case, the command MUST NOT affect the server state in any
      way.

Therefore, we do not answer 502 to such a command.  Sorry for my
revision 7975 which did that for nnrpd after a successful authentication.
Note that the same behaviour for innd is the right thing to do
after authentication because innd advertises neither MODE-READER
nor READER after that (so my revision 7974 is right for innd).

Modified:
  trunk/nnrpd/commands.c
  trunk/nnrpd/nnrpd.c

------------+
 commands.c |   18 ++++++++----------
 nnrpd.c    |    6 +++---
 2 files changed, 11 insertions(+), 13 deletions(-)

Modified: commands.c
===================================================================
--- commands.c	2008-08-31 10:44:38 UTC (rev 7990)
+++ commands.c	2008-08-31 11:45:15 UTC (rev 7991)
@@ -292,16 +292,14 @@
 CMDmode(int ac UNUSED, char *av[])
 {
     if (strcasecmp(av[1], "READER") == 0)
-        if (PERMcanauthenticate) {
-            Reply("%d %s InterNetNews NNRP server %s ready (%s)\r\n",
-                   (PERMcanpost || PERMcanpostgreeting) ?
-                       NNTP_OK_BANNER_POST : NNTP_OK_BANNER_NOPOST,
-                   PERMaccessconf->pathhost, INN_VERSION_STRING,
-                   (!PERMneedauth && PERMcanpost) ? "posting ok" : "no posting");
-        } else {
-            /* AUTHINFO has already been successfully used. */
-            Reply("%d Permission denied\r\n", NNTP_ERR_ACCESS);
-        }
+        /* In the case AUTHINFO has already been successfully used,
+         * nnrpd must answer as a no-op (it still advertises the READER
+         * capability but not MODE-READER). */
+        Reply("%d %s InterNetNews NNRP server %s ready (%s)\r\n",
+               (PERMcanpost || (PERMcanauthenticate && PERMcanpostgreeting)) ?
+                   NNTP_OK_BANNER_POST : NNTP_OK_BANNER_NOPOST,
+               PERMaccessconf->pathhost, INN_VERSION_STRING,
+               (!PERMneedauth && PERMcanpost) ? "posting ok" : "no posting");
     else
         Reply("%d What?\r\n", NNTP_ERR_SYNTAX);
 }

Modified: nnrpd.c
===================================================================
--- nnrpd.c	2008-08-31 10:44:38 UTC (rev 7990)
+++ nnrpd.c	2008-08-31 11:45:15 UTC (rev 7991)
@@ -411,7 +411,7 @@
     if (getpeername(STDIN_FILENO, sac, &length) < 0) {
         if (!isatty(STDIN_FILENO)) {
 	    sysnotice("? cant getpeername");
-	    Printf("%d I can't get your name.  Goodbye.\r\n", NNTP_ERR_ACCESS);
+	    Printf("%d I can't get your name.  Goodbye!\r\n", NNTP_ERR_ACCESS);
 	    ExitWithStats(1, true);
 	}
         strlcpy(Client.host, "stdin", sizeof(Client.host));
@@ -437,7 +437,7 @@
         length = sizeof(sss);
 	if (getsockname(STDIN_FILENO, sas, &length) < 0) {
 	    sysnotice("%s can't getsockname", Client.host);
-	    Printf("%d Can't figure out where you connected to.  Goodbye\r\n",
+	    Printf("%d Can't figure out where you connected to.  Goodbye!\r\n",
                    NNTP_ERR_ACCESS);
 	    ExitWithStats(1, true);
 	}
@@ -986,7 +986,7 @@
     StartConnection();
     if (!PERMcanread && !PERMcanpost && !PERMneedauth) {
 	syslog(L_NOTICE, "%s no_permission", Client.host);
-	Printf("%d You have no permission to talk.  Goodbye.\r\n",
+	Printf("%d You have no permission to talk.  Goodbye!\r\n",
 	       NNTP_ERR_ACCESS);
 	ExitWithStats(1, false);
     }



More information about the inn-committers mailing list