Annotation of src/usr.bin/login/login.c, Revision 1.9
1.9 ! millert 1: /* $OpenBSD: login.c,v 1.8 1996/10/23 01:28:56 millert Exp $ */
1.3 deraadt 2: /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: */
36:
37: #ifndef lint
38: static char copyright[] =
39: "@(#) Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994\n\
40: The Regents of the University of California. All rights reserved.\n";
41: #endif /* not lint */
42:
43: #ifndef lint
44: #if 0
45: static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
46: #endif
1.9 ! millert 47: static char rcsid[] = "$OpenBSD: login.c,v 1.8 1996/10/23 01:28:56 millert Exp $";
1.1 deraadt 48: #endif /* not lint */
49:
50: /*
51: * login [ name ]
52: * login -h hostname (for telnetd, etc.)
53: * login -f name (for pre-authenticated login: datakit, xterm, etc.)
54: */
55:
56: #include <sys/param.h>
57: #include <sys/stat.h>
58: #include <sys/time.h>
59: #include <sys/resource.h>
60: #include <sys/file.h>
61:
62: #include <err.h>
63: #include <errno.h>
64: #include <grp.h>
65: #include <pwd.h>
66: #include <setjmp.h>
67: #include <signal.h>
68: #include <stdio.h>
69: #include <stdlib.h>
70: #include <string.h>
71: #include <syslog.h>
72: #include <ttyent.h>
73: #include <tzfile.h>
74: #include <unistd.h>
75: #include <utmp.h>
1.3 deraadt 76: #include <util.h>
1.1 deraadt 77:
78: #include "pathnames.h"
79:
80: void badlogin __P((char *));
81: void checknologin __P((void));
82: void dolastlog __P((int));
83: void getloginname __P((void));
84: void motd __P((void));
85: int rootterm __P((char *));
86: void sigint __P((int));
87: void sleepexit __P((int));
88: char *stypeof __P((char *));
89: void timedout __P((int));
90: int pwcheck __P((char *, char *, char *, char *));
91: #if defined(KERBEROS) || defined(KERBEROS5)
92: int klogin __P((struct passwd *, char *, char *, char *));
93: void kdestroy __P((void));
94: void dofork __P((void));
95: #endif
96:
97: extern void login __P((struct utmp *));
98:
99: #define TTYGRPNAME "tty" /* name of group to own ttys */
100:
101: /*
102: * This bounds the time given to login. Not a define so it can
103: * be patched on machines where it's too small.
104: */
105: u_int timeout = 300;
106:
107: #if defined(KERBEROS) || defined(KERBEROS5)
108: int notickets = 1;
109: char *instance;
110: char *krbtkfile_env;
111: int authok;
112: #endif
113:
114: struct passwd *pwd;
115: int failures;
116: char term[64], *envinit[1], *hostname, *username, *tty;
117:
118: int
119: main(argc, argv)
120: int argc;
121: char *argv[];
122: {
123: extern char **environ;
124: struct group *gr;
125: struct stat st;
126: struct timeval tp;
127: struct utmp utmp;
128: int ask, ch, cnt, fflag, hflag, pflag, quietlog, rootlogin, rval;
129: uid_t uid;
130: char *domain, *p, *salt, *ttyn;
131: char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
132: char localhost[MAXHOSTNAMELEN];
133:
134: (void)signal(SIGALRM, timedout);
135: (void)alarm(timeout);
136: (void)signal(SIGQUIT, SIG_IGN);
137: (void)signal(SIGINT, SIG_IGN);
138: (void)setpriority(PRIO_PROCESS, 0, 0);
139:
140: openlog("login", LOG_ODELAY, LOG_AUTH);
141:
142: /*
143: * -p is used by getty to tell login not to destroy the environment
144: * -f is used to skip a second login authentication
145: * -h is used by other servers to pass the name of the remote
146: * host to login so that it may be placed in utmp and wtmp
147: */
148: domain = NULL;
149: if (gethostname(localhost, sizeof(localhost)) < 0)
150: syslog(LOG_ERR, "couldn't get local hostname: %m");
151: else
152: domain = strchr(localhost, '.');
153:
154: fflag = hflag = pflag = 0;
155: uid = getuid();
156: while ((ch = getopt(argc, argv, "fh:p")) != EOF)
157: switch (ch) {
158: case 'f':
159: fflag = 1;
160: break;
161: case 'h':
162: if (uid)
163: errx(1, "-h option: %s", strerror(EPERM));
164: hflag = 1;
165: if (domain && (p = strchr(optarg, '.')) &&
166: strcasecmp(p, domain) == 0)
167: *p = 0;
168: hostname = optarg;
169: break;
170: case 'p':
171: pflag = 1;
172: break;
173: case '?':
174: default:
175: if (!uid)
176: syslog(LOG_ERR, "invalid flag %c", ch);
177: (void)fprintf(stderr,
178: "usage: login [-fp] [-h hostname] [username]\n");
179: exit(1);
180: }
181: argc -= optind;
182: argv += optind;
183:
184: if (*argv) {
185: username = *argv;
186: ask = 0;
187: } else
188: ask = 1;
189:
190: for (cnt = getdtablesize(); cnt > 2; cnt--)
191: (void)close(cnt);
192:
193: ttyn = ttyname(STDIN_FILENO);
194: if (ttyn == NULL || *ttyn == '\0') {
195: (void)snprintf(tname, sizeof(tname), "%s??", _PATH_TTY);
196: ttyn = tname;
197: }
198: if (tty = strrchr(ttyn, '/'))
199: ++tty;
200: else
201: tty = ttyn;
202:
203: for (cnt = 0;; ask = 1) {
204: #if defined(KERBEROS) || defined(KERBEROS5)
205: kdestroy();
206: #endif
207: if (ask) {
208: fflag = 0;
209: getloginname();
210: }
211: rootlogin = 0;
212: #ifdef KERBEROS
213: if ((instance = strchr(username, '.')) != NULL) {
214: if (strncmp(instance, ".root", 5) == 0)
215: rootlogin = 1;
216: *instance++ = '\0';
217: } else
218: instance = "";
219: #endif
220: #ifdef KERBEROS5
221: if ((instance = strchr(username, '/')) != NULL) {
222: if (strncmp(instance, "/root", 5) == 0)
223: rootlogin = 1;
224: *instance++ = '\0';
225: } else
226: instance = "";
227: #endif
228: if (strlen(username) > UT_NAMESIZE)
229: username[UT_NAMESIZE] = '\0';
230:
231: /*
232: * Note if trying multiple user names; log failures for
233: * previous user name, but don't bother logging one failure
234: * for nonexistent name (mistyped username).
235: */
236: if (failures && strcmp(tbuf, username)) {
237: if (failures > (pwd ? 0 : 1))
238: badlogin(tbuf);
239: failures = 0;
240: }
241: (void)strcpy(tbuf, username);
242:
243: if (pwd = getpwnam(username))
244: salt = pwd->pw_passwd;
245: else
246: salt = "xx";
247:
248: /*
249: * if we have a valid account name, and it doesn't have a
250: * password, or the -f option was specified and the caller
251: * is root or the caller isn't changing their uid, don't
252: * authenticate.
253: */
254: if (pwd) {
255: if (pwd->pw_uid == 0)
256: rootlogin = 1;
257:
258: if (fflag && (uid == 0 || uid == pwd->pw_uid)) {
259: /* already authenticated */
260: break;
261: } else if (pwd->pw_passwd[0] == '\0') {
262: /* pretend password okay */
263: rval = 0;
264: goto ttycheck;
265: }
266: }
267:
268: fflag = 0;
269:
270: (void)setpriority(PRIO_PROCESS, 0, -4);
271:
272: p = getpass("Password:");
273:
274: if (pwd) {
275: #if defined(KERBEROS) || defined(KERBEROS5)
276: rval = klogin(pwd, instance, localhost, p);
277: if (rval != 0 && rootlogin && pwd->pw_uid != 0)
278: rootlogin = 0;
279: if (rval == 0)
280: authok = 1;
281: else if (rval == 1) {
282: if (pwd->pw_uid != 0)
283: rootlogin = 0;
284: rval = pwcheck(username, p, salt, pwd->pw_passwd);
285: }
286: #else
287: rval = pwcheck(username, p, salt, pwd->pw_passwd);
288: #endif
289: }
290: memset(p, 0, strlen(p));
291:
292: (void)setpriority(PRIO_PROCESS, 0, 0);
293:
294: ttycheck:
295: /*
296: * If trying to log in as root without Kerberos,
297: * but with insecure terminal, refuse the login attempt.
298: */
299: #if defined(KERBEROS) || defined(KERBEROS5)
300: if (authok == 0)
301: #endif
302: if (pwd && !rval && rootlogin && !rootterm(tty)) {
303: (void)fprintf(stderr,
304: "%s login refused on this terminal.\n",
305: pwd->pw_name);
306: if (hostname)
307: syslog(LOG_NOTICE,
308: "LOGIN %s REFUSED FROM %s ON TTY %s",
309: pwd->pw_name, hostname, tty);
310: else
311: syslog(LOG_NOTICE,
312: "LOGIN %s REFUSED ON TTY %s",
313: pwd->pw_name, tty);
314: continue;
315: }
316:
317: if (pwd && !rval)
318: break;
319:
320: (void)printf("Login incorrect\n");
321: failures++;
322: /* we allow 10 tries, but after 3 we start backing off */
323: if (++cnt > 3) {
324: if (cnt >= 10) {
325: badlogin(username);
326: sleepexit(1);
327: }
328: sleep((u_int)((cnt - 3) * 5));
329: }
330: }
331:
332: /* committed to login -- turn off timeout */
333: (void)alarm((u_int)0);
334:
335: endpwent();
336:
337: /* if user not super-user, check for disabled logins */
338: if (!rootlogin)
339: checknologin();
340:
1.5 deraadt 341: setegid(pwd->pw_gid);
342: seteuid(pwd->pw_uid);
343:
1.1 deraadt 344: if (chdir(pwd->pw_dir) < 0) {
345: (void)printf("No home directory %s!\n", pwd->pw_dir);
346: if (chdir("/"))
347: exit(0);
348: pwd->pw_dir = "/";
349: (void)printf("Logging in with home = \"/\".\n");
350: }
351:
352: quietlog = access(_PATH_HUSHLOGIN, F_OK) == 0;
1.5 deraadt 353:
354: seteuid(0);
355: setegid(0); /* XXX use a saved gid instead? */
1.1 deraadt 356:
357: if (pwd->pw_change || pwd->pw_expire)
358: (void)gettimeofday(&tp, (struct timezone *)NULL);
359: if (pwd->pw_change)
360: if (tp.tv_sec >= pwd->pw_change) {
361: (void)printf("Sorry -- your password has expired.\n");
362: sleepexit(1);
363: } else if (pwd->pw_change - tp.tv_sec <
364: 2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
365: (void)printf("Warning: your password expires on %s",
366: ctime(&pwd->pw_change));
367: if (pwd->pw_expire)
368: if (tp.tv_sec >= pwd->pw_expire) {
369: (void)printf("Sorry -- your account has expired.\n");
370: sleepexit(1);
371: } else if (pwd->pw_expire - tp.tv_sec <
372: 2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
373: (void)printf("Warning: your account expires on %s",
374: ctime(&pwd->pw_expire));
375:
376: /* Nothing else left to fail -- really log in. */
377: memset((void *)&utmp, 0, sizeof(utmp));
378: (void)time(&utmp.ut_time);
379: (void)strncpy(utmp.ut_name, username, sizeof(utmp.ut_name));
380: if (hostname)
381: (void)strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host));
382: (void)strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line));
383: login(&utmp);
384:
385: dolastlog(quietlog);
1.6 deraadt 386:
387: login_fbtab(tty, pwd->pw_uid, pwd->pw_gid);
1.1 deraadt 388:
389: (void)chown(ttyn, pwd->pw_uid,
390: (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid);
391: #if defined(KERBEROS) || defined(KERBEROS5)
392: /* Fork so that we can call kdestroy */
393: if (krbtkfile_env)
394: dofork();
395: #endif
396: (void)setgid(pwd->pw_gid);
397:
398: initgroups(username, pwd->pw_gid);
399:
400: if (*pwd->pw_shell == '\0')
401: pwd->pw_shell = _PATH_BSHELL;
402:
403: /* Destroy environment unless user has requested its preservation. */
404: if (!pflag)
405: environ = envinit;
1.9 ! millert 406: else {
! 407: char **cpp, **cpp2;
! 408:
! 409: for (cpp2 = cpp = environ; *cpp; cpp++) {
! 410: if (strncmp(*cpp, "LD_", 3) &&
! 411: strncmp(*cpp, "IFS=", 4))
! 412: *cpp2++ = *cpp;
! 413: }
! 414: *cpp2 = 0;
! 415: }
1.1 deraadt 416: (void)setenv("HOME", pwd->pw_dir, 1);
417: (void)setenv("SHELL", pwd->pw_shell, 1);
418: if (term[0] == '\0')
419: (void)strncpy(term, stypeof(tty), sizeof(term));
420: (void)setenv("TERM", term, 0);
421: (void)setenv("LOGNAME", pwd->pw_name, 1);
422: (void)setenv("USER", pwd->pw_name, 1);
423: (void)setenv("PATH", _PATH_DEFPATH, 0);
424: #ifdef KERBEROS
425: if (krbtkfile_env)
426: (void)setenv("KRBTKFILE", krbtkfile_env, 1);
427: #endif
428: #ifdef KERBEROS5
429: if (krbtkfile_env)
430: (void)setenv("KRB5CCNAME", krbtkfile_env, 1);
431: #endif
432:
433: if (tty[sizeof("tty")-1] == 'd')
434: syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name);
435:
436: /* If fflag is on, assume caller/authenticator has logged root login. */
437: if (rootlogin && fflag == 0)
438: if (hostname)
439: syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s",
440: username, tty, hostname);
441: else
442: syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty);
443:
444: #if defined(KERBEROS) || defined(KERBEROS5)
445: if (!quietlog && notickets == 1)
446: (void)printf("Warning: no Kerberos tickets issued.\n");
447: #endif
448:
449: if (!quietlog) {
1.2 deraadt 450: #if 0
1.1 deraadt 451: (void)printf("%s\n\t%s %s\n\n",
452: "Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994",
453: "The Regents of the University of California. ",
454: "All rights reserved.");
1.2 deraadt 455: #endif
1.1 deraadt 456: motd();
457: (void)snprintf(tbuf,
458: sizeof(tbuf), "%s/%s", _PATH_MAILDIR, pwd->pw_name);
459: if (stat(tbuf, &st) == 0 && st.st_size != 0)
460: (void)printf("You have %smail.\n",
461: (st.st_mtime > st.st_atime) ? "new " : "");
462: }
463:
464: (void)signal(SIGALRM, SIG_DFL);
465: (void)signal(SIGQUIT, SIG_DFL);
466: (void)signal(SIGINT, SIG_DFL);
467: (void)signal(SIGTSTP, SIG_IGN);
468:
469: tbuf[0] = '-';
470: (void)strcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ?
471: p + 1 : pwd->pw_shell);
472:
473: if (setlogin(pwd->pw_name) < 0)
474: syslog(LOG_ERR, "setlogin() failure: %m");
475:
476: /* Discard permissions last so can't get killed and drop core. */
477: if (rootlogin)
478: (void) setuid(0);
479: else
480: (void) setuid(pwd->pw_uid);
481:
482: execlp(pwd->pw_shell, tbuf, 0);
483: err(1, "%s", pwd->pw_shell);
484: }
485:
486: int
487: pwcheck(user, p, salt, passwd)
488: char *user, *p, *salt, *passwd;
489: {
490: #ifdef SKEY
1.8 millert 491: if (strcasecmp(p, "s/key") == 0)
1.7 deraadt 492: return skey_authenticate(user);
1.1 deraadt 493: #endif
494: return strcmp(crypt(p, salt), passwd);
495: }
496:
497: #if defined(KERBEROS) || defined(KERBEROS5)
498: #define NBUFSIZ (UT_NAMESIZE + 1 + 5) /* .root suffix */
499: #else
500: #define NBUFSIZ (UT_NAMESIZE + 1)
501: #endif
502:
503: #if defined(KERBEROS) || defined(KERBEROS5)
504: /*
505: * This routine handles cleanup stuff, and the like.
506: * It exists only in the child process.
507: */
508: #include <sys/wait.h>
509: void
510: dofork()
511: {
512: int child;
513:
514: if (!(child = fork()))
515: return; /* Child process */
516:
517: /* Setup stuff? This would be things we could do in parallel with login */
518: (void) chdir("/"); /* Let's not keep the fs busy... */
519:
520: /* If we're the parent, watch the child until it dies */
521: while (wait(0) != child)
522: ;
523:
524: /* Cleanup stuff */
525: /* Run kdestroy to destroy tickets */
526: kdestroy();
527:
528: /* Leave */
529: exit(0);
530: }
531: #endif
532:
533: void
534: getloginname()
535: {
536: int ch;
537: char *p;
538: static char nbuf[NBUFSIZ];
539:
540: for (;;) {
541: (void)printf("login: ");
542: for (p = nbuf; (ch = getchar()) != '\n'; ) {
543: if (ch == EOF) {
544: badlogin(username);
545: exit(0);
546: }
547: if (p < nbuf + (NBUFSIZ - 1))
548: *p++ = ch;
549: }
550: if (p > nbuf)
551: if (nbuf[0] == '-')
552: (void)fprintf(stderr,
553: "login names may not start with '-'.\n");
554: else {
555: *p = '\0';
556: username = nbuf;
557: break;
558: }
559: }
560: }
561:
562: int
563: rootterm(ttyn)
564: char *ttyn;
565: {
566: struct ttyent *t;
567:
568: return ((t = getttynam(ttyn)) && t->ty_status & TTY_SECURE);
569: }
570:
571: jmp_buf motdinterrupt;
572:
573: void
574: motd()
575: {
576: int fd, nchars;
577: sig_t oldint;
578: char tbuf[8192];
579:
580: if ((fd = open(_PATH_MOTDFILE, O_RDONLY, 0)) < 0)
581: return;
582: oldint = signal(SIGINT, sigint);
583: if (setjmp(motdinterrupt) == 0)
584: while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
585: (void)write(fileno(stdout), tbuf, nchars);
586: (void)signal(SIGINT, oldint);
587: (void)close(fd);
588: }
589:
590: /* ARGSUSED */
591: void
592: sigint(signo)
593: int signo;
594: {
595: longjmp(motdinterrupt, 1);
596: }
597:
598: /* ARGSUSED */
599: void
600: timedout(signo)
601: int signo;
602: {
603: (void)fprintf(stderr, "Login timed out after %d seconds\n", timeout);
604: exit(0);
605: }
606:
607: void
608: checknologin()
609: {
610: int fd, nchars;
611: char tbuf[8192];
612:
613: if ((fd = open(_PATH_NOLOGIN, O_RDONLY, 0)) >= 0) {
614: while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
615: (void)write(fileno(stdout), tbuf, nchars);
616: sleepexit(0);
617: }
618: }
619:
620: void
621: dolastlog(quiet)
622: int quiet;
623: {
624: struct lastlog ll;
625: int fd;
626:
627: if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
628: (void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), L_SET);
629: if (!quiet) {
630: if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) &&
631: ll.ll_time != 0) {
632: (void)printf("Last login: %.*s ",
633: 24-5, (char *)ctime(&ll.ll_time));
634: if (*ll.ll_host != '\0')
635: (void)printf("from %.*s\n",
636: (int)sizeof(ll.ll_host),
637: ll.ll_host);
638: else
639: (void)printf("on %.*s\n",
640: (int)sizeof(ll.ll_line),
641: ll.ll_line);
642: }
643: (void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), L_SET);
644: }
645: memset((void *)&ll, 0, sizeof(ll));
646: (void)time(&ll.ll_time);
647: (void)strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
648: if (hostname)
649: (void)strncpy(ll.ll_host, hostname, sizeof(ll.ll_host));
650: (void)write(fd, (char *)&ll, sizeof(ll));
651: (void)close(fd);
652: }
653: }
654:
655: void
656: badlogin(name)
657: char *name;
658: {
659: if (failures == 0)
660: return;
661: if (hostname) {
662: syslog(LOG_NOTICE, "%d LOGIN FAILURE%s FROM %s",
663: failures, failures > 1 ? "S" : "", hostname);
664: syslog(LOG_AUTHPRIV|LOG_NOTICE,
665: "%d LOGIN FAILURE%s FROM %s, %s",
666: failures, failures > 1 ? "S" : "", hostname, name);
667: } else {
668: syslog(LOG_NOTICE, "%d LOGIN FAILURE%s ON %s",
669: failures, failures > 1 ? "S" : "", tty);
670: syslog(LOG_AUTHPRIV|LOG_NOTICE,
671: "%d LOGIN FAILURE%s ON %s, %s",
672: failures, failures > 1 ? "S" : "", tty, name);
673: }
674: }
675:
676: #undef UNKNOWN
677: #define UNKNOWN "su"
678:
679: char *
680: stypeof(ttyid)
681: char *ttyid;
682: {
683: struct ttyent *t;
684:
685: return (ttyid && (t = getttynam(ttyid)) ? t->ty_type : UNKNOWN);
686: }
687:
688: void
689: sleepexit(eval)
690: int eval;
691: {
692: (void)sleep(5);
693: exit(eval);
694: }