xref: /netbsd-src/lib/libcompat/4.3/rexec.3 (revision 9fbd88883c38d0c0fbfcbe66d76fe6b0fab3f9de)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     from: @(#)rexec.3	8.1 (Berkeley) 6/4/93
33.\"	$NetBSD: rexec.3,v 1.9 1999/07/02 15:16:41 simonb Exp $
34.\"
35.Dd June 4, 1993
36.Dt REXEC 3
37.Os
38.Sh NAME
39.Nm rexec
40.Nd return stream to a remote command
41.Sh LIBRARY
42.Lb libcompat
43.Sh SYNOPSIS
44.Ft int
45.Fn rexec "char **ahost" "int inport" "char *user" "char *passwd" "char *cmd" "int *fd2p"
46.Sh DESCRIPTION
47.Bf -symbolic
48This interface is obsoleted by the
49.Tn Kerberos
50.Xr krcmd 3 .
51It is available from the compatibility library, libcompat.
52.Ef
53.Pp
54The
55.Fn rexec
56function
57looks up the host
58.Fa *ahost
59using
60.Xr gethostbyname 3 ,
61returning \-1 if the host does not exist.
62Otherwise
63.Fa *ahost
64is set to the standard name of the host.
65If a username and password are both specified, then these
66are used to authenticate to the foreign host; otherwise
67the environment and then the user's
68.Pa .netrc
69file in his
70home directory are searched for appropriate information.
71If all this fails, the user is prompted for the information.
72.Pp
73The port
74.Fa inport
75specifies which well-known
76.Tn DARPA
77Internet port to use for
78the connection; the call
79.Ql getservbyname(\\*qexec\\*q, \\*qtcp\\*q)
80(see
81.Xr getservent 3 )
82will return a pointer to a structure, which contains the
83necessary port.
84The protocol for connection is described in detail in
85.Xr rexecd 8 .
86.Pp
87If the connection succeeds,
88a socket in the Internet domain of type
89.Dv SOCK_STREAM
90is returned to
91the caller, and given to the remote command as
92.Em stdin
93and
94.Em stdout .
95If
96.Fa fd2p
97is non-zero, then an auxiliary channel to a control
98process will be setup, and a descriptor for it will be placed
99in
100.Fa *fd2p .
101The control process will return diagnostic
102output from the command (unit 2) on this channel, and will also
103accept bytes on this channel as being
104.Ux
105signal numbers, to be
106forwarded to the process group of the command.  The diagnostic
107information returned does not include remote authorization failure,
108as the secondary connection is set up after authorization has been
109verified.
110If
111.Fa fd2p
112is 0, then the
113.Em stderr
114(unit 2 of the remote
115command) will be made the same as the
116.Em stdout
117and no
118provision is made for sending arbitrary signals to the remote process,
119although you may be able to get its attention by using out-of-band data.
120.Sh SEE ALSO
121.Xr rcmd 3 ,
122.Xr rexecd 8
123.Sh HISTORY
124The
125.Fn rexec
126function appeared in
127.Bx 4.2 .
128