1 .\" Copyright (c) 1983 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)rcmd.3 6.7 (Berkeley) 5/14/86
7 .TH RCMD 3 "May 14, 1986"
10 rcmd, rresvport, ruserok \- routines for returning a stream to a remote command
13 .B "#include <sys/types.h>"
14 .B "#include <net/netlib.h>"
16 .B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);"
19 .B "char *locuser, *remuser, *cmd;"
22 .B s = rresvport(port);
25 .B "ruserok(rhost, superuser, ruser, luser);"
28 .B char *ruser, *luser;
32 is a routine used by the super-user to execute a command on
33 a remote machine using an authentication scheme based
34 on reserved port numbers.
36 is a routine which returns a descriptor to a socket
37 with an address in the privileged port space.
39 is a routine used by servers
40 to authenticate clients requesting service with
42 All three functions are present in the same file and are used
45 server (among others).
51 .IR gethostbyname (3),
52 returning \-1 if the host does not exist.
55 is set to the standard name of the host
56 and a connection is established to a server
57 residing at the well-known Internet port
60 If the connection succeeds,
61 a socket in the Internet domain of type SOCK_STREAM
62 is returned to the caller, and given to the remote
69 is non-zero, then an auxiliary channel to a control
70 process will be set up, and a descriptor for it will be placed
73 The control process will return diagnostic
74 output from the command (unit 2) on this channel, and will also
75 accept bytes on this channel as being UNIX signal numbers, to be
76 forwarded to the process group of the command.
82 command) will be made the same as the
85 provision is made for sending arbitrary signals to the remote process,
86 although you may be able to get its attention by using out-of-band data.
88 The protocol is described in detail in
93 routine is used to obtain a socket with a privileged
94 address bound to it. This socket is suitable for use
97 and several other routines. Privileged Internet ports are those
98 in the range 0 to 1023. Only the super-user
99 is allowed to bind an address of this sort to a socket.
102 takes a remote host's name, as returned by a
103 .IR gethostbyaddr (3)
104 routine, two user names and a flag indicating whether
105 the local user's name is that of the super-user. It then
110 in the current working directory (normally the local
111 user's home directory) to see if the request for
112 service is allowed. A 0 is returned if the machine
113 name is listed in the ``hosts.equiv'' file, or the
114 host and remote user name are found in the ``.rhosts''
119 flag is 1, the checking of the ``host.equiv'' file is
121 If the local domain (as obtained from \fIgethostname\fP\|(3))
122 is the same as the remote domain, only the machine name need be specified.
133 returns a valid socket descriptor on success.
134 It returns -1 on error and prints a diagnostic message on the standard error.
137 returns a valid, bound socket descriptor on success.
138 It returns -1 on error with the global value
140 set according to the reason for failure.
141 The error code EAGAIN is overloaded to mean ``All network ports in use.''