OpenSSH
[Top] [All Lists]

bending openssh output

To: openssh-unix-dev@mindrot.org
Subject: bending openssh output
From: marner <d.marner@mikro-software.de>
Date: Fri, 02 Mar 2007 10:17:28 +0100
Delivered-to: sp-com-lists@consult.net
Delivered-to: openssh-unix-dev-list1@securepoint.com
Delivered-to: openssh-unix-dev-tmda@mindrot.org
Delivered-to: tmda@mindrot.org
List-archive: <http://lists.mindrot.org/pipermail/openssh-unix-dev>
List-help: <mailto:openssh-unix-dev-request@mindrot.org?subject=help>
List-id: Development of portable OpenSSH <openssh-unix-dev.mindrot.org>
List-post: <mailto:openssh-unix-dev@mindrot.org>
List-subscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=subscribe>
List-unsubscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=unsubscribe>
Old-delivered-to: openssh-unix-dev@mindrot.org
Organization: mikro-software.de
Reply-to: d.marner@mikro-software.de
Sender: openssh-unix-dev-bounces+openssh-unix-dev-list1=securepoint.com@mindrot.org
Hi there. 
I am not sure if this is the right place to address my question, but I
need someone how knows about the channel system of openssh. At the
moment, I try to modify the openssh source to fit to my needs. Therefore
I modified the openssh source so it can be called from my source like a
function (simply changed "void main()" to "void ssh()"). This works
perfect for the moment, but now comes the problem:

When I use openssh to build up a connection to a ssh server like this:
ssh -myparameter pass user@host "ls -al * | grep .txt"

I usually get a single line returned like 
-rw-r--r--  1 user group 1223 2007-01-01 08:00 mydata.txt

Now my question:
Where in the openssh source can I redirect the output of this line from
stdout to a string variable I use? (so I could modify/parse it before
writing it to stdout)

I tracked it down to the clients side of the source. Somewhere in
clientloop.c I think. I am not sure which way would be the best
approach... as far as I understand the source, there exists a set of
filedescriptors for writing and reading which are polled by select. But
modifying these could create problems with other functionalities of ssh.
I just want to redirecting the console output to my array. 

Any hints? (please don't ask why I am trying such difficult things
instead of redirecting stdout in the shell. it would take to long to
explain. Actually, it's a kind of Systemmonitoring Tool for
monitoring/controlling many clusternodes simultaneously. the only
requirement for all nodes which are to be monitored is a running openssh
daemon. 

I would be very happy if someone could help me a little...

daniel marner



_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

<Prev in Thread] Current Thread [Next in Thread>