1 .\" $NetBSD: rcmd.3,v 1.26 2005/03/31 15:45:53 christos Exp $
3 .\" Copyright (c) 1983, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)rcmd.3 8.1 (Berkeley) 6/4/93
45 .Nd routines for returning a stream to a remote command
51 .Fn rcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p"
53 .Fn orcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p"
55 .Fn rcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af"
57 .Fn orcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af"
59 .Fn rresvport "int *port"
61 .Fn rresvport_af "int *port" "int family"
63 .Fn iruserok "uint32_t raddr" "int superuser" "const char *ruser" "const char *luser"
65 .Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser"
67 .Fn iruserok_sa "const void *raddr" "int rlen" "int superuser" "const char *ruser" "const char *luser"
71 function is available for use by anyone to run commands on a
72 remote system. It acts like the
74 command, with the exception that it makes a call out to the
76 command, or any other user-specified command, to perform the
77 actual connection (thus not requiring
78 that the caller be running as the super-user), and is only
85 is used by the super-user to execute a command on
86 a remote machine using an authentication scheme based
87 on reserved port numbers.
92 can only handle IPv4 address in the first argument,
96 can handle other cases as well.
100 returns a descriptor to a socket
101 with an address in the privileged port space.
104 function is similar to
106 but you can explicitly specify the address family to use.
111 has the same effect as
117 functions are used by servers
118 to authenticate clients requesting service with
120 All six functions are present in the same file and are used
123 server (among others).
125 is an address family independent variant of
134 .Xr gethostbyname 3 ,
135 returning \-1 if the host does not exist.
138 is set to the standard name of the host
139 and a connection is established to a server
140 residing at the well-known Internet port
143 If the connection succeeds,
144 a socket in the Internet domain of type
146 is returned to the caller, and given to the remote
153 is non-zero, then an auxiliary channel to a control
154 process will be set up, and a descriptor for it will be placed
157 The control process will return diagnostic
158 output from the command (unit 2) on this channel, and will also
159 accept bytes on this channel as being
161 signal numbers, to be
162 forwarded to the process group of the command.
167 (unit 2 of the remote
168 command) will be made the same as the
171 provision is made for sending arbitrary signals to the remote process,
172 although you may be able to get its attention by using out-of-band data.
177 take address family in the last argument.
178 If the last argument is
182 will obey the underlying address resolution like DNS.
184 The protocol is described in detail in
191 functions are used to obtain a socket with a privileged
192 address bound to it. This socket is suitable for use
195 and several other functions. Privileged Internet ports are those
196 in the range 0 to 1023. Only the super-user
197 is allowed to bind an address of this sort to a socket.
203 functions take a remote host's IP address or name, respectively,
204 two user names and a flag indicating whether the local user's
205 name is that of the super-user.
208 the super-user, it checks the
211 If that lookup is not done, or is unsuccessful, the
213 in the local user's home directory is checked to see if the request for
216 If this file does not exist, is not a regular file, is owned by anyone
217 other than the user or the super-user, or is writable by anyone other
218 than the owner, the check automatically fails.
219 Zero is returned if the machine name is listed in the
221 file, or the host and remote user name are found in the
228 If the local domain (as obtained from
230 is the same as the remote domain, only the machine name need be specified.
232 If the IP address of the remote host is known,
234 should be used in preference to
236 as it does not require trusting the DNS server for the remote host's domain.
240 can handle IPv4 addresses only,
244 can handle other address families as well, like IPv6.
245 The first argument of
249 to avoid dependency between
252 .Aq Li sys/socket.h .
254 .Bl -tag -width RCMD_CMDxx -compact
258 function, this variable is used as the program to run instead of
265 returns a valid socket descriptor on success.
266 It returns \-1 on error and prints a diagnostic message on the standard error.
273 return a valid, bound socket descriptor on success.
274 They return \-1 on error with the global value
276 set according to the reason for failure.
279 is overloaded to mean ``All network ports in use.''
298 functions appeared in
311 were defined in RFC2292.