summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-22 10:39:32 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-22 10:39:32 +0000
commit4c854868cc9d88b40b51805184ab69d76d36dad6 (patch)
tree7934a1829f90cda4b75c04aecd6fde694c0a7d22 /libexec
parentbd978a3cd2531b8b9199c83ee514bfc7a1b95854 (diff)
From NetBSD:
Make sure that the user name cannot ever be interpreted as an option to login(8). Note: This does *not* fix any security holes.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/getty/main.c4
-rw-r--r--libexec/rlogind/rlogind.c10
-rw-r--r--libexec/telnetd/sys_term.c5
3 files changed, 11 insertions, 8 deletions
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index f765509df2c..4dcf1e4825c 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";*/
-static char rcsid[] = "$Id: main.c,v 1.2 1995/11/13 11:27:23 deraadt Exp $";
+static char rcsid[] = "$Id: main.c,v 1.3 1996/02/22 10:39:28 niklas Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -318,7 +318,7 @@ main(argc, argv)
limit.rlim_max = RLIM_INFINITY;
limit.rlim_cur = RLIM_INFINITY;
(void)setrlimit(RLIMIT_CPU, &limit);
- execle(LO, "login", "-p", name, (char *) 0, env);
+ execle(LO, "login", "-p", "--", name, (char *)0, env);
syslog(LOG_ERR, "%s: %m", LO);
exit(1);
}
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index c4dd9550626..0421c07b466 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/* from: static char sccsid[] = "@(#)rlogind.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: rlogind.c,v 1.2 1995/12/16 22:20:20 tholo Exp $";
+static char *rcsid = "$Id: rlogind.c,v 1.3 1996/02/22 10:39:24 niklas Exp $";
#endif /* not lint */
/*
@@ -299,11 +299,11 @@ doit(f, fromp)
hostname);
#endif
- execl(_PATH_LOGIN, "login", "-p",
- "-h", hostname, "-f", lusername, (char *)NULL);
+ execl(_PATH_LOGIN, "login", "-p", "-h", hostname, "-f",
+ "--", lusername, (char *)NULL);
} else
- execl(_PATH_LOGIN, "login", "-p",
- "-h", hostname, lusername, (char *)NULL);
+ execl(_PATH_LOGIN, "login", "-p", "-h", hostname,
+ "--", lusername, (char *)NULL);
fatal(STDERR_FILENO, _PATH_LOGIN, 1);
/*NOTREACHED*/
}
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index cf17db3dbac..10cc5439119 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -33,7 +33,7 @@
#ifndef lint
/* from: static char sccsid[] = "@(#)sys_term.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: sys_term.c,v 1.1 1995/10/18 08:43:24 deraadt Exp $";
+static char *rcsid = "$Id: sys_term.c,v 1.2 1996/02/22 10:39:31 niklas Exp $";
#endif /* not lint */
#include "telnetd.h"
@@ -1590,6 +1590,7 @@ start_login(host, autologin, name)
if (auth_level >= 0 && autologin == AUTH_VALID) {
# if !defined(NO_LOGIN_F)
argv = addarg(argv, "-f");
+ argv = addarg(argv, "--");
argv = addarg(argv, name);
# else
# if defined(LOGIN_R)
@@ -1662,12 +1663,14 @@ start_login(host, autologin, name)
pty = xpty;
}
# else
+ argv = addarg(argv, "--");
argv = addarg(argv, name);
# endif
# endif
} else
#endif
if (getenv("USER")) {
+ argv = addarg(argv, "--");
argv = addarg(argv, getenv("USER"));
#if defined(LOGIN_ARGS) && defined(NO_LOGIN_P)
{