Mercurial > dropbear
comparison cli-main.c @ 546:568638be7203 agent-client
propagate from branch 'au.asn.ucc.matt.dropbear' (head 899a8851a5edf840b2f7925bcc26ffe99dcac54d)
to branch 'au.asn.ucc.matt.dropbear.cli-agent' (head 6bbab8364de17bd9ecb1dee5ffb796e48c0380d2)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 01 Jul 2009 04:16:32 +0000 |
parents | 9e51707cd6f2 |
children | 005530560594 |
comparison
equal
deleted
inserted
replaced
500:d588e3ea557a | 546:568638be7203 |
---|---|
30 #include "session.h" | 30 #include "session.h" |
31 | 31 |
32 static void cli_dropbear_exit(int exitcode, const char* format, va_list param); | 32 static void cli_dropbear_exit(int exitcode, const char* format, va_list param); |
33 static void cli_dropbear_log(int priority, const char* format, va_list param); | 33 static void cli_dropbear_log(int priority, const char* format, va_list param); |
34 | 34 |
35 #ifdef ENABLE_CLI_PROXYCMD | |
35 static void cli_proxy_cmd(int *sock_in, int *sock_out); | 36 static void cli_proxy_cmd(int *sock_in, int *sock_out); |
37 #endif | |
36 | 38 |
37 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI) | 39 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI) |
38 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI) | 40 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI) |
39 int cli_main(int argc, char ** argv) { | 41 int cli_main(int argc, char ** argv) { |
40 #else | 42 #else |
61 } | 63 } |
62 | 64 |
63 #ifdef ENABLE_CLI_PROXYCMD | 65 #ifdef ENABLE_CLI_PROXYCMD |
64 if (cli_opts.proxycmd) { | 66 if (cli_opts.proxycmd) { |
65 cli_proxy_cmd(&sock_in, &sock_out); | 67 cli_proxy_cmd(&sock_in, &sock_out); |
68 m_free(cli_opts.proxycmd); | |
66 } else | 69 } else |
67 #endif | 70 #endif |
68 { | 71 { |
69 int sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, | 72 int sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport, |
70 0, &error); | 73 0, &error); |
130 usershell = m_strdup(get_user_shell()); | 133 usershell = m_strdup(get_user_shell()); |
131 run_shell_command(cmd, ses.maxfd, usershell); | 134 run_shell_command(cmd, ses.maxfd, usershell); |
132 dropbear_exit("Failed to run '%s'\n", cmd); | 135 dropbear_exit("Failed to run '%s'\n", cmd); |
133 } | 136 } |
134 | 137 |
138 #ifdef ENABLE_CLI_PROXYCMD | |
135 static void cli_proxy_cmd(int *sock_in, int *sock_out) { | 139 static void cli_proxy_cmd(int *sock_in, int *sock_out) { |
136 int ret; | 140 int ret; |
137 | 141 |
138 fill_passwd(cli_opts.own_user); | 142 fill_passwd(cli_opts.own_user); |
139 | 143 |
142 if (ret == DROPBEAR_FAILURE) { | 146 if (ret == DROPBEAR_FAILURE) { |
143 dropbear_exit("Failed running proxy command"); | 147 dropbear_exit("Failed running proxy command"); |
144 *sock_in = *sock_out = -1; | 148 *sock_in = *sock_out = -1; |
145 } | 149 } |
146 } | 150 } |
151 #endif // ENABLE_CLI_PROXYCMD |