version 1.23, 1997/11/04 19:01:05 |
version 1.24, 1998/03/26 20:28:11 |
|
|
#include <unistd.h> |
#include <unistd.h> |
#include <utmp.h> |
#include <utmp.h> |
#include <util.h> |
#include <util.h> |
|
#include <skey.h> |
|
|
#include "pathnames.h" |
#include "pathnames.h" |
|
|
|
|
int klogin __P((struct passwd *, char *, char *, char *)); |
int klogin __P((struct passwd *, char *, char *, char *)); |
void kdestroy __P((void)); |
void kdestroy __P((void)); |
void dofork __P((void)); |
void dofork __P((void)); |
|
void kgettokens __P((char *)); |
#endif |
#endif |
|
|
extern void login __P((struct utmp *)); |
extern void login __P((struct utmp *)); |
|
|
|
|
if (pwd->pw_change || pwd->pw_expire) |
if (pwd->pw_change || pwd->pw_expire) |
(void)gettimeofday(&tp, (struct timezone *)NULL); |
(void)gettimeofday(&tp, (struct timezone *)NULL); |
if (pwd->pw_change) |
if (pwd->pw_change) { |
if (tp.tv_sec >= pwd->pw_change) { |
if (tp.tv_sec >= pwd->pw_change) { |
(void)printf("Sorry -- your password has expired.\n"); |
(void)printf("Sorry -- your password has expired.\n"); |
sleepexit(1); |
sleepexit(1); |
|
|
2 * DAYSPERWEEK * SECSPERDAY && !quietlog) |
2 * DAYSPERWEEK * SECSPERDAY && !quietlog) |
(void)printf("Warning: your password expires on %s", |
(void)printf("Warning: your password expires on %s", |
ctime(&pwd->pw_change)); |
ctime(&pwd->pw_change)); |
if (pwd->pw_expire) |
} |
|
if (pwd->pw_expire) { |
if (tp.tv_sec >= pwd->pw_expire) { |
if (tp.tv_sec >= pwd->pw_expire) { |
(void)printf("Sorry -- your account has expired.\n"); |
(void)printf("Sorry -- your account has expired.\n"); |
sleepexit(1); |
sleepexit(1); |
|
|
2 * DAYSPERWEEK * SECSPERDAY && !quietlog) |
2 * DAYSPERWEEK * SECSPERDAY && !quietlog) |
(void)printf("Warning: your account expires on %s", |
(void)printf("Warning: your account expires on %s", |
ctime(&pwd->pw_expire)); |
ctime(&pwd->pw_expire)); |
|
} |
|
|
/* Nothing else left to fail -- really log in. */ |
/* Nothing else left to fail -- really log in. */ |
(void)signal(SIGHUP, SIG_DFL); |
(void)signal(SIGHUP, SIG_DFL); |
|
|
pwd->pw_shell = _PATH_BSHELL; |
pwd->pw_shell = _PATH_BSHELL; |
|
|
/* Destroy environment unless user has requested its preservation. */ |
/* Destroy environment unless user has requested its preservation. */ |
if (!pflag) |
if (!pflag) { |
if ((environ = calloc(1, sizeof (char *))) == NULL) |
if ((environ = calloc(1, sizeof (char *))) == NULL) |
err(1, "calloc"); |
err(1, "calloc"); |
else { |
} else { |
char **cpp, **cpp2; |
char **cpp, **cpp2; |
|
|
for (cpp2 = cpp = environ; *cpp; cpp++) { |
for (cpp2 = cpp = environ; *cpp; cpp++) { |
|
|
#endif |
#endif |
|
|
/* If fflag is on, assume caller/authenticator has logged root login. */ |
/* If fflag is on, assume caller/authenticator has logged root login. */ |
if (rootlogin && fflag == 0) |
if (rootlogin && fflag == 0) { |
if (hostname) |
if (hostname) |
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s%s%s", |
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s%s%s", |
username, tty, rusername ? rusername : "", |
username, tty, rusername ? rusername : "", |
rusername ? "@" : "", hostname); |
rusername ? "@" : "", hostname); |
else |
else |
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty); |
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty); |
|
} |
|
|
#if defined(KERBEROS) || defined(KERBEROS5) |
#if defined(KERBEROS) || defined(KERBEROS5) |
if (!quietlog && notickets == 1) |
if (!quietlog && notickets == 1) |
|
|
(void) seteuid(pwd->pw_uid); |
(void) seteuid(pwd->pw_uid); |
(void) setuid(pwd->pw_uid); |
(void) setuid(pwd->pw_uid); |
} |
} |
|
#ifdef KERBEROS |
|
kgettokens(pwd->pw_dir); |
|
#endif |
|
|
execlp(pwd->pw_shell, tbuf, 0); |
execlp(pwd->pw_shell, tbuf, 0); |
err(1, "%s", pwd->pw_shell); |
err(1, "%s", pwd->pw_shell); |
|
|
if (p < nbuf + (NBUFSIZ - 1)) |
if (p < nbuf + (NBUFSIZ - 1)) |
*p++ = ch; |
*p++ = ch; |
} |
} |
if (p > nbuf) |
if (p > nbuf) { |
if (nbuf[0] == '-') |
if (nbuf[0] == '-') |
(void)fprintf(stderr, |
(void)fprintf(stderr, |
"login names may not start with '-'.\n"); |
"login names may not start with '-'.\n"); |
|
|
username = nbuf; |
username = nbuf; |
break; |
break; |
} |
} |
|
} |
} |
} |
} |
} |
|
|