The unified diff between revisions [0501e6f6..] and [d1f69334..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "cli-chansession.c"
# from [8250f8508ce081c3facf84f9a8b5cd5caab220e5]
# to [43c6ca4b3b50b08befae09138a3ee6ac5f70150c]
#
# patch "cli-session.c"
# from [74a7cf84c59c70bc92142ba7d75aa49f8be2fa2b]
# to [6deee7b1896729489cf386ecf49dea4212e1ca2f]
#
# patch "debug.h"
# from [23bff5344e9f49a0879115b2e23e4633e93d3121]
# to [82e5eaf9ae4a4c32e94e0cf13722d1d1c4edd45f]
#
============================================================
--- cli-chansession.c 8250f8508ce081c3facf84f9a8b5cd5caab220e5
+++ cli-chansession.c 43c6ca4b3b50b08befae09138a3ee6ac5f70150c
@@ -367,14 +367,55 @@ void cli_send_chansess_request() {
void cli_send_chansess_request() {
+ unsigned int port = 0;
+ unsigned char* addr = NULL;
+ unsigned char* ipstring = "127.0.0.1";
+ unsigned char* portstring = "22";
+
+ /* hack hack */
+ static const struct ChanType cli_chan_tcphack = {
+ 0, /* sepfds */
+ "direct-tcpip",
+ NULL,
+ NULL,
+ NULL,
+ cli_closechansess
+ };
+
TRACE(("enter cli_send_chansess_request"))
- if (send_msg_channel_open_init(STDIN_FILENO, &clichansess)
+ if (send_msg_channel_open_init(STDIN_FILENO, &cli_chan_tcphack)
== DROPBEAR_FAILURE) {
dropbear_exit("Couldn't open initial channel");
}
- /* No special channel request data */
+ if (cli_opts.localfwds == NULL) {
+ dropbear_exit("You need to give a \"-L ignored:host:port\" option with this hacked up dbclient.");
+ }
+
+ addr = cli_opts.localfwds->connectaddr;
+ port = cli_opts.localfwds->connectport;
+
+ buf_putstring(ses.writepayload, addr, strlen(addr));
+ buf_putint(ses.writepayload, port);
+
+ /* originator ip */
+ buf_putstring(ses.writepayload, ipstring, strlen(ipstring));
+ /* originator port */
+ buf_putint(ses.writepayload, atol(portstring));
+
encrypt_packet();
TRACE(("leave cli_send_chansess_request"))
}
+
+#if 0
+ while (cli_opts.localfwds != NULL) {
+ ret = cli_localtcp(cli_opts.localfwds->listenport,
+ cli_opts.localfwds->connectaddr,
+ cli_opts.localfwds->connectport);
+ if (ret == DROPBEAR_FAILURE) {
+ dropbear_log(LOG_WARNING, "Failed local port forward %d:%s:%d",
+ cli_opts.localfwds->listenport,
+ cli_opts.localfwds->connectaddr,
+ cli_opts.localfwds->connectport);
+#endif
============================================================
--- cli-session.c 74a7cf84c59c70bc92142ba7d75aa49f8be2fa2b
+++ cli-session.c 6deee7b1896729489cf386ecf49dea4212e1ca2f
@@ -213,10 +213,10 @@ static void cli_sessionloop() {
case USERAUTH_SUCCESS_RCVD:
#ifdef ENABLE_CLI_LOCALTCPFWD
- setup_localtcp();
+ //setup_localtcp();
#endif
#ifdef ENABLE_CLI_REMOTETCPFWD
- setup_remotetcp();
+ //setup_remotetcp();
#endif
cli_send_chansess_request();
TRACE(("leave cli_sessionloop: cli_send_chansess_request"))
============================================================
--- debug.h 23bff5344e9f49a0879115b2e23e4633e93d3121
+++ debug.h 82e5eaf9ae4a4c32e94e0cf13722d1d1c4edd45f
@@ -39,7 +39,7 @@
* Caution: Don't use this in an unfriendly environment (ie unfirewalled),
* since the printing may not sanitise strings etc. This will add a reasonable
* amount to your executable size. */
-/*#define DEBUG_TRACE */
+#define DEBUG_TRACE
/* All functions writing to the cleartext payload buffer call
* CHECKCLEARTOWRITE() before writing. This is only really useful if you're