summaryrefslogtreecommitdiff
path: root/libexec/telnetd/sys_term.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-06-29 21:30:56 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-06-29 21:30:56 +0000
commitea3bfaf6702beee76da363cc49a89b0f791d2b72 (patch)
tree9b075050534252d0012dfd07954354deae8e6963 /libexec/telnetd/sys_term.c
parent135ff5877badf7685592cfb68903fb765c3e7c2a (diff)
Add back gettytab reading but use cget* instead of the obsolescent gtget*
Diffstat (limited to 'libexec/telnetd/sys_term.c')
-rw-r--r--libexec/telnetd/sys_term.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 67a0a5e7dbd..0b8d19a0dd3 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -179,7 +179,7 @@ char wtmpf[] = "/etc/wtmp";
int really_stream = 0;
# endif
- const char *new_login = _PATH_LOGIN;
+ char *new_login = NULL;
/*
* init_termbuf()
@@ -1273,6 +1273,8 @@ start_login(const char *host, int autologin, char *name)
struct arg_val argv;
char *user;
int save_errno;
+ char *buf;
+ extern char *gettytab[2], *gettyent;
#ifdef HAVE_UTMPX_H
int pid = getpid();
@@ -1347,6 +1349,13 @@ start_login(const char *host, int autologin, char *name)
addarg(&argv, "--");
addarg(&argv, strdup(user));
}
+ if (new_login == NULL && cgetent(&buf, gettytab, gettyent) >= 0) {
+ cgetstr(buf, "lo", &new_login);
+ cgetclose();
+ }
+ if (new_login == NULL)
+ new_login = _PATH_LOGIN;
+
if (getenv("USER")) {
/*
* Assume that login will set the USER variable