summaryrefslogtreecommitdiff
path: root/utmp.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2014-04-28 02:46:50 +0200
committerAxel Beckert <abe@deuxchevaux.org>2014-04-28 02:46:50 +0200
commit285cd429f731082e1378c7e1362b083103c8a426 (patch)
tree90ce9c284c2812055530b6577591d725e125f75b /utmp.c
parentc3927cc39106d6b7cd746109784b6e8af203ec6b (diff)
downloadscreen-upstream.tar.gz
Imported Upstream version 4.2.1upstream/4.2.1upstream
Diffstat (limited to 'utmp.c')
-rw-r--r--utmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/utmp.c b/utmp.c
index afa0948..fa8b87b 100644
--- a/utmp.c
+++ b/utmp.c
@@ -361,7 +361,7 @@ RemoveLoginSlot()
char *tty;
debug("couln't zap slot -> do mesg n\n");
D_loginttymode = 0;
- if ((tty = ttyname(D_userfd)) && stat(tty, &stb) == 0 && (int)stb.st_uid == real_uid && ((int)stb.st_mode & 0777) != 0666)
+ if ((tty = ttyname(D_userfd)) && stat(tty, &stb) == 0 && (int)stb.st_uid == real_uid && !CheckTtyname(tty) && ((int)stb.st_mode & 0777) != 0666)
{
D_loginttymode = (int)stb.st_mode & 0777;
chmod(D_usertty, stb.st_mode & 0600);
@@ -387,7 +387,7 @@ RestoreLoginSlot()
}
UT_CLOSE;
D_loginslot = (slot_t)0;
- if (D_loginttymode && (tty = ttyname(D_userfd)))
+ if (D_loginttymode && (tty = ttyname(D_userfd)) && !CheckTtyname(tty))
chmod(tty, D_loginttymode);
}
@@ -575,7 +575,7 @@ struct win *wi;
return ut_delete_user(slot, u.ut_pid, 0, 0) != 0;
#endif
#ifdef HAVE_UTEMPTER
- if (eff_uid && wi->w_ptyfd != -1)
+ if (eff_uid && wi && wi->w_ptyfd != -1)
{
/* sigh, linux hackers made the helper functions void */
if (SLOT_USED(u))
@@ -853,7 +853,7 @@ getlogin()
for (fd = 0; fd <= 2 && (tty = ttyname(fd)) == NULL; fd++)
;
- if ((tty == NULL) || ((fd = open(UTMP_FILE, O_RDONLY)) < 0))
+ if ((tty == NULL) || CheckTtyname(tty) || ((fd = open(UTMP_FILE, O_RDONLY)) < 0))
return NULL;
tty = stripdev(tty);
retbuf[0] = '\0';