config CONFIG_WHO
bool "who"
default n
- select CONFIG_FEATURE_U_W_TMP
+ select CONFIG_FEATURE_UTMP
help
who is used to show who is logged on.
help
getty lets you log in on a tty, it is normally invoked by init.
-config CONFIG_FEATURE_U_W_TMP
- bool " Support utmp and wtmp files"
- depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO || CONFIG_LAST
+config CONFIG_FEATURE_UTMP
+ bool " Support utmp file"
+ depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO
default n
help
- The files /var/run/utmp and /var/run/wtmp can be used to track when
- user's have logged into and logged out of the system, allowing programs
- such as 'who' and 'last' to list who is currently logged in.
+ The file /var/run/utmp is used to track who is currently logged in.
+
+config CONFIG_FEATURE_WTMP
+ bool " Support wtmp file"
+ depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_LAST
+ default n
+ select CONFIG_FEATURE_UTMP
+ help
+ The file /var/run/wtmp is used to track when user's have logged into
+ and logged out of the system.
config CONFIG_LOGIN
bool "login"
#ifdef LOGIN_PROCESS /* defined in System V utmp.h */
#define SYSV_STYLE /* select System V style getty */
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_WTMP
extern void updwtmp(const char *filename, const struct utmp *ut);
#endif
#endif /* LOGIN_PROCESS */
static int bcode(char *s);
static void error(const char *fmt, ...) __attribute__ ((noreturn));
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
static void update_utmp(char *line);
#endif
#ifdef SYSV_STYLE
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
update_utmp(options.tty);
#endif
#endif
}
#ifdef SYSV_STYLE
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
/* update_utmp - update our utmp entry */
static void update_utmp(char *line)
pututline(&ut);
endutent();
- {
- if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
- close(creat(_PATH_WTMP, 0664));
- }
- updwtmp(_PATH_WTMP, &ut);
- }
+#ifdef CONFIG_FEATURE_WTMP
+ if (access(_PATH_WTMP, R_OK|W_OK) == -1)
+ close(creat(_PATH_WTMP, 0664));
+ updwtmp(_PATH_WTMP, &ut);
+#endif
}
-#endif /* CONFIG_FEATURE_U_W_TMP */
+#endif /* CONFIG_FEATURE_UTMP */
#endif /* SYSV_STYLE */
/* open_tty - set up tty as standard { input, output, error } */
#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);
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
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 );
if ( check_nologin ( pw-> pw_uid == 0 ))
return EXIT_FAILURE;
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
setutmp ( username, tty );
#endif
}
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
// vv Taken from tinylogin utmp.c vv
#define NO_UTENT \
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 */
opt_args = argv + optind;
#if defined( SYSLOG_SUCCESS ) || defined( SYSLOG_FAILURE )
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
/* The utmp entry (via getlogin) is probably the best way to identify
the user, especially if someone su's from a su-shell. */
old_user = getlogin ( );
config CONFIG_LAST
bool "last"
default n
- select CONFIG_FEATURE_U_W_TMP
+ select CONFIG_FEATURE_WTMP
help
'last' displays a list of the last users that logged into the system.