[Pkg-shadow-commits] r3147 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Mar 18 10:35:11 UTC 2010


Author: nekral-guest
Date: 2010-03-18 10:35:11 +0000 (Thu, 18 Mar 2010)
New Revision: 3147

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/pwck.c
Log:
	* src/pwck.c: Only log to SYSLOG when acting on system files.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2010-03-18 10:25:08 UTC (rev 3146)
+++ upstream/trunk/ChangeLog	2010-03-18 10:35:11 UTC (rev 3147)
@@ -1,5 +1,9 @@
 2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/pwck.c: Only log to SYSLOG when acting on system files.
+
+2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/pwck.c: Document the sections closed by #endif
 	* src/pwck.c, man/pwck.8.xml: No alternative shadow file can be
 	given when USE_TCB is enabled.

Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c	2010-03-18 10:25:08 UTC (rev 3146)
+++ upstream/trunk/src/pwck.c	2010-03-18 10:35:11 UTC (rev 3147)
@@ -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 @@
 	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 @@
 	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 @@
 			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 @@
 			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 @@
 	 */
 	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 @@
 			 * 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 @@
 						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 @@
 				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 @@
 				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 @@
 			 * 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);




More information about the Pkg-shadow-commits mailing list