=================================================================== RCS file: /src/master/rdist/Makefile.local,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile.local --- 1.1.1.1 1995/01/20 02:44:39 +++ Makefile.local 1995/01/20 08:03:44 @@ -1,5 +1,5 @@ # -# $Id: Makefile.local,v 1.1.1.1 1995/01/20 02:44:39 seth Exp $ +# $Id: Makefile.local,v 1.2 1995/01/20 08:03:44 seth Exp $ # # Makefile for local overrides of default variables # @@ -14,11 +14,14 @@ # Add any local definetions you want pass to the compiler to DEFS_LOCAL # below. This includes those items found in "config/config.h". # -DEFS_LOCAL = +DEFS_LOCAL =-DBTTCP # # Add any local libraries that your system might need to LIBS_LOCAL below. # # HPUX systems that use GNU bison need "-lPW". # -LIBS_LOCAL = +LIBS_LOCAL =-lresolv -l44bsd + +CC=gcc +yacc=bison -y =================================================================== RCS file: /src/master/rdist/doc/rdist.man,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 rdist.man --- 1.1.1.1 1995/01/20 02:44:57 +++ rdist.man 1995/01/20 21:21:28 @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: rdist.man,v 1.1.1.1 1995/01/20 02:44:57 seth Exp $ +.\" $Id: rdist.man,v 1.2 1995/01/20 21:21:28 seth Exp $ .\" @(#)rdist.1 6.6 (Berkeley) 5/13/86 .\" .TH RDIST 1 "March 14, 1994" @@ -40,7 +40,7 @@ .SH SYNOPSIS .B rdist [ -.B \-DFn +.B \-DFnT ] [ .B \-A @@ -276,6 +276,12 @@ .TP .B \-D Enable copious debugging messages. +.TP +.B \-T +Use a transport command instead of the normal rsh. The transport +command is in the variable TRANS_CMD with TRANS_ARG1 and TRANS_ARG2. +The defaults are +.B /usr/local/bin/ttcp -tp 20452 .TP .B "\-d \fIvar=value\fR" Define =================================================================== RCS file: /src/master/rdist/include/defs.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 defs.h --- 1.1.1.1 1995/01/20 02:44:56 +++ defs.h 1995/01/20 08:04:37 @@ -34,7 +34,7 @@ */ /* - * $Id: defs.h,v 1.1.1.1 1995/01/20 02:44:56 seth Exp $ + * $Id: defs.h,v 1.2 1995/01/20 08:04:37 seth Exp $ * @(#)defs.h 5.2 (Berkeley) 3/20/86 */ @@ -325,7 +325,8 @@ extern opt_t options; /* Global options */ extern int proto_version; /* Protocol version number */ extern int realargc; /* Real argc */ -extern int rem; /* Remote file descriptor */ +extern int remin; /* Remote file descriptor */ +extern int remout; /* Remote file descriptor */ extern int rtimeout; /* Response time out in seconds */ extern UID_T userid; /* User ID of rdist user */ extern jmp_buf finish_jmpbuf; /* Setjmp buffer for finish() */ =================================================================== RCS file: /src/master/rdist/include/types.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 types.h --- 1.1.1.1 1995/01/20 02:44:57 +++ types.h 1995/01/20 21:21:45 @@ -2,7 +2,7 @@ #define __myTYPES_H__ /* - * $Id: types.h,v 1.1.1.1 1995/01/20 02:44:57 seth Exp $ + * $Id: types.h,v 1.3 1995/01/20 21:21:45 seth Exp $ */ /* @@ -29,6 +29,7 @@ #define DO_CHKSYM 0x020000 #define DO_NUMCHKGROUP 0x040000 #define DO_NUMCHKOWNER 0x080000 +#define DO_TRANSONLY 0x800000 /* * Dist option information =================================================================== RCS file: /src/master/rdist/src/client.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 client.c --- 1.1.1.1 1995/01/20 02:44:40 +++ client.c 1995/01/20 08:04:51 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: client.c,v 1.1.1.1 1995/01/20 02:44:40 seth Exp $"; +"$Id: client.c,v 1.2 1995/01/20 08:04:51 seth Exp $"; static char sccsid[] = "@(#)client.c"; @@ -429,7 +429,7 @@ * this situation gracefully. */ } - if (write(rem, buf, amt) == -1) { + if (write(remout, buf, amt) == -1) { error("%s: Error writing to client: %s", target, SYSERR); err(); =================================================================== RCS file: /src/master/rdist/src/common.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 common.c --- 1.1.1.1 1995/01/20 02:44:40 +++ common.c 1995/01/20 08:04:53 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: common.c,v 1.1.1.1 1995/01/20 02:44:40 seth Exp $"; +"$Id: common.c,v 1.2 1995/01/20 08:04:53 seth Exp $"; static char sccsid[] = "@(#)common.c"; @@ -64,7 +64,8 @@ int do_fork = 1; /* Fork child process */ char *currenthost = NULL; /* Current client hostname */ char *progname = NULL; /* Name of this program */ -int rem = -1; /* Client file descriptor */ +int remin = -1; /* Client file descriptor */ +int remout = -1; /* Client file descriptor */ struct passwd *pw = NULL; /* Local user's pwd entry */ int contimedout = FALSE; /* Connection timed out */ int proto_version = -1; /* Protocol version */ @@ -176,7 +177,8 @@ /* Prevent looping */ (void) signal(SIGPIPE, SIG_IGN); - rem = -1; /* Ensure we don't try to send to server */ + remin = -1; /* Ensure we don't try to send to server */ + remout = -1; /* Ensure we don't try to send to server */ checkhostname(); error("Lost connection to %s", (currenthost) ? currenthost : "(unknown)"); @@ -247,7 +249,7 @@ { int len; - if (rem < 0) + if (remin < 0 || remout < 0) return(-1); /* @@ -268,7 +270,7 @@ (cmd == C_NONE) ? len-1 : len-2, (cmd == C_NONE) ? msg : msg + 1); - return(!(write(rem, msg, len) == len)); + return(!(write(remout, msg, len) == len)); } /* @@ -368,7 +370,7 @@ (void) signal(SIGALRM, sighandler); (void) alarm(rtimeout); - remleft = remread(rem, rembuf, sizeof(rembuf)); + remleft = remread(remin, rembuf, sizeof(rembuf)); (void) alarm(0); @@ -396,7 +398,7 @@ register int c, left = space; register u_char *p = buffer; - if (rem < 0) { + if (remin < 0 || remout < 0) { error("Cannot read remote input: Remote descriptor not open."); return(-1); } @@ -460,7 +462,7 @@ (void) signal(SIGALRM, sighandler); (void) alarm(rtimeout); - remleft = remread(rem, rembuf, sizeof(rembuf)); + remleft = remread(remin, rembuf, sizeof(rembuf)); (void) alarm(0); remptr = rembuf; @@ -808,7 +810,7 @@ continue; } if (isserver) - (void) write(rem, sbuf, s - sbuf); + (void) write(remout, sbuf, s - sbuf); else { *s = CNULL; message(MT_INFO, "%s", sbuf+1); @@ -819,7 +821,7 @@ if (s > (char *) &sbuf[1]) { *s++ = '\n'; if (isserver) - (void) write(rem, sbuf, s - sbuf); + (void) write(remout, sbuf, s - sbuf); else { *s = CNULL; message(MT_INFO, "%s", sbuf+1); =================================================================== RCS file: /src/master/rdist/src/docmd.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 docmd.c --- 1.1.1.1 1995/01/20 02:44:41 +++ docmd.c 1995/01/20 21:21:54 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: docmd.c,v 1.1.1.1 1995/01/20 02:44:41 seth Exp $"; +"$Id: docmd.c,v 1.3 1995/01/20 21:21:54 seth Exp $"; static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85"; @@ -72,13 +72,15 @@ { debugmsg(DM_CALL, "closeconn() called\n"); - if (rem >= 0) { + if (remin >= 0 && remout >= 0) { /* We don't care if the connection is still good or not */ signal(SIGPIPE, SIG_IGN); (void) sendcmd(C_FERRMSG, NULL); - (void) close(rem); - rem = -1; + (void) close(remin); + remin = -1; + (void) close(remout); + remout = -1; } } @@ -280,7 +282,18 @@ if (becomeuser() != 0) exit(1); #else /* !DIRECT_RCMD */ - debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh); + if (IS_ON(options, DO_TRANSONLY)) + { + lookup("TRANS_CMD",INSERT,makenl("/usr/local/bin/bdttcp")); + lookup("TRANS_ARG1",INSERT,makenl("-cqtp")); + lookup("TRANS_ARG2",INSERT,makenl("20452")); + debugmsg(DM_MISC, "Transport command: %s %s %s (no remote execution)",lookup("TRANS_CMD",LOOKUP,NULL)->n_name, lookup("TRANS_ARG1",LOOKUP,NULL)->n_name,lookup("TRANS_ARG2",LOOKUP,NULL)->n_name); + } + else + { + debugmsg(DM_MISC, "Remote shell command = '%s'\n", path_remsh); + } + (void) signal(SIGPIPE, SIG_IGN); desc = rshrcmd(&rhost, -1, luser, ruser, cmd, 0); if (desc > 0) @@ -313,7 +326,7 @@ /* * See if we're already connected to this host */ - if (cur_host != NULL && rem >= 0) { + if (cur_host != NULL && remin >= 0 && remout >= 0) { if (strcmp(cur_host, rhost) == 0) return(1); closeconn(); @@ -345,8 +358,11 @@ (void) sprintf(buf, "%.*s -S", sizeof(buf)-5, path_rdistd); - if ((rem = remotecmd(rhost, locuser, ruser, buf)) < 0) + remout = -1; + if ((remin = remotecmd(rhost, locuser, ruser, buf)) < 0) return(0); + + remout = remin; /* XXX (stupid rdist) */ /* * First thing received should be S_VERSION =================================================================== RCS file: /src/master/rdist/src/message.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 message.c --- 1.1.1.1 1995/01/20 02:44:42 +++ message.c 1995/01/20 08:04:56 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: message.c,v 1.1.1.1 1995/01/20 02:44:42 seth Exp $"; +"$Id: message.c,v 1.2 1995/01/20 08:04:56 seth Exp $"; static char sccsid[] = "@(#)common.c"; @@ -325,7 +325,7 @@ char cmd; if (isserver) { - if (rem < 0 || IS_ON(flags, MT_NOREMOTE)) + if ((remin < 0 || remout < 0) || IS_ON(flags, MT_NOREMOTE)) return; cmd = CNULL; =================================================================== RCS file: /src/master/rdist/src/rdist.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 rdist.c --- 1.1.1.1 1995/01/20 02:44:42 +++ rdist.c 1995/01/20 21:21:55 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: rdist.c,v 1.1.1.1 1995/01/20 02:44:42 seth Exp $"; +"$Id: rdist.c,v 1.3 1995/01/20 21:21:55 seth Exp $"; static char sccsid[] = "@(#)main.c 5.1 (Berkeley) 6/6/85"; @@ -60,7 +60,7 @@ struct group *gr = NULL; /* Static area for getgrent */ char localmsglist[] = "stdout=all:notify=all:syslog=nerror,ferror"; char *remotemsglist = NULL; -char optchars[] = "A:a:bcd:DFf:hil:L:M:m:NnOo:p:P:qRrst:Vvwxy"; +char optchars[] = "A:a:bcd:DFf:hil:L:M:m:NnOo:p:P:qRrst:TVvwxy"; FILE *opendist(); char *path_rdistd = _PATH_RDISTD; char *path_remsh = _PATH_REMSH; @@ -193,7 +193,8 @@ break; case 'd': - define(optarg); + /* This really really sucks */ + define(strdup(optarg)); break; case 'D': @@ -263,6 +264,7 @@ case 'h': FLAG_ON(options, DO_FOLLOW); break; case 'i': FLAG_ON(options, DO_IGNLNKS); break; case 'x': FLAG_ON(options, DO_NOEXEC); break; + case 'T': FLAG_ON(options, DO_TRANSONLY); break; case '?': default: @@ -277,6 +279,7 @@ if (nflag && IS_ON(options, DO_VERIFY)) fatalerr( "The -n flag and \"verify\" mode may not both be used."); + /* * Don't fork children for nflag =================================================================== RCS file: /src/master/rdist/src/rdistd.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 rdistd.c --- 1.1.1.1 1995/01/20 02:44:42 +++ rdistd.c 1995/01/20 08:05:00 @@ -33,7 +33,7 @@ #ifndef lint static char RCSid[] = -"$Id: rdistd.c,v 1.1.1.1 1995/01/20 02:44:42 seth Exp $"; +"$Id: rdistd.c,v 1.2 1995/01/20 08:05:00 seth Exp $"; static char sccsid[] = "@(#)rdistd.c"; @@ -96,7 +96,8 @@ } /* Use stdin for remote descriptor */ - rem = fileno(stdin); + remin = fileno(stdin); + remout = fileno(stdout); /* Set logging */ if (cp = msgparseopts(localmsglist, TRUE)) =================================================================== RCS file: /src/master/rdist/src/rshrcmd.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 rshrcmd.c --- 1.1.1.1 1995/01/20 02:44:43 +++ rshrcmd.c 1995/01/20 21:21:57 @@ -6,7 +6,7 @@ #ifndef lint static char RCSid[] = -"$Id: rshrcmd.c,v 1.1.1.1 1995/01/20 02:44:43 seth Exp $"; +"$Id: rshrcmd.c,v 1.3 1995/01/20 21:21:57 seth Exp $"; #endif #include "defs.h" @@ -81,16 +81,32 @@ * If we are rdist'ing to "localhost" as the same user * as we are, then avoid running remote shell for efficiency. */ - if (strcmp(*ahost, "localhost") == 0 && - strcmp(luser, ruser) == 0) { - execlp(_PATH_BSHELL, basename(_PATH_BSHELL), "-c", - cmd, (char *) NULL); - error("execlp %s failed: %s.", _PATH_BSHELL, SYSERR); - } else { - execlp(path_remsh, basename(path_remsh), - *ahost, "-l", ruser, cmd, (char *) NULL); - error("execlp %s failed: %s.", path_remsh, SYSERR); - } + if (IS_ON(options, DO_TRANSONLY)) + { + /* LOOKUP looses */ + debug=0; + + execlp(lookup("TRANS_CMD",LOOKUP,NULL)->n_name, + lookup("TRANS_CMD",LOOKUP,NULL)->n_name, + lookup("TRANS_ARG1",LOOKUP,NULL)->n_name, + lookup("TRANS_ARG2",LOOKUP,NULL)->n_name, + *ahost, (char *) NULL); + + error("execlp %s failed: %s.",lookup("TRANS_CMD",LOOKUP,NULL)->n_name, SYSERR); + } + else + { + if (strcmp(*ahost, "localhost") == 0 && + strcmp(luser, ruser) == 0) { + execlp(_PATH_BSHELL, basename(_PATH_BSHELL), "-c", + cmd, (char *) NULL); + error("execlp %s failed: %s.", _PATH_BSHELL, SYSERR); + } else { + execlp(path_remsh, basename(path_remsh), + *ahost, "-l", ruser, cmd, (char *) NULL); + error("execlp %s failed: %s.", path_remsh, SYSERR); + } + } _exit(255); } if (cpid > 0) {