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