Skip Menu |
 

Download (untitled) / with headers
text/plain 6.2KiB
From cross@eng.us.uu.net Mon Oct 19 16:51:45 1998
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id QAA15535 for <bugs@RT-11.MIT.EDU>; Mon, 19 Oct 1998 16:51:44 -0400
Received: from alfred.eng.us.uu.net by MIT.EDU with SMTP
id AA04154; Mon, 19 Oct 98 16:51:43 EDT
Received: from ballista.eng.us.uu.net by alfred.eng.us.uu.net with ESMTP
(peer crosschecked as: ballista.eng.us.uu.net [199.170.215.22])
id QAA29467; Mon, 19 Oct 1998 16:51:43 -0400 (EDT)
Received: by ballista.eng.us.uu.net
id QAA26017; Mon, 19 Oct 1998 16:51:42 -0400 (EDT)
Message-Id: <QAA26017.199810192051@ballista.eng.us.uu.net>
Date: Mon, 19 Oct 1998 16:51:42 -0400 (EDT)
From: cross@eng.us.uu.net (Chris P. Ross)
Reply-To: cross@eng.us.uu.net
To: krb5-bugs@MIT.EDU
Cc: cross@eng.us.uu.net
Subject: New feature add to rsh
X-Send-Pr-Version: 3.99

Show quoted text
>Number: 646
>Category: krb5-appl
>Synopsis: Add a -S command line option to rsh
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: change-request
>Submitter-Id: unknown
>Arrival-Date: Mon Oct 19 16:52:00 EDT 1998
>Last-Modified:
>Originator: Chris P. Ross
>Organization:
UUNET Technologies, Inc.
Show quoted text
>Release: krb5-1.0.5
>Environment:
BSD/OS 3.1/4.0, x86/sparc

System: BSD/OS ballista.eng.us.uu.net 3.1 BSDI BSD/OS 3.1 Kernel #2: Wed Jul 29 15:38:24 EDT 1998 cross@pembroke.eng.us.uu.net:/export/src/bsdi/sys/compile/DESKTOP i386

Show quoted text
>Description:
The rsh shipped with BSD/OS includes a -S option, which causes rsh
to not initiate a separate TCP connection to pass stderr over. Some things
on BSD/OS expect the installed "rsh" to accept this option. Rather than have
the option be taken but ignored, I implemented (and documented) this
functionality. Please incorporate this change to the base krb5 rsh. Thanks.

Show quoted text
>How-To-Repeat:
>Fix:

Index: krsh.c
===================================================================
RCS file: /export/src/CVS/usr.local/krb5/src/appl/bsd/krsh.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 krsh.c
--- krsh.c 1997/12/17 15:14:43 1.1.1.1
+++ krsh.c 1998/10/19 20:43:39
@@ -144,6 +144,7 @@
krb5_error_code status;
int fflag = 0, Fflag = 0;
#endif /* KERBEROS */
+ int Sflag = 0;
int debug_port = 0;

memset(&defaultservent, 0, sizeof(struct servent));
@@ -230,6 +231,11 @@
goto another;
}
#endif /* KERBEROS */
+ if (argc > 0 && !strncmp(*argv, "-S", 2)) {
+ Sflag++;
+ argv++, argc--;
+ goto another;
+ }
/*
* Ignore the -L, -w, -e and -8 flags to allow aliases with rlogin
* to work
@@ -350,7 +356,7 @@
status = kcmd(&rem, &host, debug_port,
pwd->pw_name,
user ? user : pwd->pw_name,
- args, &rfd2, "host", krb_realm,
+ args, Sflag ? NULL : &rfd2, "host", krb_realm,
&cred,
0, /* No need for sequence number */
0, /* No need for server seq # */
@@ -384,19 +390,23 @@

