diff options
-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 20abe31..b7f6074 100644 --- a/examples/sample.c +++ b/examples/sample.c @@ -42,6 +42,8 @@ struct termios terminal; char *pcap_file=NULL; +char *proxycommand; + static int auth_callback(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) { char *answer = NULL; @@ -92,6 +94,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); @@ -102,11 +107,16 @@ 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){ case 'P': pcap_file=optarg; break; +#ifndef _WIN32 + case 'T': + proxycommand=optarg; + break; +#endif default: fprintf(stderr,"unknown option %c\n",optopt); usage(); @@ -438,7 +448,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)){ |