diff options
| author | Theodore Tso <tytso@mit.edu> | 1993-12-24 22:45:23 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1993-12-24 22:45:23 +0000 |
| commit | cfe0d7331bf6aa757e57e4e4b535db0f8b50cd00 (patch) | |
| tree | d6e8808699dc79ae22cf8a03d6332e0beb3cf502 /src/appl/bsd/logutil.c | |
| parent | da2c69cca28334b25cfd3962de75b7822573c8a1 (diff) | |
| download | krb5-cfe0d7331bf6aa757e57e4e4b535db0f8b50cd00.tar.gz krb5-cfe0d7331bf6aa757e57e4e4b535db0f8b50cd00.tar.xz krb5-cfe0d7331bf6aa757e57e4e4b535db0f8b50cd00.zip | |
Lots of cleanup. V4/V5 compatibility recvauth moved to separate
library function.
Folded in rest of GZA's patches.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3278 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/bsd/logutil.c')
| -rw-r--r-- | src/appl/bsd/logutil.c | 90 |
1 files changed, 35 insertions, 55 deletions
diff --git a/src/appl/bsd/logutil.c b/src/appl/bsd/logutil.c index 645df54592..861fa89d85 100644 --- a/src/appl/bsd/logutil.c +++ b/src/appl/bsd/logutil.c @@ -15,10 +15,6 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)login.c 5.1 (Berkeley) 9/27/88"; -#endif /* LIBC_SCCS and not lint */ - #include <sys/types.h> #include <sys/file.h> #if defined (CRAY) || defined (sgi) @@ -28,6 +24,7 @@ static char sccsid[] = "@(#)login.c 5.1 (Berkeley) 9/27/88"; #endif #include <utmp.h> #include <stdio.h> +#include <strings.h> #include <sys/time.h> #include <sys/stat.h> @@ -46,64 +43,61 @@ void login(ut) struct utmp *ut; { register int fd; + struct utmp utmp; int tty; - off_t lseek(); +#if defined(_AIX) + if (!ut->ut_pid) + ut->ut_pid = getppid(); + ut->ut_type = USER_PROCESS; + (void) strncpy(ut->ut_id, ut->ut_line, sizeof(ut->ut_id)); + + (void) setutent(); + (void) bzero((char *)&utmp, sizeof(utmp)); + (void) strncpy(utmp.ut_id, ut->ut_id, sizeof(utmp.ut_id)); + utmp.ut_type = DEAD_PROCESS; + (void) getutid(&utmp); + + (void) pututline(ut); + (void) endutent(); +#else tty = ttyslot(); if (tty > 0 && (fd = open(UTMP_FILE, O_WRONLY, 0)) >= 0) { (void)lseek(fd, (long)(tty * sizeof(struct utmp)), L_SET); (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } +#endif if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) { (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } } - - -/* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)logout.c 5.1 (Berkeley) 8/31/88"; -#endif /* LIBC_SCCS and not lint */ - logout(line) - register char *line; + register char *line; { register FILE *fp; struct utmp ut; int rval; - time_t time(); if (!(fp = fopen(UTMP_FILE, "r+"))) - return(0); + return(0); rval = 1; while (fread((char *)&ut, sizeof(struct utmp), 1, fp) == 1) { if (!ut.ut_name[0] || strncmp(ut.ut_line, line, sizeof(ut.ut_line))) - continue; + continue; memset(ut.ut_name,0, sizeof(ut.ut_name)); #ifndef NO_UT_HOST memset(ut.ut_host,0, sizeof(ut.ut_host)); #endif (void)time(&ut.ut_time); +#if defined(_AIX) + memset(ut.ut_id, 0, sizeof(ut.ut_id)); + ut.ut_pid = ut.ut_exit.e_exit = 0; + ut.ut_type = EMPTY; +#endif (void)fseek(fp, (long)-sizeof(struct utmp), L_INCR); (void)fwrite((char *)&ut, sizeof(struct utmp), 1, fp); (void)fseek(fp, (long)0, L_INCR); @@ -113,29 +107,6 @@ logout(line) return(rval); } - - -/* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)logwtmp.c 5.2 (Berkeley) 9/20/88"; -#endif /* LIBC_SCCS and not lint */ - static int fd = -1; #ifndef SYSV @@ -169,6 +140,15 @@ logwtmp(line, name, host, keep_open, logingin) ut.ut_pid = getpid(); #endif (void)time(&ut.ut_time); +#if defined(_AIX) + if (*name) { + if (!ut.ut_pid) + ut.ut_pid = getpid(); + ut.ut_type = USER_PROCESS; + } else { + ut.ut_type = EMPTY; + } +#endif if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp)) (void)ftruncate(fd, buf.st_size); |
