🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sequent
Article #429

Re: porting programs invoked by inetd to ptx?

#429
From: Tim Wright
Date: Tue, 29 Sep 1992 11:35
32 lines
1917 bytes
In <BvB8DE.40y@news.cso.uiuc.edu> paul@uxc.cso.uiuc.edu (Paul Pomes - UofIllinois CSO) writes:

>Does anyone have a porting guide for programs meant to be invoked by inetd?

>I've already learned that the ptx inetd doesn't provide the client program
>with the actual socket.  This breaks programs that count on using the
>getpeername() call to learn about the remote end.  No problem, just use
>the getpeerinaddr() call (*sigh*).

inetd retruns a TLI endpoint. The top of the stream has "timod" pushed,
so the hackers guide to porting code meant to run under inetd is:
ioctl(s, I_POP, "timod");
ioctl(s, I_PUSH, "sockmod");
at which point you have a socket, and all your usual code should work.
Warning: this works for me under TCP 2.1 and 2.2.1, but I cannot guarantee
that it will always do so. If you just want a TLI endpoint that you
can read and write on, you just pop "timod", and push "tirdwr" instead.
Hope this makes things easier for you.

>I've also noted the lack of seteuid().
>Can setuid() replace it if the system supports _POSIX_SAVED_IDS?

Hmmm, not sure. You can always do some ugly footwork with fork().

Regards,

Tim
-- 
Tim Wright, Sequent Computer Systems Ltd.,        |  Email: timw@lonsqnt.co.uk
Customer Services, Allied Dunbar House,           |   or    timw@sequent.com
Chilsey Green Rd., Chertsey, Surrey, UK, KT16 9HB |  Phone: +44-932-568900
"I've got a set of teeth that druids could worship at" - Cat, Red Dwarf
Technical Details
Message-ID: <1992Sep29.113527.10193@sequent.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!sequent!muncher.sequent.com!timw
References: <BvB8DE.40y@news.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.sequent
Path: arc1-ca.pugleaf.net!sparky!uunet!sequent!muncher.sequent.com!timw
From: timw@sequent.com (Tim Wright)
Subject: Re: porting programs invoked by inetd to ptx?
Message-ID: <1992Sep29.113527.10193@sequent.com>
Sender: usenet@sequent.com (usenet )
Nntp-Posting-Host: time1.sequent.com
Organization: Sequent Computer Systems, Inc.
References: <BvB8DE.40y@news.cso.uiuc.edu>
Date: Tue, 29 Sep 92 11:35:27 GMT
Lines: 32