]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/rexec.3
62d6c24f7e211be40ec8b5d10e115a4d775c3c4d
[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 .\" SPDX-License-Identifier: BSD-4-Clause-UC
5 .\"
6 .\" @(#)rexec.3 8.1 (Berkeley) 6/4/93
7 .\" $FreeBSD: src/lib/libcompat/4.3/rexec.3,v 1.12 2004/07/02 23:52:14 ru Exp $
8 .\"
9 .\" Taken from FreeBSD 5.4; not checked against Linux reality (mtk)
10 .\"
11 .\" 2013-06-21, mtk, Converted from mdoc to man macros
12 .\"
13 .TH REXEC 3 2021-03-22 "Linux" "Linux Programmer's Manual"
14 .SH NAME
15 rexec, rexec_af \- return stream to a remote command
16 .SH LIBRARY
17 Standard C library
18 .RI ( libc ", " \-lc )
19 .SH SYNOPSIS
20 .nf
21 .B #include <netdb.h>
22 .PP
23 .BI "int rexec(char **restrict " ahost ", int " inport ,
24 .BI " const char *restrict " user ", const char *restrict " passwd ,
25 .BI " const char *restrict " cmd ", int *restrict " fd2p );
26 .BI "int rexec_af(char **restrict " ahost ", int " inport ,
27 .BI " const char *restrict " user ", const char *restrict " passwd ,
28 .BI " const char *restrict " cmd ", int *restrict " fd2p ,
29 .BI " sa_family_t " af );
30 .fi
31 .PP
32 .BR rexec (),
33 .BR rexec_af ():
34 .nf
35 Since glibc 2.19:
36 _DEFAULT_SOURCE
37 In glibc up to and including 2.19:
38 _BSD_SOURCE
39 .fi
40 .SH DESCRIPTION
41 This interface is obsoleted by
42 .BR rcmd (3).
43 .PP
44 The
45 .BR rexec ()
46 function
47 looks up the host
48 .IR *ahost
49 using
50 .BR gethostbyname (3),
51 returning \-1 if the host does not exist.
52 Otherwise,
53 .IR *ahost
54 is set to the standard name of the host.
55 If a username and password are both specified, then these
56 are used to authenticate to the foreign host; otherwise
57 the environment and then the
58 .I .netrc
59 file in user's
60 home directory are searched for appropriate information.
61 If all this fails, the user is prompted for the information.
62 .PP
63 The port
64 .I inport
65 specifies which well-known DARPA Internet port to use for
66 the connection; the call
67 .I "getservbyname(""exec"", ""tcp"")"
68 (see
69 .BR getservent (3))
70 will return a pointer to a structure that contains the necessary port.
71 The protocol for connection is described in detail in
72 .BR rexecd (8).
73 .PP
74 If the connection succeeds,
75 a socket in the Internet domain of type
76 .BR SOCK_STREAM
77 is returned to
78 the caller, and given to the remote command as
79 .IR stdin
80 and
81 .IR stdout .
82 If
83 .I fd2p
84 is nonzero, then an auxiliary channel to a control
85 process will be setup, and a file descriptor for it will be placed
86 in
87 .IR *fd2p .
88 The control process will return diagnostic
89 output from the command (unit 2) on this channel, and will also
90 accept bytes on this channel as being UNIX signal numbers, to be
91 forwarded to the process group of the command.
92 The diagnostic
93 information returned does not include remote authorization failure,
94 as the secondary connection is set up after authorization has been
95 verified.
96 If
97 .I fd2p
98 is 0, then the
99 .IR stderr
100 (unit 2 of the remote
101 command) will be made the same as the
102 .IR stdout
103 and no
104 provision is made for sending arbitrary signals to the remote process,
105 although you may be able to get its attention by using out-of-band data.
106 .SS rexec_af()
107 The
108 .BR rexec ()
109 function works over IPv4
110 .RB ( AF_INET ).
111 By contrast, the
112 .BR rexec_af ()
113 function provides an extra argument,
114 .IR af ,
115 that allows the caller to select the protocol.
116 This argument can be specified as
117 .BR AF_INET ,
118 .BR AF_INET6 ,
119 or
120 .BR AF_UNSPEC
121 (to allow the implementation to select the protocol).
122 .SH VERSIONS
123 The
124 .BR rexec_af ()
125 function was added to glibc in version 2.2.
126 .SH ATTRIBUTES
127 For an explanation of the terms used in this section, see
128 .BR attributes (7).
129 .ad l
130 .nh
131 .TS
132 allbox;
133 lbx lb lb
134 l l l.
135 Interface Attribute Value
136 T{
137 .BR rexec (),
138 .BR rexec_af ()
139 T} Thread safety MT-Unsafe
140 .TE
141 .hy
142 .ad
143 .sp 1
144 .SH CONFORMING TO
145 These functions are not in POSIX.1.
146 The
147 .BR rexec ()
148 function first appeared in
149 4.2BSD, and is present on the BSDs, Solaris, and many other systems.
150 The
151 .BR rexec_af ()
152 function is more recent, and less widespread.
153 .SH BUGS
154 The
155 .BR rexec ()
156 function sends the unencrypted password across the network.
157 .PP
158 The underlying service is considered a big security hole and therefore
159 not enabled on many sites; see
160 .BR rexecd (8)
161 for explanations.
162 .SH SEE ALSO
163 .BR rcmd (3),
164 .BR rexecd (8)