aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnthony VEREZ <netantho@gmail.com>2012-01-30 09:48:01 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-01-30 09:48:01 +0100
commit9e5b3914defe8006dbc303985fdb4ae1434eb852 (patch)
treeeeda897d88c02ea49e9e437a1770b1a3fb874d49 /examples
parent31727bf33a1349c0b611ab60059d90d44df7dedf (diff)
downloadlibssh-9e5b3914defe8006dbc303985fdb4ae1434eb852.tar.gz
libssh-9e5b3914defe8006dbc303985fdb4ae1434eb852.tar.xz
libssh-9e5b3914defe8006dbc303985fdb4ae1434eb852.zip
examples: Fix PTY allocation error.
Diffstat (limited to 'examples')
-rw-r--r--examples/samplesshd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/samplesshd.c b/examples/samplesshd.c
index 8c0fe95..8000448 100644
--- a/examples/samplesshd.c
+++ b/examples/samplesshd.c
@@ -270,7 +270,8 @@ int main(int argc, char **argv){
do {
message=ssh_message_get(session);
if(message && ssh_message_type(message)==SSH_REQUEST_CHANNEL &&
- ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL){
+ (ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL ||
+ ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_PTY)) {
// if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
sftp=1;
ssh_message_channel_request_reply_success(message);
@@ -295,6 +296,10 @@ int main(int argc, char **argv){
printf("error writing to buffer\n");
return 1;
}
+ if (buf[0] == '\x0d') {
+ write(1, "\n", 1);
+ ssh_channel_write(chan, "\n", 1);
+ }
}
} while (i>0);
ssh_disconnect(session);