summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sliplogin
diff options
context:
space:
mode:
authorguido <guido@FreeBSD.org>1994-08-08 17:14:46 +0000
committerguido <guido@FreeBSD.org>1994-08-08 17:14:46 +0000
commitb08f1a94ffdfd1bef1932f927d874e01c5eb6db5 (patch)
tree98735d849e955c7738f3c912c409531a0823f150 /usr.sbin/sliplogin
parentd5d76627400fa8a1540eb280d549b79afc3366bc (diff)
downloadFreeBSD-src-b08f1a94ffdfd1bef1932f927d874e01c5eb6db5.zip
FreeBSD-src-b08f1a94ffdfd1bef1932f927d874e01c5eb6db5.tar.gz
1. Correct invalid setsid and ioctl return value checks.
2. set some seteuid calls to allow sliplogin to be run by users from the commandline in stead of from login inlo. Submitted by: guido
Diffstat (limited to 'usr.sbin/sliplogin')
-rw-r--r--usr.sbin/sliplogin/sliplogin.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/sliplogin/sliplogin.c b/usr.sbin/sliplogin/sliplogin.c
index 7e52ff7..d8af959 100644
--- a/usr.sbin/sliplogin/sliplogin.c
+++ b/usr.sbin/sliplogin/sliplogin.c
@@ -208,6 +208,7 @@ hup_handler(s)
{
char logoutfile[MAXPATHLEN];
+ seteuid(0);
(void)sprintf(logoutfile, "%s.%s", _PATH_LOGOUT, loginname);
if (access(logoutfile, R_OK|X_OK) != 0)
(void)strcpy(logoutfile, _PATH_LOGOUT);
@@ -256,7 +257,7 @@ main(argc, argv)
#ifdef POSIX
if (fork() > 0)
exit(0);
- if (setsid() != 0)
+ if (setsid() == -1)
perror("setsid");
#else
if ((fd = open("/dev/tty", O_RDONLY, 0)) >= 0) {
@@ -281,7 +282,7 @@ main(argc, argv)
close(fd);
}
#ifdef TIOCSCTTY
- if (ioctl(0, TIOCSCTTY, (caddr_t)0) != 0)
+ if (ioctl(0, TIOCSCTTY, (caddr_t)0) == -1)
perror("ioctl (TIOCSCTTY)");
#endif
} else {
@@ -373,6 +374,8 @@ main(argc, argv)
exit(6);
}
+ /* reset uid to users' to allow the user to give a signal. */
+ seteuid(uid);
/* twiddle thumbs until we get a signal */
while (1)
sigpause(0);
OpenPOWER on IntegriCloud