[2707] in Kerberos-V5-bugs
krb5-clients/405: Fallback code for rlogin/rsh is broken
daemon@ATHENA.MIT.EDU (Ken Hornstein)
Fri Mar 28 15:12:28 1997
Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, kenh@cmf.nrl.navy.mil
Date: Fri, 28 Mar 1997 15:07:53 -0500 (EST)
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
Reply-To: kenh@cmf.nrl.navy.mil
To: krb5-bugs@MIT.EDU
>Number: 405
>Category: krb5-clients
>Synopsis: The fallback code in rlogin/rsh doesn't work in all cases
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Fri Mar 28 15:08:00 EST 1997
>Last-Modified:
>Originator: Ken Hornstein
>Organization:
Navel Research Lab
>Release: 1.0
>Environment:
System: SunOS elvis 4.1.4 4 sun4c
Architecture: sun4
>Description:
The rsh/rlogin code to fallback to the regular version of rlogin/rsh
doesn't work all the time. This is because it tries to figure out
the hostname and supplies that as argv[0].
This breaks if you use an option on the command line (ie - it thinks
that -l is a hostname), and it also breaks if you call it something
other than rlogin/rsh (ie - if you call it krlogin/krsh).
>How-To-Repeat:
Try using Kerberos rlogin with an option to a non-Kerberized host.
>Fix:
These patches have some fuzz (since there are other changes in there),
but they should be good enough to show what needs to be fixed. Basically
all this does is make sure that argv[0] is "rlogin"/"rsh" as appropriate.
--- appl/bsd/krlogin.c.orig Wed Jan 15 18:23:10 1997
+++ appl/bsd/krlogin.c Wed Mar 12 11:33:46 1997
@@ -1579,14 +1601,13 @@
UCB_RLOGIN);
fflush(stderr);
- host = strrchr(argv[0], '/');
- if (host)
- host++;
- else
- host = argv[0];
- if (!strcmp(host, "rlogin"))
- argv++;
+ argv[0] = "rlogin";
+#ifdef POSIX_SIGNALS
+ sigemptyset(&mask);
+ sigprocmask(SIG_SETMASK, &mask, NULL);
+#endif
+
execv(UCB_RLOGIN, argv);
perror("exec");
exit(1);
--- appl/bsd/krsh.c.orig Thu Nov 7 12:06:59 1996
+++ appl/bsd/krsh.c Wed Mar 12 11:34:32 1997
@@ -559,15 +576,11 @@
* from arglist.
*
* We always want to call the Berkeley rsh as 'host mumble'
+ *
+ * This is broken! Always invoke it as "rsh ..."
*/
- host = strrchr(argv[0], '/');
- if (host)
- host++;
- else
- host = argv[0];
-
- if (!strcmp(host, "rsh"))
- argv++;
+
+ argv[0] = "rsh";
fprintf(stderr,"trying normal rsh (%s)\n",
UCB_RSH);
>Audit-Trail:
>Unformatted: