aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/connect_ssh.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/connect_ssh.c b/examples/connect_ssh.c
index cfc6bb1..90a2f34 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);