From 2fe59071b242c6104d765b87d99f94bbf377545d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 16 Jan 2014 15:27:46 +0100 Subject: src: Do not use deprecated functions. --- examples/authentication.c | 8 ++++---- examples/sshnetcat.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'examples') diff --git a/examples/authentication.c b/examples/authentication.c index ab5e64d6..b9f70f5b 100644 --- a/examples/authentication.c +++ b/examples/authentication.c @@ -116,7 +116,7 @@ int authenticate_console(ssh_session session){ return rc; } - method = ssh_auth_list(session); + method = ssh_userauth_list(session, NULL); while (rc != SSH_AUTH_SUCCESS) { if (method & SSH_AUTH_METHOD_GSSAPI_MIC){ rc = ssh_userauth_gssapi(session); @@ -129,10 +129,10 @@ int authenticate_console(ssh_session session){ } // Try to authenticate with public key first if (method & SSH_AUTH_METHOD_PUBLICKEY) { - rc = ssh_userauth_autopubkey(session, NULL); + rc = ssh_userauth_publickey_auto(session, NULL, NULL); if (rc == SSH_AUTH_ERROR) { - error(session); - return rc; + error(session); + return rc; } else if (rc == SSH_AUTH_SUCCESS) { break; } diff --git a/examples/sshnetcat.c b/examples/sshnetcat.c index 67bb1ad6..4ed408da 100644 --- a/examples/sshnetcat.c +++ b/examples/sshnetcat.c @@ -102,27 +102,27 @@ static void select_loop(ssh_session session,ssh_channel channel){ if(FD_ISSET(0,&fds)){ lus=read(0,buffer,sizeof(buffer)); if(lus) - channel_write(channel,buffer,lus); + ssh_channel_write(channel,buffer,lus); else { eof=1; - channel_send_eof(channel); + ssh_channel_send_eof(channel); } } - if(channel && channel_is_closed(channel)){ - channel_free(channel); + if(channel && ssh_channel_is_closed(channel)){ + ssh_channel_free(channel); channel=NULL; channels[0]=NULL; } if(outchannels[0]){ - while(channel && channel_is_open(channel) && channel_poll(channel,0)){ - lus=channel_read(channel,buffer,sizeof(buffer),0); + while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,0)){ + lus = ssh_channel_read(channel,buffer,sizeof(buffer),0); if(lus==-1){ fprintf(stderr, "Error reading channel: %s\n", ssh_get_error(session)); return; } if(lus==0){ - channel_free(channel); + ssh_channel_free(channel); channel=channels[0]=NULL; } else { ret = write(1, buffer, lus); @@ -133,15 +133,15 @@ static void select_loop(ssh_session session,ssh_channel channel){ } } } - while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */ - lus=channel_read(channel,buffer,sizeof(buffer),1); + while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,1)){ /* stderr */ + lus = ssh_channel_read(channel, buffer, sizeof(buffer), 1); if(lus==-1){ fprintf(stderr, "Error reading channel: %s\n", ssh_get_error(session)); return; } if(lus==0){ - channel_free(channel); + ssh_channel_free(channel); channel=channels[0]=NULL; } else { ret = write(2, buffer, lus); @@ -153,8 +153,8 @@ static void select_loop(ssh_session session,ssh_channel channel){ } } } - if(channel && channel_is_closed(channel)){ - channel_free(channel); + if(channel && ssh_channel_is_closed(channel)){ + ssh_channel_free(channel); channel=NULL; } } while (ret==EINTR || ret==SSH_EINTR); @@ -165,8 +165,8 @@ static void select_loop(ssh_session session,ssh_channel channel){ static void forwarding(ssh_session session){ ssh_channel channel; int r; - channel=channel_new(session); - r=channel_open_forward(channel,desthost,atoi(port),"localhost",22); + channel = ssh_channel_new(session); + r = ssh_channel_open_forward(channel, desthost, atoi(port), "localhost", 22); if(r<0) { printf("error forwarding port : %s\n",ssh_get_error(session)); return; -- cgit v1.2.3