1*2770ece5Stholo /* rcmd.h --- interface to executing commands on remote hosts 2*2770ece5Stholo Karl Fogel <kfogel@cyclic.com> --- November 1995 */ 3*2770ece5Stholo 4*2770ece5Stholo /* This program is free software; you can redistribute it and/or modify 5*2770ece5Stholo it under the terms of the GNU General Public License as published by 6*2770ece5Stholo the Free Software Foundation; either version 2, or (at your option) 7*2770ece5Stholo any later version. 8*2770ece5Stholo 9*2770ece5Stholo This program is distributed in the hope that it will be useful, 10*2770ece5Stholo but WITHOUT ANY WARRANTY; without even the implied warranty of 11*2770ece5Stholo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*2770ece5Stholo GNU General Public License for more details. */ 13*2770ece5Stholo 14*2770ece5Stholo /* Run the command CMD on the host *AHOST, and return a file descriptor for 15*2770ece5Stholo a bidirectional stream socket connected to the command's standard input 16*2770ece5Stholo and output. 17*2770ece5Stholo 18*2770ece5Stholo rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's 19*2770ece5Stholo canonical name. If *AHOST is not found, rcmd returns -1. 20*2770ece5Stholo 21*2770ece5Stholo rcmd connects to the remote host at TCP port INPORT. This should 22*2770ece5Stholo probably be the "shell" service, port 514. 23*2770ece5Stholo 24*2770ece5Stholo LOCUSER is the name of the user on the local machine, and REMUSER is 25*2770ece5Stholo the name of the user on the remote machine; the remote machine uses this, 26*2770ece5Stholo along with the source address of the TCP connection, to authenticate 27*2770ece5Stholo the connection. 28*2770ece5Stholo 29*2770ece5Stholo CMD is the command to execute. The remote host will tokenize it any way 30*2770ece5Stholo it damn well pleases. Welcome to Unix. 31*2770ece5Stholo 32*2770ece5Stholo FD2P is a feature we don't support, but there's no point in making mindless 33*2770ece5Stholo deviations from the interface. Callers should always pass this argument 34*2770ece5Stholo as zero. */ 35*2770ece5Stholo 36*2770ece5Stholo /* Note that because we are using windows-NT/rcmd.c, this declaration 37*2770ece5Stholo must match windows-NT/rcmd.h (and rcmd.c). It would be much 38*2770ece5Stholo more sensible to use a common header file. But I haven't bothered to 39*2770ece5Stholo adjust the makefile accordingly, yet. Probably the best long-term 40*2770ece5Stholo home for this would be in lib/rcmd.*, or perhaps src. */ 41*2770ece5Stholo extern int rcmd (const char **AHOST, 42*2770ece5Stholo unsigned short INPORT, 43*2770ece5Stholo char *LOCUSER, 44*2770ece5Stholo char *REMUSER, 45*2770ece5Stholo char *CMD, 46*2770ece5Stholo int *fd2p); 47