From dbd22cf8cf3968bbc20e1f81067865328b3ade88 Mon Sep 17 00:00:00 2001 From: luigi Date: Sun, 14 Feb 2010 15:51:36 +0000 Subject: a minimal set of changes to adapt to the utmp->utmpx changes. lastlog still not implemented, i am hoping that Ed or someone has some idea on how to fix this, but it is really not important. --- release/picobsd/tinyware/login/pico-login.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'release/picobsd') diff --git a/release/picobsd/tinyware/login/pico-login.c b/release/picobsd/tinyware/login/pico-login.c index 2f333a4..b03dad5 100644 --- a/release/picobsd/tinyware/login/pico-login.c +++ b/release/picobsd/tinyware/login/pico-login.c @@ -76,7 +76,7 @@ static const char rcsid[] = #include #include #include -#include +#include #ifdef USE_PAM #include @@ -119,7 +119,6 @@ static char **environ_pam; #endif static int auth_traditional(void); -extern void login(struct utmp *); static void usage(void); #define TTYGRPNAME "tty" /* name of group to own ttys */ @@ -152,7 +151,7 @@ main(argc, argv) struct group *gr; struct stat st; struct timeval tp; - struct utmp utmp; + struct utmpx utmp; int rootok, retries, backoff; int ask, ch, cnt, fflag, hflag, pflag, quietlog, rootlogin, rval; int changepass; @@ -164,6 +163,8 @@ main(argc, argv) char tname[sizeof(_PATH_TTY) + 10]; const char *shell = NULL; login_cap_t *lc = NULL; + int UT_HOSTSIZE = sizeof(utmp.ut_host); + int UT_NAMESIZE = sizeof(utmp.ut_user); #ifdef USE_PAM pid_t pid; int e; @@ -508,14 +509,18 @@ main(argc, argv) refused("Permission denied", "ACCESS", 1); #endif /* LOGIN_ACCESS */ +#if 1 + ulog_login(tty, username, hostname); +#else /* Nothing else left to fail -- really log in. */ memset((void *)&utmp, 0, sizeof(utmp)); - (void)time(&utmp.ut_time); - (void)strncpy(utmp.ut_name, username, sizeof(utmp.ut_name)); + (void)gettimeofday(&utmp.ut_tv, NULL); + (void)strncpy(utmp.ut_user, username, sizeof(utmp.ut_user)); if (hostname) (void)strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host)); (void)strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line)); login(&utmp); +#endif dolastlog(quietlog); @@ -903,7 +908,7 @@ usage() * Allow for authentication style and/or kerberos instance */ -#define NBUFSIZ UT_NAMESIZE + 64 +#define NBUFSIZ 128 // XXX was UT_NAMESIZE + 64 void getloginname() @@ -985,6 +990,7 @@ void dolastlog(quiet) int quiet; { +#if 0 /* XXX not implemented after utmp->utmpx change */ struct lastlog ll; int fd; @@ -1016,6 +1022,7 @@ dolastlog(quiet) } else { syslog(LOG_ERR, "cannot open %s: %m", _PATH_LASTLOG); } +#endif } void -- cgit v1.1