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

INN Commit Russ_Allbery at isc.org
Sun Sep 21 09:52:03 UTC 2008


    Date: Sunday, September 21, 2008 @ 02:52:02
  Author: iulius
Revision: 8043

If authentication will fail, send 502 with a better comment.

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

------------+
 commands.c |   27 ++++++++++++++++++---------
 sasl.c     |    9 ++++++---
 2 files changed, 24 insertions(+), 12 deletions(-)

Modified: commands.c
===================================================================
--- commands.c	2008-09-21 09:05:55 UTC (rev 8042)
+++ commands.c	2008-09-21 09:52:02 UTC (rev 8043)
@@ -63,9 +63,12 @@
         return -1;
     }
 
-    /* 502 if already successfully authenticated, according to RFC 4643. */
-    if (PERMauthorized && !PERMneedauth && !PERMcanauthenticate) {
-        Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+    /* 502 if authentication will fail. */
+    if (!PERMcanauthenticate) {
+        if (PERMauthorized && !PERMneedauth)
+            Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+        else
+            Reply("%d Authentication will fail\r\n", NNTP_ERR_ACCESS);
         return -1;
     }
 
@@ -228,9 +231,12 @@
     } else {
         /* Each time AUTHINFO USER is used, the new username is cached. */
         if (strcasecmp(av[1], "USER") == 0) {
-            /* 502 if already successfully authenticated, according to RFC 4643. */
-            if (PERMauthorized && !PERMneedauth && !PERMcanauthenticate) {
-                Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+            /* 502 if authentication will fail. */
+            if (!PERMcanauthenticate) {
+                if (PERMauthorized && !PERMneedauth)
+                    Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+                else
+                    Reply("%d Authentication will fail\r\n", NNTP_ERR_ACCESS);
                 return;
             }
 
@@ -258,9 +264,12 @@
             return;
         }
 
-        /* 502 if already successfully authenticated, according to RFC 4643. */
-        if (PERMauthorized && !PERMneedauth && !PERMcanauthenticate) {
-            Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+        /* 502 if authentication will fail. */
+        if (!PERMcanauthenticate) {
+            if (PERMauthorized && !PERMneedauth)
+                Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+            else
+                Reply("%d Authentication will fail\r\n", NNTP_ERR_ACCESS);
             return;
         }
 

Modified: sasl.c
===================================================================
--- sasl.c	2008-09-21 09:05:55 UTC (rev 8042)
+++ sasl.c	2008-09-21 09:52:02 UTC (rev 8043)
@@ -88,9 +88,12 @@
         return;
     }
 
-    /* 502 if already successfully authenticated, according to RFC 4643. */
-    if (PERMauthorized && !PERMneedauth && !PERMcanauthenticate) {
-        Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+    /* 502 if authentication will fail. */
+    if (!PERMcanauthenticate) {
+        if (PERMauthorized && !PERMneedauth)
+            Reply("%d Already authenticated\r\n", NNTP_ERR_ACCESS);
+        else
+            Reply("%d Authentication will fail\r\n", NNTP_ERR_ACCESS);
         return;
     }
 



More information about the inn-committers mailing list