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