]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/rexec.3
share/mk/: distcheck: Run 'check' after 'build'
[thirdparty/man-pages.git] / man3 / rexec.3
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 2017-09-15 "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 **" ahost ", int " inport ", const char *" user ", "
49 .BI " const char *" passwd ", const char *" cmd ", int *" fd2p );
50 .PP
51 .BI "int rexec_af(char **" ahost ", int " inport ", const char *" user ", "
52 .BI " const char *" passwd ", const char *" cmd ", int *" fd2p ,
53 .BI " sa_family_t " af );
54 .fi
55 .PP
56 .BR rexec (),
57 .BR rexec_af ():
58 .nf
59 Since glibc 2.19:
60 _DEFAULT_SOURCE
61 In glibc up to and including 2.19:
62 _BSD_SOURCE
63 .fi
64 .SH DESCRIPTION
65 This interface is obsoleted by
66 .BR rcmd (3).
67 .PP
68 The
69 .BR rexec ()
70 function
71 looks up the host
72 .IR *ahost
73 using
74 .BR gethostbyname (3),
75 returning \-1 if the host does not exist.
76 Otherwise,
77 .IR *ahost
78 is set to the standard name of the host.
79 If a username and password are both specified, then these
80 are used to authenticate to the foreign host; otherwise
81 the environment and then the
82 .I .netrc
83 file in user's
84 home directory are searched for appropriate information.
85 If all this fails, the user is prompted for the information.
86 .PP
87 The port
88 .I inport
89 specifies which well-known DARPA Internet port to use for
90 the connection; the call
91 .I "getservbyname(""exec"", ""tcp"")"
92 (see
93 .BR getservent (3))
94 will return a pointer to a structure that contains the necessary port.
95 The protocol for connection is described in detail in
96 .BR rexecd (8).
97 .PP
98 If the connection succeeds,
99 a socket in the Internet domain of type
100 .BR SOCK_STREAM
101 is returned to
102 the caller, and given to the remote command as
103 .IR stdin
104 and
105 .IR stdout .
106 If
107 .I fd2p
108 is nonzero, then an auxiliary channel to a control
109 process will be setup, and a file descriptor for it will be placed
110 in
111 .IR *fd2p .
112 The control process will return diagnostic
113 output from the command (unit 2) on this channel, and will also
114 accept bytes on this channel as being UNIX signal numbers, to be
115 forwarded to the process group of the command.
116 The diagnostic
117 information returned does not include remote authorization failure,
118 as the secondary connection is set up after authorization has been
119 verified.
120 If
121 .I fd2p
122 is 0, then the
123 .IR stderr
124 (unit 2 of the remote
125 command) will be made the same as the
126 .IR stdout
127 and no
128 provision is made for sending arbitrary signals to the remote process,
129 although you may be able to get its attention by using out-of-band data.
130 .SS rexec_af()
131 The
132 .BR rexec ()
133 function works over IPv4
134 .RB ( AF_INET ).
135 By contrast, the
136 .BR rexec_af ()
137 function provides an extra argument,
138 .IR af ,
139 that allows the caller to select the protocol.
140 This argument can be specified as
141 .BR AF_INET ,
142 .BR AF_INET6 ,
143 or
144 .BR AF_UNSPEC
145 (to allow the implementation to select the protocol).
146 .SH VERSIONS
147 The
148 .BR rexec_af ()
149 function was added to glibc in version 2.2.
150 .SH ATTRIBUTES
151 For an explanation of the terms used in this section, see
152 .BR attributes (7).
153 .TS
154 allbox;
155 lbw19 lb lb
156 l l l.
157 Interface Attribute Value
158 T{
159 .BR rexec (),
160 .BR rexec_af ()
161 T} Thread safety MT-Unsafe
162 .TE
163 .SH CONFORMING TO
164 These functions are not in POSIX.1.
165 The
166 .BR rexec ()
167 function first appeared in
168 4.2BSD, and is present on the BSDs, Solaris, and many other systems.
169 The
170 .BR rexec_af ()
171 function is more recent, and less widespread.
172 .SH BUGS
173 The
174 .BR rexec ()
175 function sends the unencrypted password across the network.
176 .PP
177 The underlying service is considered a big security hole and therefore
178 not enabled on many sites; see
179 .BR rexecd (8)
180 for explanations.
181 .SH SEE ALSO
182 .BR rcmd (3),
183 .BR rexecd (8)