#else /* !KERBEROS */
rem = rcmd(&host, debug_port, pwd->pw_name,
- user ? user : pwd->pw_name, args, &rfd2);
+ user ? user : pwd->pw_name, args, Sflag ? NULL : &rfd2);
if (rem < 0)
exit(1);
#endif /* KERBEROS */
- if (rfd2 < 0) {
- fprintf(stderr, "rsh: can't establish stderr\n");
- exit(2);
+ if (!Sflag) {
+ if (rfd2 < 0) {
+ fprintf(stderr, "rsh: can't establish stderr\n");
+ exit(2);
+ }
+ } else {
+ rfd2 = -1;
}
if (options & SO_DEBUG) {
if (setsockopt(rem, SOL_SOCKET, SO_DEBUG,
(const char *) &one, sizeof (one)) < 0)
perror("setsockopt (stdin)");
- if (setsockopt(rfd2, SOL_SOCKET, SO_DEBUG,
+ if (rfd2 != -1 && setsockopt(rfd2, SOL_SOCKET, SO_DEBUG,
(const char *) &one, sizeof (one)) < 0)
perror("setsockopt (stderr)");
}
@@ -444,7 +454,8 @@
}
}
if (!encrypt_flag) {
- ioctl(rfd2, FIONBIO, &one);
+ if (rfd2 != -1)
+ ioctl(rfd2, FIONBIO, &one);
ioctl(rem, FIONBIO, &one);
}
if (nflag == 0 && pid == 0) {
@@ -452,7 +463,8 @@
int wc;
fd_set rembits;

- (void) close(rfd2);
+ if (rfd2 != -1)
+ (void) close(rfd2);
reread:
errno = 0;
cc = read(0, buf, sizeof buf);
@@ -493,7 +505,8 @@
#endif
#endif /* POSIX_SIGNALS */
FD_ZERO(&readfrom);
- FD_SET(rfd2, &readfrom);
+ if (rfd2 != -1)
+ FD_SET(rfd2, &readfrom);
FD_SET(rem, &readfrom);
do {
ready = readfrom;
@@ -504,7 +517,7 @@
}
continue;
}
- if (FD_ISSET(rfd2, &ready)) {
+ if (rfd2 != -1 && FD_ISSET(rfd2, &ready)) {
errno = 0;
cc = des_read(rfd2, buf, sizeof buf);
if (cc <= 0) {
@@ -522,7 +535,8 @@
} else
(void) write(1, buf, cc);
}
- } while (FD_ISSET(rem, &readfrom) || FD_ISSET(rfd2, &readfrom));
+ } while (FD_ISSET(rem, &readfrom) ||
+ (rfd2 != -1 && FD_ISSET(rfd2, &readfrom)));
if (nflag == 0)
(void) kill(pid, SIGKILL);
exit(0);
Index: rsh.M
===================================================================
RCS file: /export/src/CVS/usr.local/krb5/src/appl/bsd/rsh.M,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rsh.M
--- rsh.M 1997/12/17 15:14:43 1.1.1.1
+++ rsh.M 1998/10/19 20:43:39
@@ -23,7 +23,7 @@
.SH SYNOPSIS
.B rsh
.I host
-[\fB\-l\fP \fIusername\fP] [\fB\-n\fP] [\fB\-d\fP] [\fB\-k\fP
+[\fB\-l\fP \fIusername\fP] [\fB\-S\fP] [\fB\-n\fP] [\fB\-d\fP] [\fB\-k\fP
\fIrealm\fP] [\fB\-f\fP | \fB\-F\fP] [\fB\-x\fP]
.I command
.SH DESCRIPTION
@@ -101,6 +101,24 @@
redirects input from the special device
.I /dev/null
(see the BUGS section below).
+.TP
+.B \-S
+The
+.I rsh
+protocol requires the remote host to establish a TCP connection back
+to the local host. This connection provides the standard error from
+the remote command and propagation of signals to the remote command.
+In some cases, IP firewalls prevent this connection from being formed.
+.sp
+When the
+.B \-S
+option is specified this second connection will not be established.
+The standard error output from the remote command will be merged with its
+standard output and appear on \fIrdist\fP's
+standard output. The interrupt, quit and terminate signals will cause
+.I rdist
+to terminate and close the TCP connection. The remote command will terminate
+when it attempts to write to the network connection.
.PP
If you omit
.IR command ,
Show quoted text
>Audit-Trail:
>Unformatted: