diff cli-runopts.c @ 1206:2907c658fa76

Implemented ExitOnForwardFailure option for local and remote forwarding.
author Konstantin Tokarev <ktokarev@smartlabs.tv>
date Mon, 30 Nov 2015 20:30:58 +0300
parents 978887222d29
children 64a50eac1030
line wrap: on
line diff
--- a/cli-runopts.c	Mon Nov 30 20:36:15 2015 +0300
+++ b/cli-runopts.c	Mon Nov 30 20:30:58 2015 +0300
@@ -148,6 +148,9 @@
 #ifdef ENABLE_CLI_PUBKEY_AUTH
 	cli_opts.privkeys = list_new();
 #endif
+#ifdef ENABLE_CLI_ANYTCPFWD
+	cli_opts.exit_on_fwd_failure = 0;
+#endif
 #ifdef ENABLE_CLI_LOCALTCPFWD
 	cli_opts.localfwds = list_new();
 	opts.listen_fwd_all = 0;
@@ -854,9 +857,20 @@
 	const char *optstr = origstr;
 
 	if (strcmp(origstr, "help") == 0) {
-		dropbear_log(LOG_INFO, "No options available\n");
+		dropbear_log(LOG_INFO, "Available options:\n"
+#ifdef ENABLE_CLI_ANYTCPFWD
+			"\tExitOnForwardFailure\n"
+#endif
+		);
 		exit(EXIT_SUCCESS);
 	}
 
+#ifdef ENABLE_CLI_ANYTCPFWD
+	if (match_extendedopt(&optstr, "ExitOnForwardFailure") == DROPBEAR_SUCCESS) {
+		cli_opts.exit_on_fwd_failure = parse_flag_value(optstr);
+		return;
+	}
+#endif
+
 	dropbear_exit("Bad configuration option '%s'", origstr);
 }