From: lunt@CTT.BELLCORE.COM (Steve Lunt)
Subject: Re: Possible problem with rsh
Organization: Internet-USENET Gateway at Stanford University
Date: Wed, 7 Oct 1992 16:24:07 GMT

Kerberos' rsh doesn't accept the same syntax.  To fix it, here is a
patch to the code and the manual page.  For that matter, I've also
included a similar patch for rlogin and its manual page.

-- Steve

        Steven J. Lunt           |  lunt@bellcore.com  |  RRC 1L-213
Information Technology Security  |---------------------|  444 Hoes Lane
           Bellcore              |   (908) 699-4244    |  Piscataway, NJ 08854


*** athena/appl/bsd/rsh.c	Mon Feb  3 12:10:00 1992
--- src/appl/bsd/rsh.c	Thu Jul 25 18:14:56 1991
***************
*** 100,106 ****
  		host = argv[0];
  	argv++, --argc;
  	if (!strcmp(host, "rsh")) {
! 		host = *argv++, --argc;
  		asrsh = 1;
  	}
  another:
--- 100,108 ----
  		host = argv[0];
  	argv++, --argc;
  	if (!strcmp(host, "rsh")) {
! 		if (argc > 0 && **argv != '-')
! 			host = *argv++, --argc;
! 		else	host = 0;
  		asrsh = 1;
  	}
  another:
***************
*** 193,199 ****
  	}
  #endif ATHENA
  	if (host == 0)
! 		goto usage;
  	if (argv[0] == 0) {
  		if (asrsh)
  			*argv0 = "rlogin";
--- 195,203 ----
  	}
  #endif ATHENA
  	if (host == 0)
! 		if (argc > 0)
! 			host = *argv++, --argc;
! 		else	goto usage;
  	if (argv[0] == 0) {
  		if (asrsh)
  			*argv0 = "rlogin";

*** athena/man/rsh.1	Mon Feb  3 12:10:50 1992
--- src/man/rsh.1	Thu Jul 25 17:50:08 1991
***************
*** 25,30 ****
--- 25,42 ----
  rsh \- remote shell
  .SH SYNOPSIS
  .B rsh
+ [
+ .B \-l
+ username
+ ] [
+ .B \-n
+ ] [
+ .B \-d
+ ] [
+ .B \-k
+ realm ] host [ command ]
+ .br
+ .B rsh
  host
  [
  .B \-l
***************
*** 35,41 ****
  .B \-d
  ] [
  .B \-k
! realm ] command
  .br
  host
  [
--- 47,53 ----
  .B \-d
  ] [
  .B \-k
! realm ] [ command ]
  .br
  host
  [
***************
*** 47,53 ****
  .B \-d
  ] [
  .B \-k
! realm ] command
  .SH DESCRIPTION
  .I Rsh
  connects to the specified
--- 59,65 ----
  .B \-d
  ] [
  .B \-k
! realm ] [ command ]
  .SH DESCRIPTION
  .I Rsh
  connects to the specified

*** athena/appl/bsd/rlogin.c	Mon Feb  3 12:10:02 1992
--- src/appl/bsd/rlogin.c	Thu Jul 25 18:14:56 1991
***************
*** 188,197 ****
  	krb_realm[0] = '\0';
  #endif KERBEROS
  	if (!strcmp(host, "rlogin"))
! 		host = *argv++, --argc;
! #ifdef KERBEROS
! 	strcpy(phost,krb_get_phost(host));
! #endif KERBEROS
  another:
  	if (argc > 0 && !strcmp(*argv, "-d")) {
  		argv++, argc--;
--- 188,196 ----
  	krb_realm[0] = '\0';
  #endif KERBEROS
  	if (!strcmp(host, "rlogin"))
! 		if (argc > 0 && **argv != '-')
! 			host = *argv++, --argc;
! 		else	host = 0;
  another:
  	if (argc > 0 && !strcmp(*argv, "-d")) {
  		argv++, argc--;
***************
*** 274,280 ****
  #endif
  #endif KERBEROS
  	if (host == 0)
! 		goto usage;
  	if (argc > 0)
  		goto usage;
  	pwd = getpwuid(getuid());
--- 273,284 ----
  #endif
  #endif KERBEROS
  	if (host == 0)
! 		if (argc > 0)
! 			host = *argv++, --argc;
! 		else	goto usage;
! #ifdef KERBEROS
! 	strcpy(phost,krb_get_phost(host));
! #endif KERBEROS
  	if (argc > 0)
  		goto usage;
  	pwd = getpwuid(getuid());

*** athena/man/rlogin.1	Mon Feb  3 12:10:51 1992
--- src/man/rlogin.1	Thu Jul 25 17:50:07 1991
***************
*** 53,58 ****
--- 53,87 ----
  .B \-l
  username ]
  .br
+ .B rlogin
+ [
+ \fB\-e\fR\fI\|c\fR
+ ] [
+ .B \-8
+ ] [
+ .B \-c
+ ] [
+ .B \-a
+ ] [
+ .B \-t
+ termtype ] [
+ .B \-n
+ ] [
+ .B \-7
+ ] [
+ .B \-d
+ ] [
+ .B \-k
+ realm ] [
+ .B \-x
+ ] [
+ .B \-noflow
+ ] [
+ .B \-L
+ ] [
+ .B \-l
+ username ] rhost
+ .br
  rhost [
  \fB\-e\fR\fIc\fR
  ] [
Newsgroups: comp.protocols.kerberos