diff cli-main.c @ 479:e3db1f7a2e43

- Split main socket var into ses.sock_in/ses.sock_out in preparation for -J proxy_cmd option (and some prelim options for that)
author Matt Johnston <matt@ucc.asn.au>
date Mon, 15 Sep 2008 12:51:50 +0000
parents 1afa503e33f5
children 738313e73b1c
line wrap: on
line diff
--- a/cli-main.c	Fri Sep 12 17:48:33 2008 +0000
+++ b/cli-main.c	Mon Sep 15 12:51:50 2008 +0000
@@ -39,7 +39,7 @@
 int main(int argc, char ** argv) {
 #endif
 
-	int sock;
+	int sock_in, sock_out;
 	char* error = NULL;
 	char* hostandport;
 	int len;
@@ -58,10 +58,18 @@
 		dropbear_exit("signal() error");
 	}
 
-	sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, 
-			0, &error);
+#ifdef CLI_ENABLE_PROXYCMD
+	if (cli_runopts.proxycmd) {
 
-	if (sock < 0) {
+	} else
+#endif
+	{
+		int sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, 
+				0, &error);
+		sock_in = sock_out = sock;
+	}
+
+	if (sock_in < 0) {
 		dropbear_exit("%s", error);
 	}
 
@@ -72,7 +80,7 @@
 	snprintf(hostandport, len, "%s:%s", 
 			cli_opts.remotehost, cli_opts.remoteport);
 
-	cli_session(sock, hostandport);
+	cli_session(sock_in, sock_out, hostandport);
 
 	/* not reached */
 	return -1;