diff cli-session.c @ 686:983a817f8e41 insecure-nocrypto

- Only request "none" cipher after auth has succeeded
author Matt Johnston <matt@ucc.asn.au>
date Thu, 17 May 2012 20:52:57 +0800
parents a98a2138364a
children 78eda530c000 d44325108d0e d1575fdc29a6
line wrap: on
line diff
--- a/cli-session.c	Thu May 17 08:33:11 2012 +0800
+++ b/cli-session.c	Thu May 17 20:52:57 2012 +0800
@@ -133,6 +133,13 @@
 	cli_ses.lastprivkey = NULL;
 	cli_ses.lastauthtype = 0;
 
+#ifdef DROPBEAR_NONE_CIPHER
+	cli_ses.cipher_none_after_auth = get_algo_usable(sshciphers, "none");
+	set_algo_usable(sshciphers, "none", 0);
+#else
+	cli_ses.cipher_none_after_auth = 0;
+#endif
+
 	/* For printing "remote host closed" for the user */
 	ses.remoteclosed = cli_remoteclosed;
 	ses.buf_match_algo = cli_buf_match_algo;
@@ -207,6 +214,14 @@
 
 		case USERAUTH_SUCCESS_RCVD:
 
+#ifdef DROPBEAR_NONE_CIPHER
+			if (cli_ses.cipher_none_after_auth)
+			{
+				set_algo_usable(sshciphers, "none", 1);
+				send_msg_kexinit();
+			}
+#endif
+
 			if (cli_opts.backgrounded) {
 				int devnull;
 				/* keeping stdin open steals input from the terminal and