changeset 1933:e093ddc5b585

Fix extra default -i arguments for multihop When multihop executes dbclient it should only add -i arguments from the original commandline, not the default id_dropbear key. Otherwise multiple -i arguments keep getting added which results in servers disconnecting with too many auth attempts
author Matt Johnston <matt@ucc.asn.au>
date Fri, 01 Apr 2022 11:56:10 +0800
parents 62ae35ff833e
children 83b6a47759a8
files cli-runopts.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/cli-runopts.c	Fri Apr 01 11:21:34 2022 +0800
+++ b/cli-runopts.c	Fri Apr 01 11:56:10 2022 +0800
@@ -482,6 +482,17 @@
 	}
 #endif
 
+	/* The hostname gets set up last, since
+	 * in multi-hop mode it will require knowledge
+	 * of other flags such as -i */
+#if DROPBEAR_CLI_MULTIHOP
+	parse_multihop_hostname(host_arg, argv[0]);
+#else
+	parse_hostname(host_arg);
+#endif
+
+	/* We don't want to include default id_dropbear as a
+	   -i argument for multihop, so handle it later. */
 #if (DROPBEAR_CLI_PUBKEY_AUTH)
 	{
 		char *expand_path = expand_homedir_path(DROPBEAR_DEFAULT_CLI_AUTHKEY);
@@ -490,14 +501,6 @@
 	}
 #endif
 
-	/* The hostname gets set up last, since
-	 * in multi-hop mode it will require knowledge
-	 * of other flags such as -i */
-#if DROPBEAR_CLI_MULTIHOP
-	parse_multihop_hostname(host_arg, argv[0]);
-#else
-	parse_hostname(host_arg);
-#endif
 }
 
 #if DROPBEAR_CLI_PUBKEY_AUTH