aboutsummaryrefslogtreecommitdiff
path: root/examples/proxy.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2013-03-13 20:45:15 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-07-13 14:51:00 +0200
commit52d9e15c25d776f53edca0060aa8678a7e0bb3a0 (patch)
tree8a67e0085145f4803102e7315a88a633c104c91d /examples/proxy.c
parente933d1e1b120dfb73f44795c6ccae640b793e708 (diff)
downloadlibssh-52d9e15c25d776f53edca0060aa8678a7e0bb3a0.tar.gz
libssh-52d9e15c25d776f53edca0060aa8678a7e0bb3a0.tar.xz
libssh-52d9e15c25d776f53edca0060aa8678a7e0bb3a0.zip
examples: adapt to the new callback format
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'examples/proxy.c')
-rw-r--r--examples/proxy.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/proxy.c b/examples/proxy.c
index f427c358..594eef19 100644
--- a/examples/proxy.c
+++ b/examples/proxy.c
@@ -96,16 +96,16 @@ struct ssh_channel_callbacks_struct channel_cb = {
.channel_shell_request_function = shell_request
};
-static int new_session_channel(ssh_session session, ssh_channel channel, void *userdata){
+static ssh_channel new_session_channel(ssh_session session, void *userdata){
(void) session;
(void) userdata;
if(chan != NULL)
- return -1;
+ return NULL;
printf("Allocated session channel\n");
- chan = channel;
+ chan = ssh_channel_new(session);
ssh_callbacks_init(&channel_cb);
- ssh_set_channel_callbacks(channel, &channel_cb);
- return 0;
+ ssh_set_channel_callbacks(chan, &channel_cb);
+ return chan;
}
@@ -286,6 +286,7 @@ int main(int argc, char **argv){
snprintf(buf,sizeof(buf), "Sorry, but you do not have forwardable tickets. Try again with -K\r\n");
ssh_channel_write(chan,buf,strlen(buf));
printf("%s",buf);
+ ssh_disconnect(session);
return 1;
}
snprintf(buf,sizeof(buf), "Hello %s, welcome to the Sample SSH proxy.\r\nPlease select your destination: ", username);