"rlogin" doesn't accept the normal UNIX command syntax
Guy Harris
guy%gorodish at Sun.COM
Wed Jan 14 15:54:09 AEST 1987
Index: ucb/rlogin.c 4.3BSD
Description:
"rlogin" does NOT permit you to say "rlogin -l <user> <host>";
it REQUIRES you to put the <host> immediately after the command.
name. This is presumably a consequence of the code that causes
"rlogin" to act as "rlogin host" when invoked as "host"; this
is not, however, an excuse for this kind of behavior on its part.
Repeat-By:
Try assuming that "rlogin" is a normal UNIX command with the normal
UNIX command syntax, and get unpleasantly surprised.
Fix:
Here's some changes to make it accept the
"rlogin -l <user> <host>" syntax as well as the
"rlogin <host> -l <user>" and the "<host> -l <user>" syntax:
*** /arch/4.3/usr/src/ucb/rlogin.c Sun Mar 30 16:39:06 1986
--- rlogin.c Tue Jan 13 21:47:28 1987
***************
*** 82,89 ****
else
host = argv[0];
argv++, --argc;
! if (!strcmp(host, "rlogin"))
! host = *argv++, --argc;
another:
if (argc > 0 && !strcmp(*argv, "-d")) {
argv++, argc--;
--- 82,93 ----
else
host = argv[0];
argv++, --argc;
! if (strcmp(host, "rlogin") == 0) {
! if (*argv[0] != '-')
! host = *argv++, --argc;
! else
! host = 0;
! }
another:
if (argc > 0 && !strcmp(*argv, "-d")) {
argv++, argc--;
***************
*** 112,119 ****
argv++, argc--;
goto another;
}
! if (host == 0)
! goto usage;
if (argc > 0)
goto usage;
pwd = getpwuid(getuid());
--- 116,126 ----
argv++, argc--;
goto another;
}
! if (host == 0) {
! if (argc == 0)
! goto usage;
! host = *argv++, --argc;
! }
if (argc > 0)
goto usage;
pwd = getpwuid(getuid());
***************
*** 157,163 ****
/*NOTREACHED*/
usage:
fprintf(stderr,
! "usage: rlogin host [ -ex ] [ -l username ] [ -8 ] [ -L ]\n");
exit(1);
}
--- 164,170 ----
/*NOTREACHED*/
usage:
fprintf(stderr,
! "usage: rlogin [ -ex ] [ -l username ] [ -8 ] [ -L ] host\n");
exit(1);
}
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list