[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Access to ssh_message->channel_request.command


Hi all,

in order to get SSH support in Nepenthes (a honeypot, which uses libssh for
the server-side implementation) working, I'd to update to the latest 0.2.1-svn
version. Unfortunately Nepenthes now does not longer compile, because it tries
to access ssh_message->channel_request.command directly, and all struct
definitions have been moved to priv.h.

Short version: libssh does not provide a direct way to access
ssh_message->channel_request.command, which get set for
SSH_CHANNEL_REQUEST_EXEC requests and contains the requested command to execute.

The attached patch adds ssh_message_channel_request_command(). While valid for
0.2.1, it should also apply to 0.3 with small modifications.

PS: Please keep me CC on replies, I'm not subscribed to the list.


Br,
Peter


diff -up libssh-0.2.1/include/libssh/server.h.orig libssh-0.2.1/include/libssh/server.h
--- libssh-0.2.1/include/libssh/server.h.orig	2009-08-23 21:41:10.000000000 +0200
+++ libssh-0.2.1/include/libssh/server.h	2009-08-23 21:41:14.000000000 +0200
@@ -81,6 +81,7 @@
 // returns the TERM env variable
 char *ssh_message_channel_request_pty_term(SSH_MESSAGE *msg);
 char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg);
+char *ssh_message_channel_request_command(SSH_MESSAGE *msg);
 int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg);
 
 #endif
diff -up libssh-0.2.1/libssh/libssh.vers.orig libssh-0.2.1/libssh/libssh.vers
--- libssh-0.2.1/libssh/libssh.vers.orig	2009-08-23 21:39:11.000000000 +0200
+++ libssh-0.2.1/libssh/libssh.vers	2009-08-23 21:39:15.000000000 +0200
@@ -63,5 +63,6 @@
 SSH_0.2.1 {
     ssh_log;
     ssh_options_set_log_function; ssh_options_set_log_verbosity;
     ssh_auth_list; ssh_userauth_list;
+    ssh_message_channel_request_command;
 } SSH_0.2;
diff -up libssh-0.2.1/libssh/messages.c.orig libssh-0.2.1/libssh/messages.c
--- libssh-0.2.1/libssh/messages.c.orig	2009-08-23 14:39:18.000000000 +0200
+++ libssh-0.2.1/libssh/messages.c	2009-08-23 21:36:19.000000000 +0200
@@ -310,6 +310,10 @@ char *ssh_message_channel_request_subsys
     return msg->channel_request.subsystem;
 }
 
+char *ssh_message_channel_request_command(SSH_MESSAGE *msg){
+    return msg->channel_request.command;
+}
+
 int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg){
     u32 channel;
     if(msg->channel_request.want_reply){

Follow-Ups:
Re: Access to ssh_message->channel_request.commandAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org