From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 17 19:00:45 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1586116A407 for ; Wed, 17 Jan 2007 19:00:45 +0000 (UTC) (envelope-from ramadas@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.238]) by mx1.freebsd.org (Postfix) with ESMTP id C03F013C455 for ; Wed, 17 Jan 2007 19:00:44 +0000 (UTC) (envelope-from ramadas@gmail.com) Received: by wr-out-0506.google.com with SMTP id 36so1794853wra for ; Wed, 17 Jan 2007 11:00:44 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=oC5hXm6FyhjkbE/j+oC4H6ZO6rwq8uaQCLjM5N1lEeqfupsHmSY8PUdzcsucWnss1iLXo+X3eu8Qb0jjN34tcQvwk9x25ilzpf8nojYQ4LwDqmQ5Z/+1fVd+vxjV4bEktN/ig4Dp4w7lgksFLb+qzQF5CwLQl+LQgUqXhAUu20A= Received: by 10.90.79.6 with SMTP id c6mr6583893agb.1169060444027; Wed, 17 Jan 2007 11:00:44 -0800 (PST) Received: by 10.90.51.16 with HTTP; Wed, 17 Jan 2007 11:00:43 -0800 (PST) Message-ID: Date: Wed, 17 Jan 2007 11:00:43 -0800 From: "Kailas Ramasamy" Sender: ramadas@gmail.com To: "Mike Meyer" In-Reply-To: <17838.28502.527695.168624@bhuda.mired.org> MIME-Version: 1.0 References: <17837.25293.686122.147525@bhuda.mired.org> <17837.36471.343582.464631@bhuda.mired.org> <17838.28502.527695.168624@bhuda.mired.org> X-Google-Sender-Auth: 341e3c020e811eab Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Bridging console port to a telnet session X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 19:00:45 -0000 Hi Mike, Thanks a lot. This is what I was looking for. -Kailas On 1/17/07, Mike Meyer wrote: > > In , Kailas > Ramasamy typed: > > Hi Mike, > > I read through fork() and exec() man pages but I couldn't find anything > > related to > > this. Basically, I want to launch a telnet session from a process and > pass > > in > > /dev/console as stdin and stdout. > > Well, you don't really need fork(), though fork() follows exec() so > often than some OS's combine them into a single call. And I just > noticed that if you do "man exec", you get the shell's page - you want > exec(3), to get the C calls. > > Anyway, the sequence is: > > Use open() to get an fd pointing at /dev/console. > Use dup2() to copy that fd to stdin and stdout (and probably stderr). > Use an exec() function to launch telnet. > > > > > Thanks > > Kailas > > > > On 1/16/07, Mike Meyer wrote: > > > > > > In , > Kailas > > > Ramasamy typed: > > > > Hi Mike, > > > > Yes, that what I am planing but I want to do this dynamically. Do > you > > > know > > > > how to launch a > > > > telnet session from a process?. How do I pass stdin and stdout to > the > > > telnet > > > > from a process?. > > > > > > See the fork() and exec() man pages. > > > > > > > > > > > > > > > On 1/16/07, Mike Meyer wrote: > > > > > > > > > > In , > > > Kailas > > > > > Ramasamy typed: > > > > > > Hi, > > > > > > Within a FreeBSD system, I want to telnet to another system and > > > bridge > > > > > that > > > > > > session to the > > > > > > console port so that when an user connects to the system via > console > > > > > port, > > > > > > it is automatically > > > > > > redirected to other system for I have already established a > telnet > > > > > session. > > > > > > > > > > What's wrong with simply leaving a telnet session running on the > > > > > console, maybe with some support to relaunch it should it ever > exit? > > > > > > > > > > > > > > -- > > > > > Mike Meyer > > > > > http://www.mired.org/consulting.html > > > > > Independent Network/Unix/Perforce consultant, email for more > > > information. > > > > > > > > > _______________________________________________ > > > > freebsd-hackers@freebsd.org mailing list > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > > To unsubscribe, send any mail to " > > > freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > > > > -- > > > Mike Meyer > > > http://www.mired.org/consulting.html > > > Independent Network/Unix/Perforce consultant, email for more > information. > > > > > Hi Mike,
I read through fork() and exec() man pages but I > couldn't find anything related to
this. Basically, I want to launch a > telnet session from a process and pass in
/dev/console as stdin and > stdout.
> >
Thanks
Kailas

On 1/16/07, > Mike Meyer <mwm@mired.org> wrote:
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); > margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > > In < > ecd0bee40701161732v26112f24o2d8323c2777d2f7@mail.gmail.com>, Kailas > Ramasamy <kailasr@gmail.com > > > typed:
> Hi Mike,
> Yes, that what I am planing but > I want to do this dynamically. Do you know
> how to launch a
> > telnet session from a process?. How do I pass stdin and stdout to the telnet > >
> from a process?.

See the fork() and exec() man > pages.

        <mike


> > On 1/16/07, Mike Meyer <mwm@mired.org> > wrote:
> >
> > In < > > > ecd0bee40701161503k385819ddgba5562e137630617@mail.gmail.com>, > Kailas
> > Ramasamy < > kailasr@gmail.com > > > typed:
> > > Hi,
> > > Within a FreeBSD > system, I want to telnet to another system and bridge
> > > that
> > > session to the
> > > console port so that > when an user connects to the system via console > >
> > port,
> > > it is automatically
> > > > redirected to other system for I have already established a > telnet
> > session.
> >
> > What's wrong with > simply leaving a telnet session running on the > >
> > console, maybe with some support to relaunch it should it > ever exit?
> >
> > >         <mike
> > > --
> > Mike Meyer < > mwm@mired.org> > >
> > > http://www.mired.org/consulting.html
> > Independent > Network/Unix/Perforce consultant, email for more information.
> > >
> _______________________________________________ > >
> > freebsd-hackers@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >
> To unsubscribe, send any mail to " > freebsd-hackers-unsubscribe@freebsd.org"
>

--
Mike > Meyer < > > mwm@mired.org>               href="http://www.mired.org/consulting.html"> > http://www.mired.org/consulting.html
Independent > Network/Unix/Perforce consultant, email for more > information.
> >
> > -- > Mike Meyer > http://www.mired.org/consulting.html > Independent Network/Unix/Perforce consultant, email for more information. >