diff options
| author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-10 22:40:28 +0200 |
|---|---|---|
| committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-10 22:40:28 +0200 |
| commit | 34a927716a37a533719c3473dd0007be35307883 (patch) | |
| tree | 6b7eca8008ca8121f0808246835c253ee54a57b0 /examples | |
| parent | bae409071522ae65c02bc36fccb87ee2a7179edf (diff) | |
Added code to test proxycommand
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/sample.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/examples/sample.c b/examples/sample.c index 27fd7c7c..003a0e4e 100644 --- a/examples/sample.c +++ b/examples/sample.c @@ -46,6 +46,8 @@ struct termios terminal; char *pcap_file=NULL; #endif +char *proxycommand; + static int auth_callback(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) { char *answer = NULL; @@ -96,6 +98,9 @@ static void usage(){ #ifdef WITH_PCAP " -P file : create a pcap debugging file\n" #endif +#ifndef _WIN32 + " -T proxycommand : command to execute as a socket proxy\n" +#endif , ssh_version(0)); exit(0); @@ -106,13 +111,18 @@ static int opts(int argc, char **argv){ // for(i=0;i<argc;i++) // printf("%d : %s\n",i,argv[i]); /* insert your own arguments here */ - while((i=getopt(argc,argv,"P:"))!=-1){ + while((i=getopt(argc,argv,"T:P:"))!=-1){ switch(i){ #ifdef WITH_PCAP case 'P': pcap_file=optarg; break; #endif +#ifndef _WIN32 + case 'T': + proxycommand=optarg; + break; +#endif default: fprintf(stderr,"unknown option %c\n",optopt); usage(); @@ -432,7 +442,10 @@ static int client(ssh_session session){ return -1; if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0) return -1; - + if (proxycommand != NULL){ + if(ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, proxycommand)) + return -1; + } ssh_options_parse_config(session, NULL); if(ssh_connect(session)){ |
