From owner-freebsd-questions@FreeBSD.ORG Wed Jan 17 19:49:58 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D9E516A416 for ; Wed, 17 Jan 2007 19:49:58 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout2.cac.washington.edu (mxout2.cac.washington.edu [140.142.33.4]) by mx1.freebsd.org (Postfix) with ESMTP id 45F1613C448 for ; Wed, 17 Jan 2007 19:49:58 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout2.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id l0HJnv9n012526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Jan 2007 11:49:57 -0800 X-Auth-Received: from [128.208.7.63] (pinocchio.dyn.cs.washington.edu [128.208.7.63]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id l0HJnvVA004219 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Wed, 17 Jan 2007 11:49:57 -0800 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: <17837.25293.686122.147525@bhuda.mired.org> <17837.36471.343582.464631@bhuda.mired.org> <17838.28502.527695.168624@bhuda.mired.org> X-Gpgmail-State: !signed Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8D661BA7-09AF-4F82-B4A0-0FA5E4CA9CA3@u.washington.edu> Content-Transfer-Encoding: 7bit From: Garrett Cooper Date: Wed, 17 Jan 2007 11:49:57 -0800 To: FreeBSD Questions X-Mailer: Apple Mail (2.752.2) X-PMX-Version: 5.2.2.285561, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2007.1.17.113432 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0' Subject: Re: Bridging console port to a telnet session X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 19:49:58 -0000 On Jan 17, 2007, at 11:00 AM, Kailas Ramasamy wrote: > 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> a>>, 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.

        <mik >> e


> >> On 1/16/07, Mike Meyer <> href="mailto:mwm@mired.org">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.
> >> >
> >> >> -- >> Mike Meyer >> http://www.mired.org/consulting.html >> Independent Network/Unix/Perforce consultant, email for more >> information. Kailas cross posted this to the questions@ list too. I gave a possible answer there. -Garrett