mount_setattr.2: Minor tweaks to Christian's patch
[man-pages.git] / man3 / rexec.3
blob37e7ab6493fcd93d5a0b27694786719ac24e746f
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by the University of
16 .\"     California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\" %%%LICENSE_END
33 .\"
34 .\"     @(#)rexec.3     8.1 (Berkeley) 6/4/93
35 .\" $FreeBSD: src/lib/libcompat/4.3/rexec.3,v 1.12 2004/07/02 23:52:14 ru Exp $
36 .\"
37 .\" Taken from FreeBSD 5.4; not checked against Linux reality (mtk)
38 .\"
39 .\" 2013-06-21, mtk, Converted from mdoc to man macros
40 .\"
41 .TH REXEC 3 2021-03-22 "Linux" "Linux Programmer's Manual"
42 .SH NAME
43 rexec, rexec_af \- return stream to a remote command
44 .SH SYNOPSIS
45 .nf
46 .B #include <netdb.h>
47 .PP
48 .BI "int rexec(char **restrict " ahost ", int " inport ,
49 .BI "          const char *restrict " user ", const char *restrict " passwd ,
50 .BI "          const char *restrict " cmd ", int *restrict " fd2p );
51 .BI "int rexec_af(char **restrict " ahost ", int " inport ,
52 .BI "          const char *restrict " user ", const char *restrict " passwd ,
53 .BI "          const char *restrict " cmd ", int *restrict " fd2p ,
54 .BI "          sa_family_t " af  );
55 .fi
56 .PP
57 .BR rexec (),
58 .BR rexec_af ():
59 .nf
60     Since glibc 2.19:
61         _DEFAULT_SOURCE
62     In glibc up to and including 2.19:
63         _BSD_SOURCE
64 .fi
65 .SH DESCRIPTION
66 This interface is obsoleted by
67 .BR rcmd (3).
68 .PP
69 The
70 .BR rexec ()
71 function
72 looks up the host
73 .IR *ahost
74 using
75 .BR gethostbyname (3),
76 returning \-1 if the host does not exist.
77 Otherwise,
78 .IR *ahost
79 is set to the standard name of the host.
80 If a username and password are both specified, then these
81 are used to authenticate to the foreign host; otherwise
82 the environment and then the
83 .I .netrc
84 file in user's
85 home directory are searched for appropriate information.
86 If all this fails, the user is prompted for the information.
87 .PP
88 The port
89 .I inport
90 specifies which well-known DARPA Internet port to use for
91 the connection; the call
92 .I "getservbyname(""exec"", ""tcp"")"
93 (see
94 .BR getservent (3))
95 will return a pointer to a structure that contains the necessary port.
96 The protocol for connection is described in detail in
97 .BR rexecd (8).
98 .PP
99 If the connection succeeds,
100 a socket in the Internet domain of type
101 .BR SOCK_STREAM
102 is returned to
103 the caller, and given to the remote command as
104 .IR stdin
106 .IR stdout .
108 .I fd2p
109 is nonzero, then an auxiliary channel to a control
110 process will be setup, and a file descriptor for it will be placed
112 .IR *fd2p .
113 The control process will return diagnostic
114 output from the command (unit 2) on this channel, and will also
115 accept bytes on this channel as being UNIX signal numbers, to be
116 forwarded to the process group of the command.
117 The diagnostic
118 information returned does not include remote authorization failure,
119 as the secondary connection is set up after authorization has been
120 verified.
122 .I fd2p
123 is 0, then the
124 .IR stderr
125 (unit 2 of the remote
126 command) will be made the same as the
127 .IR stdout
128 and no
129 provision is made for sending arbitrary signals to the remote process,
130 although you may be able to get its attention by using out-of-band data.
131 .SS rexec_af()
133 .BR rexec ()
134 function works over IPv4
135 .RB ( AF_INET ).
136 By contrast, the
137 .BR rexec_af ()
138 function provides an extra argument,
139 .IR af ,
140 that allows the caller to select the protocol.
141 This argument can be specified as
142 .BR AF_INET ,
143 .BR AF_INET6 ,
145 .BR AF_UNSPEC
146 (to allow the implementation to select the protocol).
147 .SH VERSIONS
149 .BR rexec_af ()
150 function was added to glibc in version 2.2.
151 .SH ATTRIBUTES
152 For an explanation of the terms used in this section, see
153 .BR attributes (7).
154 .ad l
157 allbox;
158 lbx lb lb
159 l l l.
160 Interface       Attribute       Value
162 .BR rexec (),
163 .BR rexec_af ()
164 T}      Thread safety   MT-Unsafe
168 .sp 1
169 .SH CONFORMING TO
170 These functions are not in POSIX.1.
172 .BR rexec ()
173 function first appeared in
174 4.2BSD, and is present on the BSDs, Solaris, and many other systems.
176 .BR rexec_af ()
177 function is more recent, and less widespread.
178 .SH BUGS
180 .BR rexec ()
181 function sends the unencrypted password across the network.
183 The underlying service is considered a big security hole and therefore
184 not enabled on many sites; see
185 .BR rexecd (8)
186 for explanations.
187 .SH SEE ALSO
188 .BR rcmd (3),
189 .BR rexecd (8)