[PATCH] auth problem on trasit servers / leaving data on the socket after reconnect

Urs Janßen <[email protected]> Fri, 23 Sep 2016 17:13:00 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

attached patch should
- solve the issue where tin was trying to auth even neither the server nor
  the user requested it
- ensure to read all data from the socket after reconnect and resending
  multiple LIST COUNTS grp,... cmds if started with -n.
- fix a typo in tin(5)

2.4.1 will be released around x-mas.

urs
-- 
"Only whimps use tape backup: _real_ men just upload their important stuff
 on ftp, and let the rest of the world mirror it ;)" - Linus

--FCuugMFkClbJLl1L
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="tin-2.4.0-1.diff"

=== modified file 'src/nntplib.c'
--- src/nntplib.c	2016-08-10 11:06:13 +0000
+++ src/nntplib.c	2016-09-22 16:57:08 +0000
@@ -1429,20 +1429,9 @@
 	 * allowed to post after authentication issue a "MODE READER" again and
 	 * interpret the response code.
 	 */
-	if (force_auth_on_conn_open || (nntp_caps.type == CAPABILITIES && !nntp_caps.reader && (nntp_caps.authinfo_user || (nntp_caps.authinfo_sasl & SASL_PLAIN))))
-	{
-#	ifdef DEBUG
-		if (debug & DEBUG_NNTP)
-			debug_print_file("NNTP", "nntp_open() authenticate()");
-#	endif /* DEBUG */
 
-		/*
-		 * switch mode before auth so we do not auth as a feeder.
-		 * don't use mode_reader() to prevent authenticaion to
-		 * kick in on a 481 "auth required" response and thus lead
-		 * to a 502 "already authenticated" error later on.
-		 */
-		if (nntp_caps.type == CAPABILITIES && nntp_caps.mode_reader) {
+	if (nntp_caps.type == CAPABILITIES && !nntp_caps.reader) {
+		if (nntp_caps.mode_reader) {
 			char buf[NNTP_STRLEN];
 
 #	ifdef DEBUG
@@ -1463,11 +1452,16 @@
 			check_extensions();
 		}
 
-		if (!authenticate(nntp_server, userid, FALSE))	/* 3rd parameter is FALSE as we need to get prompted for username password here */
-			return -1;
+		if (force_auth_on_conn_open) {
+#	ifdef DEBUG
+			if (debug & DEBUG_NNTP)
+				debug_print_file("NNTP", "nntp_open() authenticate(force_auth_on_conn_open)");
+#	endif /* DEBUG */
 
-		if (nntp_caps.type == CAPABILITIES)
+			if (!authenticate(nntp_server, userid, FALSE))	/* 3rd parameter is FALSE as we need to get prompted for username password here */
+				return -1;
 			check_extensions();
+		}
 	}
 
 	if ((nntp_caps.type == CAPABILITIES && nntp_caps.mode_reader) || nntp_caps.type != CAPABILITIES) {

=== modified file 'src/select.c'
--- src/select.c	2016-08-10 11:06:13 +0000
+++ src/select.c	2016-09-22 17:03:05 +0000
@@ -640,6 +640,8 @@
 
 	show_mini_help(SELECT_LEVEL);
 
+	did_reconnect = FALSE;
+
 	if (selmenu.max <= 0) {
 		info_message(_(txt_no_groups));
 		return;
@@ -858,6 +860,7 @@
 sync_active_file(
 	void)
 {
+	wait_message(0, _(txt_reading_news_newsrc_file));
 	force_reread_active_file = TRUE;
 	resync_active_file();
 }

=== modified file 'doc/tin.5'
--- doc/tin.5	2016-08-23 21:08:00 +0000
+++ doc/tin.5	2016-09-18 23:12:00 +0000
@@ -257,13 +257,13 @@
 enclosed in double quotes ("). Usernames must not be enclosed in double quotes
 and thus can't contain spaces or tabs. Any line that starts with "#" is a
 comment. Blank lines are ignored. This file should be readable only for the
-user as it contains the user's uncrypted password for reading news!
+user as it contains the user's unencrypted password for reading news!
 .TP
 .B nntpserver
 full qualified domain name of the news server.
 .TP
 .B password
-user's uncrypted password for reading news.
+user's unencrypted password for reading news.
 .TP
 .B user
 username on the news server if it differs from the local login. This field is


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KdGluLWRldiBt
YWlsaW5nIGxpc3QKdGluLWRldkB0aW4ub3JnCmh0dHA6Ly9saXN0cy50aW4ub3JnL2NnaS1iaW4v
bWFpbG1hbi9saXN0aW5mby90aW4tZGV2Cg==

--FCuugMFkClbJLl1L--