INN commit: trunk/innd (nc.c)
INN Commit
rra at isc.org
Sat Jan 23 10:46:40 UTC 2010
Date: Saturday, January 23, 2010 @ 02:46:40
Author: iulius
Revision: 8928
Properly return 501 instead of 502 when a peer is already
authenticated and sends a syntactically invalid AUTHINFO command.
Modified:
trunk/innd/nc.c
------+
nc.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
Modified: nc.c
===================================================================
--- nc.c 2010-01-22 23:39:07 UTC (rev 8927)
+++ nc.c 2010-01-23 10:46:40 UTC (rev 8928)
@@ -456,6 +456,15 @@
char *buff = NULL;
cp->Start = cp->Next;
+ /* Make sure we're getting only AUTHINFO USER/PASS commands. */
+ if (strcasecmp(cp->av[1], "USER") != 0
+ && strcasecmp(cp->av[1], "PASS") != 0) {
+ xasprintf(&buff, "%d Bad AUTHINFO param", NNTP_ERR_SYNTAX);
+ NCwritereply(cp, buff);
+ free(buff);
+ return;
+ }
+
if (cp->IsAuthenticated) {
/* 502 if authentication will fail. */
if (cp->CanAuthenticate)
@@ -477,14 +486,6 @@
return;
}
- /* Now make sure we're getting only AUTHINFO PASS commands. */
- if (strcasecmp(cp->av[1], "PASS") != 0) {
- xasprintf(&buff, "%d Bad AUTHINFO param", NNTP_ERR_SYNTAX);
- NCwritereply(cp, buff);
- free(buff);
- return;
- }
-
/* AUTHINFO PASS cannot be sent before AUTHINFO USER. */
if (!cp->HasSentUsername) {
xasprintf(&buff, "%d Authentication commands issued out of sequence",
@@ -788,6 +789,8 @@
cp->Start = cp->Next;
if (cp->Nolist) {
+ /* Even authenticated, a peer that has nolist: set will not
+ * be able to use the LIST command. */
if (!cp->CanAuthenticate || innconf->noreader
|| (NNRPReason != NULL && !innconf->readerswhenstopped))
xasprintf(&buff, "%d Permission denied", NNTP_ERR_ACCESS);
More information about the inn-committers
mailing list