Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rcmd(3N) — GL2 W2.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rlogin(1C)

rsh(1C)

rlogind(1M)

rshd(1M)

RCMD(3N)  —  Silicon Graphics

NAME

rcmd, rresvport, ruserok − routines for returning a stream to a remote command

SYNOPSIS

rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);
char **ahost;
int inport;
char *locuser, *remuser, *cmd;
int *fd2p;
s = rresvport(options);
int options;
ruserok(rhost, ruser, luser);
char *rhost;
char *user, *luser;

DESCRIPTION

rcmd executes a command on a remote machine.  It uses an authentication scheme based on reserved port numbers.  Only the super user can use this command.  rresvport returns a descriptor with an address in the privileged port space to a socket.  ruserok authenticates clients requesting service with rcmd.  All three functions are in the same file.  rshd(1M) and other servers use these functions. 

rcmd looks up the host *ahost using gethostbyname(3N).  It returns -1 if the host does not exist.  Otherwise, *ahost becomes the standard name of the host, and a connection is established to a server residing at the Internet port inport. 

If the call succeeds, a SOCK_STREAM type socket is returned to the caller and then given to the remote command as stdin and stdout.  This socket has the options specified in socket(3N).  If fd2p is nonzero, an auxiliary channel to a control process is set up and a descriptor for it is placed in *fd2p.  The control process returns diagnostic output from the command (unit 2) and accepts bytes (as UNIX signal numbers) for forwarding to the command’s process group on this channel.  If fd2p is 0, the stderr (unit 2 of the remote command) becomes the stdout and arbitrary signals cannot be sent to the remote process.  See rshd(1M) for more details. 

rresvport obtains a socket with a privileged address bound to it.  rcmd and other routines use this socket.  Privileged addresses consist of a port in the range 0 to 1023.  Only the super user can bind a privileged address to this socket. 

ruserok uses the remote host’s name returned by the raddr(3N) gethostent(3N) routine, and two user names.  Then it checks the files /etc/hosts.equiv and .rhosts in the current working directory (the local user’s home directory) to see if the service request is allowed.  It returns a 1 if the hosts.equiv file has the machine name and the local and remote user are the same (and the local user is not root) or if the .rhosts file has the remote user name.  Otherwise, ruserok returns a 0. 

SEE ALSO

rlogin(1C), rsh(1C), rlogind(1M), rshd(1M)

Version 2.5  —  April 22, 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026