diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-10-05 10:01:24 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-10-05 10:01:24 +0200 |
commit | 40778d4ba94ab5bfbe71bd3a304d6664c9a02560 (patch) | |
tree | 5864e2c4bda6c2d1782ef0ba765a40fcd8b8e8c5 /sample.c | |
parent | a3a7f17d0f971edce873970863cfe660b21d8f57 (diff) | |
parent | 60d6954b7560df62634b305fec65dffbc98ff0b8 (diff) | |
download | libssh-40778d4ba94ab5bfbe71bd3a304d6664c9a02560.tar.gz libssh-40778d4ba94ab5bfbe71bd3a304d6664c9a02560.tar.xz libssh-40778d4ba94ab5bfbe71bd3a304d6664c9a02560.zip |
Merge branch 'master' of git://git.libssh.org/projects/libssh/libssh
Diffstat (limited to 'sample.c')
-rw-r--r-- | sample.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -502,7 +502,6 @@ static int auth_kbdint(ssh_session session){ int main(int argc, char **argv){ ssh_session session; - ssh_options options; int auth=0; char *password; char *banner; @@ -512,30 +511,30 @@ int main(int argc, char **argv){ unsigned char *hash = NULL; int hlen; - options=ssh_options_new(); - if(ssh_options_getopt(options,&argc, argv)){ - fprintf(stderr,"error parsing command line :%s\n",ssh_get_error(options)); - usage(); + session = ssh_new(); + + if(ssh_options_getopt(session, &argc, argv)) { + fprintf(stderr, "error parsing command line :%s\n", + ssh_get_error(session)); + usage(); } opts(argc,argv); signal(SIGTERM, do_exit); if (user) { - if (ssh_options_set(options, SSH_OPTIONS_USER, user) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) { + ssh_disconnect(session); return 1; } } - if (ssh_options_set(options, SSH_OPTIONS_HOST ,host) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0) { + ssh_disconnect(session); return 1; } - ssh_options_parse_config(options, NULL); + ssh_options_parse_config(session, NULL); - session=ssh_new(); - ssh_set_options(session,options); if(ssh_connect(session)){ fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session)); ssh_disconnect(session); |