Mercurial > dropbear
changeset 478:d4f32c3443ac dbclient-netcat-alike
propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2)
to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 14 Sep 2008 06:47:51 +0000 |
parents | 6b41e2cbf071 (diff) 657c045054ab (current diff) |
children | 12d845ab7b5f |
files | cli-chansession.c cli-session.c debug.h libtomcrypt/src/headers/ltc_tommath.h libtomcrypt/src/headers/tommath_class.h libtomcrypt/src/headers/tommath_superclass.h libtomcrypt/src/misc/mpi/is_prime.c libtomcrypt/src/misc/mpi/mpi_to_ltc_error.c libtomcrypt/src/misc/mpi/rand_prime.c libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence.c libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence.c libtomcrypt/src/pk/dh/dh.c libtomcrypt/src/pk/dh/dh_sys.c libtomcrypt/src/pk/ecc/ecc_sys.c libtomcrypt/src/pk/packet_store_header.c libtomcrypt/src/pk/packet_valid_header.c libtomcrypt/testprof/dh_tests.c libtomcrypt/testprof/test.c libtommath/TODO libtommath/logs/sqr.old |
diffstat | 2 files changed, 45 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cli-chansession.c Fri Sep 12 17:48:33 2008 +0000 +++ b/cli-chansession.c Sun Sep 14 06:47:51 2008 +0000 @@ -368,14 +368,55 @@ 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
--- a/cli-session.c Fri Sep 12 17:48:33 2008 +0000 +++ b/cli-session.c Sun Sep 14 06:47:51 2008 +0000 @@ -230,10 +230,10 @@ } #ifdef ENABLE_CLI_LOCALTCPFWD - setup_localtcp(); + //setup_localtcp(); #endif #ifdef ENABLE_CLI_REMOTETCPFWD - setup_remotetcp(); + //setup_remotetcp(); #endif if (!cli_opts.no_cmd) { cli_send_chansess_request();