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 /examples/connect_ssh.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 'examples/connect_ssh.c')
-rw-r--r-- | examples/connect_ssh.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/connect_ssh.c b/examples/connect_ssh.c index cfc6bb12..90a2f34c 100644 --- a/examples/connect_ssh.c +++ b/examples/connect_ssh.c @@ -23,24 +23,24 @@ clients must be made or how a client should react. ssh_session connect_ssh(const char *host, const char *user,int verbosity){ ssh_session session; - ssh_options options; int auth=0; - options=ssh_options_new(); + session=ssh_new(); + if (session == NULL) { + return NULL; + } + if(user != NULL){ - if (ssh_options_set_username(options,user) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) { + ssh_disconnect(session); return NULL; } } - if (ssh_options_set_host(options,host) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_HOST, host) < 0) { return NULL; } - ssh_options_set_log_verbosity(options,verbosity); - session=ssh_new(); - ssh_set_options(session,options); + ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); if(ssh_connect(session)){ fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session)); ssh_disconnect(session); |