]> granicus.if.org Git - shadow/commitdiff
Reduces syslog priority of common usage events
authorMichael Herold <quabla@hemio.de>
Thu, 4 Aug 2016 20:17:31 +0000 (22:17 +0200)
committerGitHub <noreply@github.com>
Thu, 4 Aug 2016 20:17:31 +0000 (22:17 +0200)
- Log INFO instead of ERR on `su missing-user`
- Log NOTICE/WARN instead of ERR on pam_authenticate failure (wrong password for example)

src/su.c

index 37042172e4bb2f78fd76d8c42f19a81b80e2ee51..077537e542f68a3015fc4e4cb379253057c9acf2 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -422,7 +422,7 @@ static void check_perms_pam (const struct passwd *pw)
        int ret;
        ret = pam_authenticate (pamh, 0);
        if (PAM_SUCCESS != ret) {
-               SYSLOG ((LOG_ERR, "pam_authenticate: %s",
+               SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN, "pam_authenticate: %s",
                         pam_strerror (pamh, ret)));
                fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
                (void) pam_end (pamh, ret);
@@ -585,7 +585,7 @@ static /*@only@*/struct passwd * check_perms (void)
        if (NULL == pw) {
                (void) fprintf (stderr,
                                _("No passwd entry for user '%s'\n"), name);
-               SYSLOG ((LOG_ERR, "No passwd entry for user '%s'", name));
+               SYSLOG ((LOG_NOTICE, "No passwd entry for user '%s'", name));
                su_failure (caller_tty, true);
        }
 
@@ -615,7 +615,7 @@ static /*@only@*/struct passwd * check_perms (void)
                        (void) fprintf (stderr,
                                        _("No passwd entry for user '%s'\n"),
                                        name);
-                       SYSLOG ((LOG_ERR,
+                       SYSLOG ((LOG_NOTICE,
                                 "No passwd entry for user '%s'", name));
                        su_failure (caller_tty, true);
                }