From 8deb686d2e07ab812887a1a43a00ce5035c2b590 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 1 Jul 2005 01:04:32 +0000 Subject: Patch by jonlar in Bug 312 to split the U_W_TMP feature into sep UTMP and WTMP options --- loginutils/login.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'loginutils/login.c') diff --git a/loginutils/login.c b/loginutils/login.c index 5186e23..6632a76 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -23,7 +23,7 @@ #include #endif -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP // import from utmp.c static void checkutmp(int picky); static void setutmp(const char *name, const char *line); @@ -121,7 +121,7 @@ extern int login_main(int argc, char **argv) if ( !isatty ( 0 ) || !isatty ( 1 ) || !isatty ( 2 )) return EXIT_FAILURE; /* Must be a terminal */ -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP checkutmp ( !amroot ); #endif @@ -133,13 +133,13 @@ extern int login_main(int argc, char **argv) else safe_strncpy ( tty, "UNKNOWN", sizeof( tty )); -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP if ( amroot ) memset ( utent.ut_host, 0, sizeof utent.ut_host ); #endif if ( opt_host ) { -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host )); #endif snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s' from `%.200s'", tty, opt_host ); @@ -221,7 +221,7 @@ auth_ok: if ( check_nologin ( pw-> pw_uid == 0 )) return EXIT_FAILURE; -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP setutmp ( username, tty ); #endif @@ -402,7 +402,7 @@ static void motd (void) } -#ifdef CONFIG_FEATURE_U_W_TMP +#ifdef CONFIG_FEATURE_UTMP // vv Taken from tinylogin utmp.c vv #define NO_UTENT \ @@ -480,9 +480,11 @@ static void setutmp(const char *name, const char *line) setutent(); pututline(&utent); endutent(); +#ifdef CONFIG_FEATURE_WTMP if (access(_PATH_WTMP, R_OK|W_OK) == -1) { close(creat(_PATH_WTMP, 0664)); } updwtmp(_PATH_WTMP, &utent); +#endif } -#endif /* CONFIG_FEATURE_U_W_TMP */ +#endif /* CONFIG_FEATURE_UTMP */ -- cgit v1.1