+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.
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;
}
{
gint ok;
+ if (sock->auth_failed)
+ return NN_AUTHREQ; /* force reconnection */
+
ok = nntp_gen_command(sock, NULL, "MODE %s",
stream ? "STREAM" : "READER");
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);
}