OSDN Git Service

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