INN commit: trunk/nnrpd (article.c commands.c group.c newnews.c)

INN Commit Russ_Allbery at isc.org
Fri Sep 26 21:23:48 UTC 2008


    Date: Friday, September 26, 2008 @ 14:23:47
  Author: iulius
Revision: 8052

Answer 480 instead of 502 when the user can authenticate.

Modified:
  trunk/nnrpd/article.c
  trunk/nnrpd/commands.c
  trunk/nnrpd/group.c
  trunk/nnrpd/newnews.c

------------+
 article.c  |   18 ++++++++++++------
 commands.c |    3 ++-
 group.c    |   19 +++++++++----------
 newnews.c  |    6 ++++--
 4 files changed, 27 insertions(+), 19 deletions(-)

Modified: article.c
===================================================================
--- article.c	2008-09-26 21:11:02 UTC (rev 8051)
+++ article.c	2008-09-26 21:23:47 UTC (rev 8052)
@@ -633,7 +633,8 @@
 
     /* Check authorizations. */
     if (!ok) {
-	Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+	Reply("%d Read access denied\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
 	return;
     }
 
@@ -645,7 +646,8 @@
 	}
 	if (!PERMartok()) {
 	    ARTclose();
-	    Reply("%d Read access denied for this article\r\n", NNTP_ERR_ACCESS);
+	    Reply("%d Read access denied for this article\r\n",
+                  PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
 	    return;
 	}
 	tart=art;
@@ -711,7 +713,8 @@
 
     /* No syntax to check.  Only check authorizations. */
     if (!PERMcanread) {
-	Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+	Reply("%d Read access denied\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
 	return;
     }
 
@@ -907,7 +910,8 @@
 
     /* Check authorizations. */
     if (!PERMcanread) {
-	Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+	Reply("%d Read access denied\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
 	return;
     }
 
@@ -1131,7 +1135,8 @@
 
     /* Check authorizations. */
     if (!PERMcanread) {
-        Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+        Reply("%d Read access denied\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
         return;
     }
 
@@ -1159,7 +1164,8 @@
 
             if (!PERMartok()) {
                 ARTclose();
-                Reply("%d Read access denied for this article\r\n", NNTP_ERR_ACCESS);
+                Reply("%d Read access denied for this article\r\n",
+                      PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
                 break;
             }
 

Modified: commands.c
===================================================================
--- commands.c	2008-09-26 21:11:02 UTC (rev 8051)
+++ commands.c	2008-09-26 21:23:47 UTC (rev 8052)
@@ -533,7 +533,8 @@
     /* Check authorizations. */
     if (ihave && (!PERMaccessconf->allowihave || !PERMcanpost)) {
 	syslog(L_NOTICE, "%s noperm ihave without permission", Client.host);
-        Reply("%d IHAVE command disabled by administrator\r\n", NNTP_ERR_ACCESS);
+        Reply("%d IHAVE command disabled by administrator\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
 	return;
     }
     if (!ihave && !PERMcanpost) {

Modified: group.c
===================================================================
--- group.c	2008-09-26 21:11:02 UTC (rev 8051)
+++ group.c	2008-09-26 21:23:47 UTC (rev 8052)
@@ -52,10 +52,8 @@
 
     /* Check authorizations. */
     if (!hookpresent && !PERMcanread) {
-        if (PERMspecified)
-            Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
-        else
-            Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
+        Reply("%d Read access denied\r\n",
+              PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
         return;
     }
 
@@ -78,7 +76,9 @@
 	} else {
 	    if (reply != NULL) {
 	        syslog(L_TRACE, "PY_dynamic() returned a refuse string for user %s at %s who wants to read %s: %s", PERMuser, Client.host, group, reply);
-		Reply("%d %s\r\n", NNTP_ERR_ACCESS, reply);
+		Reply("%d %s\r\n",
+                      PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS,
+                      reply);
 		free(group);
                 free(reply);
 		return;
@@ -92,15 +92,14 @@
             grplist[0] = group;
             grplist[1] = NULL;
             if (!PERMmatch(PERMreadlist, grplist)) {
-                Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+                Reply("%d Read access denied\r\n",
+                      PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
                 free(group);
                 return;
             }
         } else {
-            if (PERMcanauthenticate)
-                Reply("%d Authentication required\r\n", NNTP_FAIL_AUTH_NEEDED);
-            else
-                Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+            Reply("%d Read access denied\r\n",
+                  PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
             free(group);
             return;
         }

Modified: newnews.c
===================================================================
--- newnews.c	2008-09-26 21:11:02 UTC (rev 8051)
+++ newnews.c	2008-09-26 21:23:47 UTC (rev 8052)
@@ -258,13 +258,15 @@
 
   /* Check authorizations. */
   if (!PERMaccessconf->allownewnews) {
-      Reply("%d NEWNEWS command disabled by administrator\r\n", NNTP_ERR_ACCESS);
+      Reply("%d NEWNEWS command disabled by administrator\r\n",
+            PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
       TMRstop(TMR_NEWNEWS);
       return;
   }
 
   if (!PERMcanread) {
-      Reply("%d Read access denied\r\n", NNTP_ERR_ACCESS);
+      Reply("%d Read access denied\r\n",
+            PERMcanauthenticate ? NNTP_FAIL_AUTH_NEEDED : NNTP_ERR_ACCESS);
       TMRstop(TMR_NEWNEWS);
       return;
   }



More information about the inn-committers mailing list