]>
Commit | Line | Data |
---|---|---|
9a562e42 MK |
1 | .\" Copyright (c) 1983, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
3 | .\" | |
a9cd9cb7 | 4 | .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) |
9a562e42 MK |
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. | |
8c9302dc | 32 | .\" %%%LICENSE_END |
9a562e42 MK |
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 | .\" | |
0bd5e3de MK |
37 | .\" Taken from FreeBSD 5.4; not checked against Linux reality (mtk) |
38 | .\" | |
f9293d98 | 39 | .\" 2013-06-21, mtk, Converted from mdoc to man macros |
3233d665 | 40 | .\" |
4b8c67d9 | 41 | .TH REXEC 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
3233d665 | 42 | .SH NAME |
5e3431cd | 43 | rexec, rexec_af \- return stream to a remote command |
3233d665 MK |
44 | .SH SYNOPSIS |
45 | .nf | |
090e0f8c | 46 | .B #include <netdb.h> |
68e4db0a | 47 | .PP |
38cea4d1 RV |
48 | .BI "int rexec(char **" ahost ", int " inport ", const char *" user ", " |
49 | .BI " const char *" passwd ", const char *" cmd ", int *" fd2p ); | |
68e4db0a | 50 | .PP |
38cea4d1 RV |
51 | .BI "int rexec_af(char **" ahost ", int " inport ", const char *" user ", " |
52 | .BI " const char *" passwd ", const char *" cmd ", int *" fd2p , | |
4cd4a6f8 | 53 | .BI " sa_family_t " af ); |
3233d665 | 54 | .fi |
68e4db0a | 55 | .PP |
7f0ec8ee MK |
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 | |
3233d665 | 64 | .SH DESCRIPTION |
9a562e42 | 65 | This interface is obsoleted by |
3233d665 | 66 | .BR rcmd (3). |
847e0d88 | 67 | .PP |
9a562e42 | 68 | The |
3233d665 | 69 | .BR rexec () |
9a562e42 MK |
70 | function |
71 | looks up the host | |
3233d665 | 72 | .IR *ahost |
9a562e42 | 73 | using |
3233d665 | 74 | .BR gethostbyname (3), |
9a562e42 | 75 | returning \-1 if the host does not exist. |
2b9b829d | 76 | Otherwise, |
3233d665 | 77 | .IR *ahost |
9a562e42 MK |
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 | |
886ea57d | 81 | the environment and then the |
3233d665 | 82 | .I .netrc |
886ea57d | 83 | file in user's |
9a562e42 MK |
84 | home directory are searched for appropriate information. |
85 | If all this fails, the user is prompted for the information. | |
5ec60461 | 86 | .PP |
9a562e42 | 87 | The port |
3233d665 | 88 | .I inport |
f084be74 | 89 | specifies which well-known DARPA Internet port to use for |
9a562e42 | 90 | the connection; the call |
ad2f1d0b | 91 | .I "getservbyname(""exec"", ""tcp"")" |
9a562e42 | 92 | (see |
3233d665 | 93 | .BR getservent (3)) |
f084be74 | 94 | will return a pointer to a structure that contains the necessary port. |
9a562e42 | 95 | The protocol for connection is described in detail in |
3233d665 | 96 | .BR rexecd (8). |
5ec60461 | 97 | .PP |
9a562e42 MK |
98 | If the connection succeeds, |
99 | a socket in the Internet domain of type | |
3233d665 | 100 | .BR SOCK_STREAM |
9a562e42 MK |
101 | is returned to |
102 | the caller, and given to the remote command as | |
3233d665 | 103 | .IR stdin |
9a562e42 | 104 | and |
3233d665 | 105 | .IR stdout . |
9a562e42 | 106 | If |
3233d665 | 107 | .I fd2p |
c7094399 | 108 | is nonzero, then an auxiliary channel to a control |
d9cb0d7d | 109 | process will be setup, and a file descriptor for it will be placed |
9a562e42 | 110 | in |
3233d665 | 111 | .IR *fd2p . |
9a562e42 MK |
112 | The control process will return diagnostic |
113 | output from the command (unit 2) on this channel, and will also | |
008f1ecc | 114 | accept bytes on this channel as being UNIX signal numbers, to be |
9a562e42 MK |
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 | |
3233d665 | 121 | .I fd2p |
9a562e42 | 122 | is 0, then the |
3233d665 | 123 | .IR stderr |
9a562e42 MK |
124 | (unit 2 of the remote |
125 | command) will be made the same as the | |
3233d665 | 126 | .IR stdout |
9a562e42 MK |
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. | |
4cd4a6f8 MK |
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. | |
d5062112 | 150 | .SH ATTRIBUTES |
a852f4e0 PH |
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 (), | |
d5062112 | 160 | .BR rexec_af () |
a852f4e0 PH |
161 | T} Thread safety MT-Unsafe |
162 | .TE | |
47297adb | 163 | .SH CONFORMING TO |
407b8585 | 164 | These functions are not in POSIX.1. |
9a562e42 | 165 | The |
3233d665 | 166 | .BR rexec () |
4cd4a6f8 MK |
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 () | |
6336b547 | 171 | function is more recent, and less widespread. |
3233d665 | 172 | .SH BUGS |
9a562e42 | 173 | The |
3233d665 | 174 | .BR rexec () |
9a562e42 | 175 | function sends the unencrypted password across the network. |
5ec60461 | 176 | .PP |
9a562e42 | 177 | The underlying service is considered a big security hole and therefore |
ed987e2e | 178 | not enabled on many sites; see |
3233d665 | 179 | .BR rexecd (8) |
9a562e42 | 180 | for explanations. |
3233d665 MK |
181 | .SH SEE ALSO |
182 | .BR rcmd (3), | |
183 | .BR rexecd (8) |