1*61241Sbostic.\" Copyright (c) 1983, 1991, 1993 2*61241Sbostic.\" The Regents of the University of California. All rights reserved. 320584Smckusick.\" 443565Strent.\" %sccs.include.redist.man% 520584Smckusick.\" 6*61241Sbostic.\" @(#)rexec.3 8.1 (Berkeley) 06/04/93 736749Sbostic.\" 848349Scael.Dd 948349Scael.Dt REXEC 3 1048349Scael.Os BSD 4.2 1148349Scael.Sh NAME 1248349Scael.Nm rexec 1348349Scael.Nd return stream to a remote command 1448349Scael.Sh SYNOPSIS 1548349Scael.Ft int 1648349Scael.Fn rexec ahost "int inport" "char *user" "char *passwd" "char *cmd" "int *fd2p" 1748349Scael.Sh DESCRIPTION 1848349Scael.Bf -symbolic 1940059SbosticThis interface is obsoleted by krcmd(3). 2040059SbosticIt is available from the compatibility library, libcompat. 2148349Scael.Ef 2248349Scael.Pp 2348349ScaelThe 2448349Scael.Fn rexec 2548349Scaelfunction 2620584Smckusicklooks up the host 2748349Scael.Fa *ahost 2820584Smckusickusing 2948349Scael.Xr gethostbyname 3 , 3020584Smckusickreturning \-1 if the host does not exist. 3120584SmckusickOtherwise 3248349Scael.Fa *ahost 3320584Smckusickis set to the standard name of the host. 3420584SmckusickIf a username and password are both specified, then these 3520584Smckusickare used to authenticate to the foreign host; otherwise 3620584Smckusickthe environment and then the user's 3748349Scael.Pa .netrc 3820584Smckusickfile in his 3920584Smckusickhome directory are searched for appropriate information. 4020584SmckusickIf all this fails, the user is prompted for the information. 4148349Scael.Pp 4220584SmckusickThe port 4348349Scael.Fa inport 4448349Scaelspecifies which well-known 4548349Scael.Tn DARPA 4648349ScaelInternet port to use for 4748349Scaelthe connection; the call 4848349Scael.Ql getservbyname(\\*qexec\\*q, \\*qtcp\\*q) 4948349Scael(see 5048349Scael.Xr getservent 3 ) 5120585Smckusickwill return a pointer to a structure, which contains the 5220585Smckusicknecessary port. 5320584SmckusickThe protocol for connection is described in detail in 5448349Scael.Xr rexecd 8 . 5548349Scael.Pp 5628174SkarelsIf the connection succeeds, 5748349Scaela socket in the Internet domain of type 5848349Scael.Dv SOCK_STREAM 5948349Scaelis returned to 6020584Smckusickthe caller, and given to the remote command as 6148349Scael.Em stdin 6220584Smckusickand 6348349Scael.Em stdout . 6420584SmckusickIf 6548349Scael.Fa fd2p 6627924Slepreauis non-zero, then an auxiliary channel to a control 6720584Smckusickprocess will be setup, and a descriptor for it will be placed 6820584Smckusickin 6948349Scael.Fa *fd2p . 7020584SmckusickThe control process will return diagnostic 7120584Smckusickoutput from the command (unit 2) on this channel, and will also 7248349Scaelaccept bytes on this channel as being 7348349Scael.Tn UNIX 7448349Scaelsignal numbers, to be 7520585Smckusickforwarded to the process group of the command. The diagnostic 7620585Smckusickinformation returned does not include remote authorization failure, 7720585Smckusickas the secondary connection is set up after authorization has been 7820585Smckusickverified. 7920584SmckusickIf 8048349Scael.Fa fd2p 8120584Smckusickis 0, then the 8248349Scael.Em stderr 8320584Smckusick(unit 2 of the remote 8420584Smckusickcommand) will be made the same as the 8548349Scael.Em stdout 8620584Smckusickand no 8720584Smckusickprovision is made for sending arbitrary signals to the remote process, 8820584Smckusickalthough you may be able to get its attention by using out-of-band data. 8948349Scael.Sh SEE ALSO 9048349Scael.Xr rcmd 3 , 9148349Scael.Xr rexecd 8 9248349Scael.Sh HISTORY 9348349ScaelThe 9448349Scael.Fn rexec 9548349Scaelfunction appeared in 9648349Scael.Bx 4.2 . 97