diff options
author | Mike Frysinger | 2005-07-01 01:04:32 +0000 |
---|---|---|
committer | Mike Frysinger | 2005-07-01 01:04:32 +0000 |
commit | 8deb686d2e07ab812887a1a43a00ce5035c2b590 (patch) | |
tree | 132237fb52e98c8d72570d7ee2728f3e299383de /loginutils/login.c | |
parent | a87bb6080925177b0c09416a6b4e213bd9450042 (diff) | |
download | busybox-8deb686d2e07ab812887a1a43a00ce5035c2b590.zip busybox-8deb686d2e07ab812887a1a43a00ce5035c2b590.tar.gz |
Patch by jonlar in Bug 312 to split the U_W_TMP feature into sep UTMP and WTMP options
Diffstat (limited to 'loginutils/login.c')
-rw-r--r-- | loginutils/login.c | 16 |
1 files changed, 9 insertions, 7 deletions
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 <errno.h> #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 */ |