INN commit: branches/2.5/lib (sendpass.c)
INN Commit
rra at isc.org
Sun Nov 15 09:28:47 UTC 2009
Date: Sunday, November 15, 2009 @ 01:28:47
Author: iulius
Revision: 8797
A password is not mandatory with AUTHINFO USER/PASS. A username
may be enough to authenticate according to RFC 4644.
Modified:
branches/2.5/lib/sendpass.c
------------+
sendpass.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
Modified: sendpass.c
===================================================================
--- sendpass.c 2009-11-15 09:28:39 UTC (rev 8796)
+++ sendpass.c 2009-11-15 09:28:47 UTC (rev 8797)
@@ -27,6 +27,7 @@
char *pass;
char *style;
int oerrno;
+ bool authenticated;
/* Default to innconf->server. If that's not set either, error out. Fake
errno since some of our callers rely on it. */
@@ -69,19 +70,24 @@
if (strcasecmp(server, buff) != 0)
continue;
+ authenticated = false;
+
if (*user) {
/* Send the first part of the command, get a reply. */
- fprintf(ToServer, "authinfo user %s\r\n", user);
+ fprintf(ToServer, "AUTHINFO USER %s\r\n", user);
if (fflush(ToServer) == EOF || ferror(ToServer))
break;
- if (fgets(input, sizeof input, FromServer) == NULL
- || atoi(input) != NNTP_CONT_AUTHINFO)
+ if (fgets(input, sizeof input, FromServer) == NULL)
+ break;
+ if (atoi(input) == NNTP_OK_AUTHINFO)
+ authenticated = true;
+ else if (atoi(input) != NNTP_CONT_AUTHINFO)
break;
}
- if (*pass) {
+ if (*pass && !authenticated) {
/* Send the second part of the command, get a reply. */
- fprintf(ToServer, "authinfo pass %s\r\n", pass);
+ fprintf(ToServer, "AUTHINFO PASS %s\r\n", pass);
if (fflush(ToServer) == EOF || ferror(ToServer))
break;
if (fgets(input, sizeof input, FromServer) == NULL
More information about the inn-committers
mailing list