summaryrefslogtreecommitdiffstats
path: root/libssh/session.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-12 21:58:09 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-12 21:58:09 +0200
commite94bff02ba513628088fd112c5c7cbd9f9a4a57f (patch)
treea2de174f644a33579aed2f2ab89b3261ab9c6610 /libssh/session.c
parent3671c610235a94a2a799650662cbef0234d0b7c2 (diff)
Respond to keepalives/global requests
Diffstat (limited to 'libssh/session.c')
-rw-r--r--libssh/session.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/libssh/session.c b/libssh/session.c
index 57a3e80f..d6d232a2 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -32,7 +32,8 @@
#include "libssh/packet.h"
#include "libssh/session.h"
#include "libssh/misc.h"
-
+#include "libssh/ssh2.h"
+#include "libssh/buffer.h"
#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
/** \defgroup ssh_session SSH Session
@@ -409,5 +410,32 @@ int ssh_get_version(ssh_session session) {
return session->version;
}
+
+/**
+ * @internal
+ * @handle a SSH_MSG_GLOBAL_REQUEST packet
+ * @param session the SSH session
+ */
+void ssh_global_request_handle(ssh_session session){
+ ssh_string type;
+ char *type_c;
+ uint32_t needreply;
+ type=buffer_get_ssh_string(session->in_buffer);
+ buffer_get_u32(session->in_buffer,&needreply);
+ if(type==NULL)
+ return;
+ type_c=string_to_char(type);
+ if(!type_c)
+ return;
+ ssh_log(session, SSH_LOG_PROTOCOL,
+ "Received SSH_GLOBAL_REQUEST %s (wantreply=%d)",type_c,needreply);
+ SAFE_FREE(type_c);
+ string_free(type);
+ if(needreply != 0){
+ buffer_add_u8(session->out_buffer,SSH2_MSG_REQUEST_FAILURE);
+ packet_send(session);
+ }
+}
+
/** @} */
/* vim: set ts=2 sw=2 et cindent: */