1 .\" Copyright (c) 1983, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
46 .Nd routines for returning a stream to a remote command
48 .Fd #include <unistd.h>
50 .Fn rcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p"
52 .Fn rresvport "int *port"
54 .Fn iruserok "u_long raddr" "int superuser" "const char *ruser" "const char *luser"
56 .Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser"
58 .Fn rresvport_af "int *port" "int family"
60 .Fn iruserok_af "void *raddr" "int superuser" "const char *ruser" "const char *luser" "int af"
62 .Fn ruserok_af "const char *rhost" "int superuser" "const char *ruser" "const char *luser" "int af"
67 is used by the super-user to execute a command on
68 a remote machine using an authentication scheme based
69 on reserved port numbers.
73 returns a descriptor to a socket
74 with an address in the privileged port space.
79 to authenticate clients requesting service with
81 All three functions are present in the same file and are used
84 server (among others).
93 returning \-1 if the host does not exist.
96 is set to the standard name of the host
97 and a connection is established to a server
98 residing at the well-known Internet port
101 If the connection succeeds,
102 a socket in the Internet domain of type
104 is returned to the caller, and given to the remote
111 is non-zero, then an auxiliary channel to a control
112 process will be set up, and a descriptor for it will be placed
115 The control process will return diagnostic
116 output from the command (unit 2) on this channel, and will also
117 accept bytes on this channel as being
119 signal numbers, to be
120 forwarded to the process group of the command.
125 (unit 2 of the remote
126 command) will be made the same as the
129 provision is made for sending arbitrary signals to the remote process,
130 although you may be able to get its attention by using out-of-band data.
132 The protocol is described in detail in
137 function is used to obtain a socket with a privileged
138 address bound to it. This socket is suitable for use
141 and several other functions. Privileged Internet ports are those
142 in the range 0 to 1023. Only the super-user
143 is allowed to bind an address of this sort to a socket.
149 functions take a remote host's IP address or name, as returned by the
151 routines, two user names and a flag indicating whether the local user's
152 name is that of the super-user.
155 the super-user, it checks the
158 If that lookup is not done, or is unsuccessful, the
160 in the local user's home directory is checked to see if the request for
163 If this file does not exist, is not a regular file, is owned by anyone
164 other than the user or the super-user, or is writable by anyone other
165 than the owner, the check automatically fails.
166 Zero is returned if the machine name is listed in the
168 file, or the host and remote user name are found in the
175 If the local domain (as obtained from
177 is the same as the remote domain, only the machine name need be specified.
181 function is strongly preferred for security reasons.
182 It requires trusting the local DNS at most, while the
184 function requires trusting the entire DNS, which can be spoofed.
186 Functions with ``_af'' suffix, i.e.
190 works just as same as functions without ``_af'', and is capable of
191 handling both IPv6 port and IPv4 port.
192 To switch address family,
194 argument must be filled with
202 returns a valid socket descriptor on success.
203 It returns \-1 on error and prints a diagnostic message on the standard error.
208 returns a valid, bound socket descriptor on success.
209 It returns \-1 on error with the global value
211 set according to the reason for failure.
214 is overloaded to mean ``All network ports in use.''
224 W. Stevens and M. Thomas, ``Advanced Socket API for IPv6,''
228 functions appeared in
231 appeared in RFC2292, and implemented by WIDE project
232 for Hydrangea IPv6 protocol stack kit.
236 are proposed and implemented by WIDE project
237 for Hydrangea IPv6 protocol stack kit.