Fixed a problem with NNTP authentication failure handling (need to
fail the MODE READER command to force reconnection with password prompt).
This commit is contained in:
parent
06c7982810
commit
5cda5e2d12
|
@ -1,3 +1,15 @@
|
|||
2001-04-30 [sergey]
|
||||
|
||||
* src/nntp.h (NNTPSockInfo): new field auth_failed.
|
||||
|
||||
* src/nntp.c (nntp_mode): return NN_AUTHREQ if sock->auth_failed
|
||||
is set to force reconnection after authentication failure.
|
||||
(nntp_gen_command): set sock->auth_failed on authentication
|
||||
failure, or if sock->userid and sock->passwd are not set.
|
||||
|
||||
* src/news.c (news_session_new_for_folder): set userid=NULL if
|
||||
password dialog is cancelled.
|
||||
|
||||
2001-04-30 [sergey]
|
||||
|
||||
* src/nntp.h (NNTPSockInfo): new type.
|
||||
|
|
|
@ -137,8 +137,11 @@ static Session *news_session_new_for_folder(Folder *folder)
|
|||
userid = ac->userid;
|
||||
if (ac->passwd && ac->passwd[0])
|
||||
passwd = g_strdup(ac->passwd);
|
||||
else
|
||||
else {
|
||||
passwd = news_query_password(ac->nntp_server, userid);
|
||||
if (!passwd)
|
||||
userid = NULL;
|
||||
}
|
||||
} else {
|
||||
userid = passwd = NULL;
|
||||
}
|
||||
|
|
13
src/nntp.c
13
src/nntp.c
|
@ -232,6 +232,9 @@ gint nntp_mode(NNTPSockInfo *sock, gboolean stream)
|
|||
{
|
||||
gint ok;
|
||||
|
||||
if (sock->auth_failed)
|
||||
return NN_AUTHREQ; /* force reconnection */
|
||||
|
||||
ok = nntp_gen_command(sock, NULL, "MODE %s",
|
||||
stream ? "STREAM" : "READER");
|
||||
|
||||
|
@ -310,15 +313,21 @@ static gint nntp_gen_command(NNTPSockInfo *sock, gchar *argbuf,
|
|||
|
||||
nntp_gen_send(sock, "%s", buf);
|
||||
ok = nntp_ok(sock, argbuf);
|
||||
if (ok == NN_AUTHREQ && sock->userid && sock->passwd) {
|
||||
if (ok == NN_AUTHREQ) {
|
||||
if (!sock->userid || !sock->passwd) {
|
||||
sock->auth_failed = TRUE;
|
||||
return ok;
|
||||
}
|
||||
nntp_gen_send(sock, "AUTHINFO USER %s", sock->userid);
|
||||
ok = nntp_ok(sock, NULL);
|
||||
if (ok == NN_AUTHCONT) {
|
||||
nntp_gen_send(sock, "AUTHINFO PASS %s", sock->passwd);
|
||||
ok = nntp_ok(sock, NULL);
|
||||
}
|
||||
if (ok != NN_SUCCESS)
|
||||
if (ok != NN_SUCCESS) {
|
||||
sock->auth_failed = TRUE;
|
||||
return ok;
|
||||
}
|
||||
nntp_gen_send(sock, "%s", buf);
|
||||
ok = nntp_ok(sock, argbuf);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ struct _NNTPSockInfo
|
|||
SockInfo *sock;
|
||||
gchar *userid;
|
||||
gchar *passwd;
|
||||
gboolean auth_failed;
|
||||
};
|
||||
|
||||
NNTPSockInfo *nntp_open(const gchar *server, gushort port, gchar *buf);
|
||||
|
|
Loading…
Reference in a new issue