xref: /openbsd/gnu/usr.bin/cvs/windows-NT/rcmd.h (revision 1e72d8d2)
1*1e72d8d2Sderaadt /* rcmd.h --- interface to executing commands on remote hosts
2*1e72d8d2Sderaadt    Jim Blandy <jimb@cyclic.com> --- August 1995  */
3*1e72d8d2Sderaadt 
4*1e72d8d2Sderaadt /* Run the command CMD on the host *AHOST, and return a file descriptor for
5*1e72d8d2Sderaadt    a bidirectional stream socket connected to the command's standard input
6*1e72d8d2Sderaadt    and output.
7*1e72d8d2Sderaadt 
8*1e72d8d2Sderaadt    rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's
9*1e72d8d2Sderaadt    canonical name.  If *AHOST is not found, rcmd returns -1.
10*1e72d8d2Sderaadt 
11*1e72d8d2Sderaadt    rcmd connects to the remote host at TCP port INPORT.  This should
12*1e72d8d2Sderaadt    probably be the "shell" service, port 514.
13*1e72d8d2Sderaadt 
14*1e72d8d2Sderaadt    LOCUSER is the name of the user on the local machine, and REMUSER is
15*1e72d8d2Sderaadt    the name of the user on the remote machine; the remote machine uses this,
16*1e72d8d2Sderaadt    along with the source address of the TCP connection, to authenticate
17*1e72d8d2Sderaadt    the connection.
18*1e72d8d2Sderaadt 
19*1e72d8d2Sderaadt    CMD is the command to execute.  The remote host will tokenize it any way
20*1e72d8d2Sderaadt    it damn well pleases.  Welcome to Unix.
21*1e72d8d2Sderaadt 
22*1e72d8d2Sderaadt    FD2P is a feature we don't support, but there's no point in making mindless
23*1e72d8d2Sderaadt    deviations from the interface.  Callers should always pass this argument
24*1e72d8d2Sderaadt    as zero.  */
25*1e72d8d2Sderaadt extern int rcmd (const char **AHOST,
26*1e72d8d2Sderaadt 		 unsigned short INPORT,
27*1e72d8d2Sderaadt 		 char *LOCUSER,
28*1e72d8d2Sderaadt 		 char *REMUSER,
29*1e72d8d2Sderaadt 		 char *CMD,
30*1e72d8d2Sderaadt 		 int *fd2p);
31