-#include "busybox.h"
-
-
-
-/* The shell to run if none is given in the user's passwd entry. */
-#define DEFAULT_SHELL "/bin/sh"
-#define DEFAULT_USER "root"
-
-//#define SYSLOG_SUCCESS
-#define SYSLOG_FAILURE
-
-
-#if defined( SYSLOG_SUCCESS ) || defined( SYSLOG_FAILURE )
-/* Log the fact that someone has run su to the user given by PW;
- if SUCCESSFUL is nonzero, they gave the correct password, etc. */
-
-static void log_su ( const struct passwd *pw, int successful )
-{
- const char *old_user, *tty;
-
-#if !defined( SYSLOG_SUCESS )
- if ( successful )
- return;
-#endif
-#if !defined( SYSLOG_FAILURE )
- if ( !successful )
- return;
-#endif
-
- if ( pw-> pw_uid ) // not to root -> ignored
- return;
-
- /* 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 ( );
- if ( !old_user ) {
- /* getlogin can fail -- usually due to lack of utmp entry. Resort to getpwuid. */
- struct passwd *pwd = getpwuid ( getuid ( ));
- old_user = ( pwd ? pwd-> pw_name : "" );
- }
-
- tty = ttyname ( 2 );
-
- openlog ( "su", 0, LOG_AUTH );
- syslog ( LOG_NOTICE, "%s%s on %s", successful ? "" : "FAILED SU ", old_user, tty ? tty : "none" );
-}
-#endif
-
-