aboutsummaryrefslogtreecommitdiff
path: root/samplesshd.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-08-13 12:58:41 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-08-13 12:58:41 +0000
commitf730d3b361f717135786bddb3c949bfae213bbff (patch)
treeb919bf43f8145f4384ca0f70e778be9a01c38678 /samplesshd.c
parent96a99bab7853998ec8c23da6bcb9ffb10855705d (diff)
downloadlibssh-f730d3b361f717135786bddb3c949bfae213bbff.tar.gz
libssh-f730d3b361f717135786bddb3c949bfae213bbff.tar.xz
libssh-f730d3b361f717135786bddb3c949bfae213bbff.zip
some adds, now it's possible to test it correctly.
channels still need some hack so they know the message system exists. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@8 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'samplesshd.c')
-rw-r--r--samplesshd.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/samplesshd.c b/samplesshd.c
index 141dc127..7fe93282 100644
--- a/samplesshd.c
+++ b/samplesshd.c
@@ -41,6 +41,7 @@ int main(int argc, char **argv){
CHANNEL *chan;
int auth=0;
int sftp=0;
+ int i;
ssh_options_getopt(options,&argc,argv);
ssh_options_set_dsa_server_key(options,"/etc/ssh/ssh_host_dsa_key");
ssh_options_set_rsa_server_key(options,"/etc/ssh/ssh_host_rsa_key");
@@ -116,12 +117,12 @@ int main(int argc, char **argv){
do {
message=ssh_message_get(session);
if(message && ssh_message_type(message)==SSH_CHANNEL_REQUEST &&
- ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SUBSYSTEM){
- if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
+ ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL){
+// if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
sftp=1;
ssh_message_channel_request_reply_success(message);
break;
- }
+ // }
}
if(!sftp){
ssh_message_reply_default(message);
@@ -133,6 +134,12 @@ int main(int argc, char **argv){
return 1;
}
printf("it works !\n");
+ BUFFER *buf=buffer_new();
+ do{
+ i=channel_read(chan,buf,0,0);
+ if(i>0)
+ write(1,buffer_get(buf),buffer_get_len(buf));
+ } while (i>0);
return 0;
}