summaryrefslogtreecommitdiffstats
path: root/login-utils/su.c
diff options
context:
space:
mode:
authorLudwig Nussel2012-05-25 10:21:09 +0200
committerLudwig Nussel2012-05-25 10:21:09 +0200
commitf29fc7e0bb5aa38f45188560ed36ed4ad69d46e4 (patch)
tree2b154fcedaac7ef9929816850e2545881aa868a4 /login-utils/su.c
parentremove non pam code (diff)
downloadkernel-qcow2-util-linux-f29fc7e0bb5aa38f45188560ed36ed4ad69d46e4.tar.gz
kernel-qcow2-util-linux-f29fc7e0bb5aa38f45188560ed36ed4ad69d46e4.tar.xz
kernel-qcow2-util-linux-f29fc7e0bb5aa38f45188560ed36ed4ad69d46e4.zip
syslog always
Diffstat (limited to 'login-utils/su.c')
-rw-r--r--login-utils/su.c33
1 files changed, 4 insertions, 29 deletions
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 <sys/fsuid.h>
#include <syslog.h>
-#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;