Annotation of cci/usr/src/man/man3/rcmd.3x, revision 1.1.1.1

1.1       root        1: .TH RCMD 3X "17 March 1982"
                      2: .UC 4
                      3: .SH NAME
                      4: rcmd, rresvport, ruserok \- routines for returning a stream to a remote command
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);"
                      8: .B char **ahost;
                      9: .B u_short inport;
                     10: .B "char *locuser, *remuser, *cmd;"
                     11: .B int *fd2p;
                     12: .PP
                     13: .B s = rresvport(port);
                     14: .B int *port;
                     15: .PP
                     16: .B "ruserok(rhost, superuser, ruser, luser);"
                     17: .B char *rhost;
                     18: .B int superuser;
                     19: .B char *ruser, *luser;
                     20: .fi
                     21: .SH DESCRIPTION
                     22: .I Rcmd
                     23: is a routine used by the super-user to execute a command on
                     24: a remote machine using an authentication scheme based
                     25: on reserved port numbers.
                     26: .I Rresvport
                     27: is a routine which returns a descriptor to a socket
                     28: with an address in the privileged port space.
                     29: .I Ruserok
                     30: is a routine used by servers
                     31: to authenticate clients requesting service with
                     32: .IR rcmd .
                     33: All three functions are present in the same file and are used
                     34: by the
                     35: .IR rshd (8C)
                     36: server (among others).
                     37: .PP
                     38: .I Rcmd
                     39: looks up the host
                     40: .I *ahost
                     41: using
                     42: .IR gethostbyname (3N),
                     43: returning \-1 if the host does not exist.
                     44: Otherwise
                     45: .I *ahost
                     46: is set to the standard name of the host
                     47: and a connection is established to a server
                     48: residing at the well-known Internet port
                     49: .IR inport .
                     50: .PP
                     51: If the call succeeds, a socket of type SOCK_STREAM
                     52: is returned to the caller, and given to the remote
                     53: command as 
                     54: .B stdin
                     55: and
                     56: .BR stdout .
                     57: If
                     58: .I fd2p
                     59: is non-zero, then an auxiliary channel to a control
                     60: process will be set up, and a descriptor for it will be placed
                     61: in
                     62: .IR *fd2p .
                     63: The control process will return diagnostic
                     64: output from the command (unit 2) on this channel, and will also
                     65: accept bytes on this channel as being UNIX signal numbers, to be
                     66: forwarded to the process group of the command.
                     67: If
                     68: .I fd2p
                     69: is 0, then the 
                     70: .B stderr
                     71: (unit 2 of the remote
                     72: command) will be made the same as the 
                     73: .B stdout
                     74: and no
                     75: provision is made for sending arbitrary signals to the remote process,
                     76: although you may be able to get its attention by using out-of-band data.
                     77: .PP
                     78: The protocol is described in detail in
                     79: .IR rshd (8C).
                     80: .PP
                     81: The
                     82: .I rresvport
                     83: routine is used to obtain a socket with a privileged
                     84: address bound to it.  This socket is suitable for use
                     85: by 
                     86: .I rcmd
                     87: and sevral other routines.  Privileged addresses consist
                     88: of a port in the range 0 to 1023.  Only the super-user
                     89: is allowed to bind an address of this sort to a socket.
                     90: .PP
                     91: .I Ruserok
                     92: takes a remote host's name, as returned by a
                     93: .IR gethostent (3N)
                     94: routine, two user names and a flag indicating if
                     95: the local user's name is the super-user.  It then
                     96: checks the files 
                     97: .I /etc/hosts.equiv
                     98: and, possibly, 
                     99: .I .rhosts
                    100: in the current working directory (normally the local
                    101: user's home directory) to see if the request for
                    102: service is allowed.  A 1 is returned if the machine
                    103: name is listed in the ``hosts.equiv'' file, or the
                    104: host and remote user name are found in the ``.rhosts''
                    105: file; otherwise 
                    106: .I ruserok
                    107: returns 0.  If the
                    108: .I superuser
                    109: flag is 1, the checking of the ``host.equiv'' file is
                    110: bypassed.
                    111: .SH SEE ALSO
                    112: rlogin(1C),
                    113: rsh(1C),
                    114: rexec(3X),
                    115: rexecd(8C),
                    116: rlogind(8C),
                    117: rshd(8C)
                    118: .SH BUGS
                    119: There is no way to specify options to the
                    120: .I socket
                    121: call
                    122: which
                    123: .I rcmd
                    124: makes.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.