]> granicus.if.org Git - shadow/commitdiff
* src/pwck.c: Only log to SYSLOG when acting on system files.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 18 Mar 2010 10:35:11 +0000 (10:35 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 18 Mar 2010 10:35:11 +0000 (10:35 +0000)
ChangeLog
src/pwck.c

index 6a76fac37ea3b5daac3a4dc7c21c663ea31370e1..2e0df5284aa603764aa0c783326658fef2c6b9e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-18  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/pwck.c: Only log to SYSLOG when acting on system files.
+
 2010-03-18  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/pwck.c: Document the sections closed by #endif
index a8b16719bc117c694232fefb8372f4de94d041b5..dafa581911c947a3fa7aa245df2bd33a3796d00d 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2001       , Michał Moskal
  * Copyright (c) 2001 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2009, Nicolas François
+ * Copyright (c) 2007 - 2010, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -101,7 +101,10 @@ static void fail_exit (int code)
        if (spw_locked) {
                if (spw_unlock () == 0) {
                        fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+                       if (use_system_spw_file) {
+                               SYSLOG ((LOG_ERR, "failed to unlock %s",
+                                        spw_dbname ()));
+                       }
                        /* continue */
                }
        }
@@ -109,7 +112,10 @@ static void fail_exit (int code)
        if (pw_locked) {
                if (pw_unlock () == 0) {
                        fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
+                       if (use_system_pw_file) {
+                               SYSLOG ((LOG_ERR, "failed to unlock %s",
+                                        pw_dbname ()));
+                       }
                        /* continue */
                }
        }
@@ -283,9 +289,11 @@ static void close_files (bool changed)
                        fprintf (stderr,
                                 _("%s: failure while writing changes to %s\n"),
                                 Prog, pw_dbname ());
-                       SYSLOG ((LOG_ERR,
-                                "failure while writing changes to %s",
-                                pw_dbname ()));
+                       if (use_system_pw_file) {
+                               SYSLOG ((LOG_ERR,
+                                        "failure while writing changes to %s",
+                                        pw_dbname ()));
+                       }
                        fail_exit (E_CANTUPDATE);
                }
                pw_opened = false;
@@ -293,9 +301,11 @@ static void close_files (bool changed)
                        fprintf (stderr,
                                 _("%s: failure while writing changes to %s\n"),
                                 Prog, spw_dbname ());
-                       SYSLOG ((LOG_ERR,
-                                "failure while writing changes to %s",
-                                spw_dbname ()));
+                       if (use_system_spw_file) {
+                               SYSLOG ((LOG_ERR,
+                                        "failure while writing changes to %s",
+                                        spw_dbname ()));
+                       }
                        fail_exit (E_CANTUPDATE);
                }
                spw_opened = false;
@@ -306,16 +316,26 @@ static void close_files (bool changed)
         */
        if (spw_locked) {
                if (spw_unlock () == 0) {
-                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+                       fprintf (stderr,
+                                _("%s: failed to unlock %s\n"),
+                                Prog, spw_dbname ());
+                       if (use_system_spw_file) {
+                               SYSLOG ((LOG_ERR, "failed to unlock %s",
+                                        spw_dbname ()));
+                       }
                        /* continue */
                }
        }
        spw_locked = false;
        if (pw_locked) {
                if (pw_unlock () == 0) {
-                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-                       SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
+                       fprintf (stderr,
+                                _("%s: failed to unlock %s\n"),
+                                Prog, pw_dbname ());
+                       if (use_system_pw_file) {
+                               SYSLOG ((LOG_ERR, "failed to unlock %s",
+                                        pw_dbname ()));
+                       }
                        /* continue */
                }
        }
@@ -371,8 +391,10 @@ static void check_pw_file (int *errors, bool *changed)
                         * loop to try out the next list element.
                         */
                      delete_pw:
-                       SYSLOG ((LOG_INFO, "delete passwd line '%s'",
-                                pfe->line));
+                       if (use_system_pw_file) {
+                               SYSLOG ((LOG_INFO, "delete passwd line '%s'",
+                                        pfe->line));
+                       }
                        *changed = true;
 
                        __pw_del_entry (pfe);
@@ -522,9 +544,11 @@ static void check_pw_file (int *errors, bool *changed)
                                                fprintf (stderr,
                                                         _("%s: failed to unlock %s\n"),
                                                         Prog, spw_dbname ());
-                                               SYSLOG ((LOG_ERR,
-                                                        "failed to unlock %s",
-                                                        spw_dbname ()));
+                                               if (use_system_spw_file) {
+                                                       SYSLOG ((LOG_ERR,
+                                                                "failed to unlock %s",
+                                                                spw_dbname ()));
+                                               }
                                        }
                                        continue;
                                }
@@ -595,9 +619,11 @@ static void check_pw_file (int *errors, bool *changed)
                                fprintf (stderr,
                                         _("%s: failure while writing changes to %s\n"),
                                         Prog, spw_dbname ());
-                               SYSLOG ((LOG_ERR,
-                                        "failure while writing changes to %s",
-                                        spw_dbname ()));
+                               if (use_system_spw_file) {
+                                       SYSLOG ((LOG_ERR,
+                                                "failure while writing changes to %s",
+                                                spw_dbname ()));
+                               }
                        } else {
                                spw_opened = false;
                        }
@@ -605,9 +631,10 @@ static void check_pw_file (int *errors, bool *changed)
                                fprintf (stderr,
                                         _("%s: failed to unlock %s\n"),
                                         Prog, spw_dbname ());
-                               SYSLOG ((LOG_ERR,
-                                        "failed to unlock %s",
-                                        spw_dbname ()));
+                               if (use_system_spw_file) {
+                                       SYSLOG ((LOG_ERR, "failed to unlock %s",
+                                                spw_dbname ()));
+                               }
                        } else {
                                spw_locked = false;
                        }
@@ -672,8 +699,10 @@ static void check_spw_file (int *errors, bool *changed)
                         * to try out the next list element.
                         */
                      delete_spw:
-                       SYSLOG ((LOG_INFO, "delete shadow line '%s'",
-                                spe->line));
+                       if (use_system_spw_file) {
+                               SYSLOG ((LOG_INFO, "delete shadow line '%s'",
+                                        spe->line));
+                       }
                        *changed = true;
 
                        __spw_del_entry (spe);