[BusyBox-cvs] svn commit: trunk/busybox: coreutils loginutils miscutils

vapier at busybox.net vapier at busybox.net
Fri Jul 1 01:04:33 UTC 2005


Author: vapier
Date: 2005-06-30 19:04:32 -0600 (Thu, 30 Jun 2005)
New Revision: 10679

Log:
Patch by jonlar in Bug 312 to split the U_W_TMP feature into sep UTMP and WTMP options


Modified:
   trunk/busybox/coreutils/Config.in
   trunk/busybox/loginutils/Config.in
   trunk/busybox/loginutils/getty.c
   trunk/busybox/loginutils/login.c
   trunk/busybox/loginutils/su.c
   trunk/busybox/miscutils/Config.in


Changeset:
Modified: trunk/busybox/coreutils/Config.in
===================================================================
--- trunk/busybox/coreutils/Config.in	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/coreutils/Config.in	2005-07-01 01:04:32 UTC (rev 10679)
@@ -597,7 +597,7 @@
 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.
 

Modified: trunk/busybox/loginutils/Config.in
===================================================================
--- trunk/busybox/loginutils/Config.in	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/loginutils/Config.in	2005-07-01 01:04:32 UTC (rev 10679)
@@ -57,15 +57,22 @@
 	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"
 	default n

Modified: trunk/busybox/loginutils/getty.c
===================================================================
--- trunk/busybox/loginutils/getty.c	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/loginutils/getty.c	2005-07-01 01:04:32 UTC (rev 10679)
@@ -47,7 +47,7 @@
 
 #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 */
@@ -231,7 +231,7 @@
 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
 
@@ -289,7 +289,7 @@
 
 
 #ifdef	SYSV_STYLE
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
 	update_utmp(options.tty);
 #endif
 #endif
@@ -482,7 +482,7 @@
 }
 
 #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)
@@ -533,15 +533,14 @@
 	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 } */

Modified: trunk/busybox/loginutils/login.c
===================================================================
--- trunk/busybox/loginutils/login.c	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/loginutils/login.c	2005-07-01 01:04:32 UTC (rev 10679)
@@ -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 @@
 	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 @@
 	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 @@
 	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 @@
 }
 
 
-#ifdef CONFIG_FEATURE_U_W_TMP
+#ifdef CONFIG_FEATURE_UTMP
 // vv  Taken from tinylogin utmp.c  vv
 
 #define	NO_UTENT \
@@ -480,9 +480,11 @@
 	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 */

Modified: trunk/busybox/loginutils/su.c
===================================================================
--- trunk/busybox/loginutils/su.c	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/loginutils/su.c	2005-07-01 01:04:32 UTC (rev 10679)
@@ -91,7 +91,7 @@
 		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 ( );

Modified: trunk/busybox/miscutils/Config.in
===================================================================
--- trunk/busybox/miscutils/Config.in	2005-07-01 00:35:16 UTC (rev 10678)
+++ trunk/busybox/miscutils/Config.in	2005-07-01 01:04:32 UTC (rev 10679)
@@ -93,7 +93,7 @@
 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.
 



More information about the busybox-cvs mailing list