xref: /original-bsd/lib/libcompat/4.3/rexec.3 (revision 05bf53f3)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)rexec.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt REXEC 3
10.Os BSD 4.2
11.Sh NAME
12.Nm rexec
13.Nd return stream to a remote command
14.Sh SYNOPSIS
15.Ft int
16.Fn rexec ahost "int inport" "char *user" "char *passwd" "char *cmd" "int *fd2p"
17.Sh DESCRIPTION
18.Bf -symbolic
19This interface is obsoleted by krcmd(3).
20It is available from the compatibility library, libcompat.
21.Ef
22.Pp
23The
24.Fn rexec
25function
26looks up the host
27.Fa *ahost
28using
29.Xr gethostbyname 3 ,
30returning \-1 if the host does not exist.
31Otherwise
32.Fa *ahost
33is set to the standard name of the host.
34If a username and password are both specified, then these
35are used to authenticate to the foreign host; otherwise
36the environment and then the user's
37.Pa .netrc
38file in his
39home directory are searched for appropriate information.
40If all this fails, the user is prompted for the information.
41.Pp
42The port
43.Fa inport
44specifies which well-known
45.Tn DARPA
46Internet port to use for
47the connection; the call
48.Ql getservbyname(\\*qexec\\*q, \\*qtcp\\*q)
49(see
50.Xr getservent 3 )
51will return a pointer to a structure, which contains the
52necessary port.
53The protocol for connection is described in detail in
54.Xr rexecd 8 .
55.Pp
56If the connection succeeds,
57a socket in the Internet domain of type
58.Dv SOCK_STREAM
59is returned to
60the caller, and given to the remote command as
61.Em stdin
62and
63.Em stdout .
64If
65.Fa fd2p
66is non-zero, then an auxiliary channel to a control
67process will be setup, and a descriptor for it will be placed
68in
69.Fa *fd2p .
70The control process will return diagnostic
71output from the command (unit 2) on this channel, and will also
72accept bytes on this channel as being
73.Tn UNIX
74signal numbers, to be
75forwarded to the process group of the command.  The diagnostic
76information returned does not include remote authorization failure,
77as the secondary connection is set up after authorization has been
78verified.
79If
80.Fa fd2p
81is 0, then the
82.Em stderr
83(unit 2 of the remote
84command) will be made the same as the
85.Em stdout
86and no
87provision is made for sending arbitrary signals to the remote process,
88although you may be able to get its attention by using out-of-band data.
89.Sh SEE ALSO
90.Xr rcmd 3 ,
91.Xr rexecd 8
92.Sh HISTORY
93The
94.Fn rexec
95function appeared in
96.Bx 4.2 .
97