From f29fc7e0bb5aa38f45188560ed36ed4ad69d46e4 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Fri, 25 May 2012 10:21:09 +0200 Subject: syslog always --- login-utils/su.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'login-utils/su.c') diff --git a/login-utils/su.c b/login-utils/su.c index 7bacbc382..6ee331163 100644 --- a/login-utils/su.c +++ b/login-utils/su.c @@ -63,9 +63,6 @@ enum #include #include -#define SYSLOG_SUCCESS 1 -#define SYSLOG_FAILURE 1 -#define SYSLOG_NON_ROOT 1 #include "error.h" @@ -148,7 +145,6 @@ xsetenv (char const *name, char const *val) error (EXIT_FAILURE, 0, _("out of memory")); } -#if defined SYSLOG_SUCCESS || defined SYSLOG_FAILURE /* Log the fact that someone has run su to the user given by PW; if SUCCESSFUL is true, they gave the correct password, etc. */ @@ -157,10 +153,6 @@ log_su (struct passwd const *pw, bool successful) { const char *new_user, *old_user, *tty; -# ifndef SYSLOG_NON_ROOT - if (pw->pw_uid) - return; -# endif new_user = pw->pw_name; /* The utmp entry (via getlogin) is probably the best way to identify the user, especially if someone su's from a su-shell. */ @@ -175,26 +167,13 @@ log_su (struct passwd const *pw, bool successful) tty = ttyname (STDERR_FILENO); if (!tty) tty = "none"; - /* 4.2BSD openlog doesn't have the third parameter. */ - openlog (basename (program_name), 0 -# ifdef LOG_AUTH - , LOG_AUTH -# endif - ); - syslog (LOG_NOTICE, -# ifdef SYSLOG_NON_ROOT - "%s(to %s) %s on %s", -# else - "%s%s on %s", -# endif + + openlog (basename (program_name), 0 , LOG_AUTH); + syslog (LOG_NOTICE, "%s(to %s) %s on %s", successful ? "" : "FAILED SU ", -# ifdef SYSLOG_NON_ROOT - new_user, -# endif - old_user, tty); + new_user, old_user, tty); closelog (); } -#endif static struct pam_conv conv = { @@ -801,18 +780,14 @@ main (int argc, char **argv) if (!correct_password (pw)) { -#ifdef SYSLOG_FAILURE log_su (pw, false); -#endif sleep (getdef_num ("FAIL_DELAY", 1)); error (EXIT_FAIL, 0, _("incorrect password")); } -#ifdef SYSLOG_SUCCESS else { log_su (pw, true); } -#endif if (request_same_session || !command || !pw->pw_uid) same_session = 1; -- cgit v1.2.3-55-g7522