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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Aug 22 02:30:34 UTC 2008


Author: nekral-guest
Date: 2008-08-22 02:30:33 +0000 (Fri, 22 Aug 2008)
New Revision: 2282

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/chage.c
   upstream/trunk/src/chfn.c
   upstream/trunk/src/chsh.c
   upstream/trunk/src/gpasswd.c
   upstream/trunk/src/groupadd.c
   upstream/trunk/src/groupdel.c
   upstream/trunk/src/groupmod.c
   upstream/trunk/src/grpconv.c
   upstream/trunk/src/grpunconv.c
   upstream/trunk/src/passwd.c
   upstream/trunk/src/pwck.c
   upstream/trunk/src/pwconv.c
   upstream/trunk/src/pwunconv.c
   upstream/trunk/src/useradd.c
   upstream/trunk/src/usermod.c
   upstream/trunk/src/vipw.c
Log:
	* src/chfn.c: Do not exit on pw_unlock failures.
	* src/grpconv.c, src/grpunconv.c, src/pwconv.c, src/pwunconv.c,
	src/vipw.c: Open syslog with the right identification name.
	* src/vipw.c: Log unlock errors to syslog.
	* src/vipw.c: Log edits to syslog.
	* src/chage.c, src/chfn.c, src/chsh.c, src/gpasswd.c,
	src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpconv.c,
	src/grpunconv.c, src/passwd.c, src/pwck.c, src/pwunconv.c,
	src/useradd.c, src/usermod.c: Harmonize the syslog levels. Failure
	to close or unlock are errors. Failure to open files are warnings.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/ChangeLog	2008-08-22 02:30:33 UTC (rev 2282)
@@ -1,5 +1,18 @@
 2008-08-20  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/chfn.c: Do not exit on pw_unlock failures.
+	* src/grpconv.c, src/grpunconv.c, src/pwconv.c, src/pwunconv.c,
+	src/vipw.c: Open syslog with the right identification name.
+	* src/vipw.c: Log unlock errors to syslog.
+	* src/vipw.c: Log edits to syslog.
+	* src/chage.c, src/chfn.c, src/chsh.c, src/gpasswd.c,
+	src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpconv.c,
+	src/grpunconv.c, src/passwd.c, src/pwck.c, src/pwunconv.c,
+	src/useradd.c, src/usermod.c: Harmonize the syslog levels. Failure
+	to close or unlock are errors. Failure to open files are warnings.
+
+2008-08-20  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/newusers.c: Open syslog with the right identification name.
 	* src/newusers.c: Mark the files as locked only if they are really
 	locked (i.e. if shadow is not enabled, the files are not locked).

Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/chage.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -572,7 +572,7 @@
 	}
 	if (pw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
 		fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
 		fail_exit (E_NOPERM);
 	}
 
@@ -594,7 +594,7 @@
 	if (spw_open (readonly ? O_RDONLY: O_RDWR) == 0) {
 		fprintf (stderr,
 		         _("%s: cannot open %s\n"), Prog, spw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot open %s", spw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ()));
 		fail_exit (E_NOPERM);
 	}
 }
@@ -664,7 +664,7 @@
 		if (pw_update (&pwent) == 0) {
 			fprintf (stderr,
 			         _("%s: cannot update %s\n"), Prog, pw_dbname ());
-			SYSLOG ((LOG_ERR, "cannot update %s", pw_dbname ()));
+			SYSLOG ((LOG_WARN, "cannot update %s", pw_dbname ()));
 			fail_exit (E_NOPERM);
 		}
 	} else {
@@ -688,7 +688,7 @@
 	if (spw_update (&spwent) == 0) {
 		fprintf (stderr,
 		         _("%s: cannot update %s\n"), Prog, spw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot update %s", spw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot update %s", spw_dbname ()));
 		fail_exit (E_NOPERM);
 	}
 
@@ -808,7 +808,7 @@
 		fprintf (stderr,
 		         _("%s: the shadow password file is not present\n"),
 		         Prog);
-		SYSLOG ((LOG_ERR, "can't find the shadow password file"));
+		SYSLOG ((LOG_WARN, "can't find the shadow password file"));
 		closelog ();
 		exit (E_SHADOW_NOTFOUND);
 	}

Modified: upstream/trunk/src/chfn.c
===================================================================
--- upstream/trunk/src/chfn.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/chfn.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -487,12 +487,12 @@
 		SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
 		fail_exit (E_NOPERM);
 	}
-	pw_locked = false; /* If we fail to unlock, do not retry */
 	if (pw_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
 		SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
-		fail_exit (E_NOPERM);
+		/* continue */
 	}
+	pw_locked = false;
 }
 
 /*

Modified: upstream/trunk/src/chsh.c
===================================================================
--- upstream/trunk/src/chsh.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/chsh.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -370,7 +370,7 @@
 	pw_locked = true;
 	if (pw_open (O_RDWR) == 0) {
 		fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
 		fail_exit (1);
 	}
 
@@ -400,7 +400,7 @@
 	 * that entry as well.
 	 */
 	if (pw_update (&pwent) == 0) {
-		SYSLOG ((LOG_ERR, "error updating passwd entry"));
+		SYSLOG ((LOG_WARN, "error updating passwd entry"));
 		fputs (_("Error updating the password entry.\n"), stderr);
 		fail_exit (1);
 	}

Modified: upstream/trunk/src/gpasswd.c
===================================================================
--- upstream/trunk/src/gpasswd.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/gpasswd.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -164,7 +164,7 @@
 	if (gr_locked) {
 		if (gr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking group file",
@@ -176,7 +176,7 @@
 	if (sgr_locked) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -441,7 +441,7 @@
 {
 	if (gr_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "rewriting /etc/group",
@@ -453,7 +453,7 @@
 	if (is_shadowgrp) {
 		if (sgr_close () == 0) {
 			fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "rewriting /etc/gshadow",
@@ -463,7 +463,7 @@
 		}
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -476,7 +476,7 @@
 #endif
 	if (gr_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking group file",
@@ -649,7 +649,7 @@
 
 	if (gr_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "closing /etc/group",
@@ -701,7 +701,7 @@
 		if (sgr_close () == 0) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "closing /etc/gshadow",

Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/groupadd.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -253,12 +253,12 @@
 {
 	if (gr_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 		fail_exit (E_GRP_UPDATE);
 	}
 	if (gr_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking group file",
@@ -272,12 +272,12 @@
 		if (sgr_close () == 0) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -356,7 +356,7 @@
 	if (gr_locked) {
 		if (gr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking group file",
@@ -369,7 +369,7 @@
 	if (sgr_locked) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",

Modified: upstream/trunk/src/groupdel.c
===================================================================
--- upstream/trunk/src/groupdel.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/groupdel.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -97,7 +97,7 @@
 	if (gr_locked) {
 		if (gr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking group file",
@@ -110,7 +110,7 @@
 	if (sgr_locked) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -176,12 +176,12 @@
 
 	if (gr_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 		fail_exit (E_GRP_UPDATE);
 	}
 	if (gr_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking group file",
@@ -195,12 +195,12 @@
 		if (sgr_close () == 0)) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",

Modified: upstream/trunk/src/groupmod.c
===================================================================
--- upstream/trunk/src/groupmod.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/groupmod.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -126,7 +126,7 @@
 	if (gr_locked) {
 		if (gr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking group file",
@@ -139,7 +139,7 @@
 	if (sgr_locked) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -152,7 +152,7 @@
 	if (pw_locked) {
 		if (pw_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking passwd file",
@@ -322,7 +322,7 @@
 #endif
 	if (nflg) {
 		SYSLOG ((LOG_INFO, "change group '%s' to '%s'",
-			 group_name, group_newname));
+		         group_name, group_newname));
 	}
 
 	if (gflg) {
@@ -507,7 +507,7 @@
 {
 	if (gr_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "rewrite group file",
@@ -517,7 +517,7 @@
 	}
 	if (gr_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking group file",
@@ -531,7 +531,7 @@
 		if (sgr_close () == 0)) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "rewrite gshadow file",
@@ -541,7 +541,7 @@
 		}
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -556,7 +556,7 @@
 		if (pw_close () == 0) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", pw_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "rewrite passwd file",
@@ -566,7 +566,7 @@
 		}
 		if (pw_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking passwd file",

Modified: upstream/trunk/src/grpconv.c
===================================================================
--- upstream/trunk/src/grpconv.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/grpconv.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -92,6 +92,8 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	OPENLOG ("grpconv");
+
 	if (gr_lock () == 0) {
 		fprintf (stderr,
 		         _("%s: cannot lock %s; try again later.\n"),
@@ -188,12 +190,14 @@
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, sgr_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 		fail_exit (3);
 	}
 	if (gr_close () == 0) {
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, gr_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 		fail_exit (3);
 	}
 	if (sgr_unlock () == 0) {

Modified: upstream/trunk/src/grpunconv.c
===================================================================
--- upstream/trunk/src/grpunconv.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/grpunconv.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -92,6 +92,8 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	OPENLOG ("grpunconv");
+
 	if (sgr_file_present () == 0) {
 		exit (0);	/* no /etc/gshadow, nothing to do */
 	}
@@ -147,6 +149,7 @@
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, sgr_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 		fail_exit (3);
 	}
 
@@ -154,6 +157,7 @@
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, gr_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 		fail_exit (3);
 	}
 
@@ -161,6 +165,7 @@
 		fprintf (stderr,
 		         _("%s: cannot delete %s\n"),
 		         Prog, SGROUP_FILE);
+		SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
 		fail_exit (3);
 	}
 

Modified: upstream/trunk/src/passwd.c
===================================================================
--- upstream/trunk/src/passwd.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/passwd.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -539,7 +539,7 @@
 		fprintf (stderr,
 		         _("%s: cannot open %s\n"),
 		         Prog, pw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot open %s", pw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
 		fail_exit (E_MISSING);
 	}
 	pw = pw_locate (name);
@@ -556,7 +556,7 @@
 	npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
 	if (pw_update (npw) == 0) {
 		fputs (_("Error updating the password entry.\n"), stderr);
-		SYSLOG ((LOG_ERR, "error updating password entry"));
+		SYSLOG ((LOG_WARN, "error updating password entry"));
 		fail_exit (E_FAILURE);
 	}
 	if (pw_close () == 0) {
@@ -588,7 +588,7 @@
 	spw_locked = true;
 	if (spw_open (O_RDWR) == 0) {
 		fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ());
-		SYSLOG ((LOG_ERR, "cannot open %s", spw_dbname ()));
+		SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ()));
 		fail_exit (E_FAILURE);
 	}
 	sp = spw_locate (name);
@@ -635,7 +635,7 @@
 
 	if (spw_update (nsp) == 0) {
 		fputs (_("Error updating the password entry.\n"), stderr);
-		SYSLOG ((LOG_ERR, "error updating password entry"));
+		SYSLOG ((LOG_WARN, "error updating password entry"));
 		fail_exit (E_FAILURE);
 	}
 	if (spw_close () == 0) {

Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/pwck.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -253,13 +253,13 @@
 		if (pw_close () == 0) {
 			fprintf (stderr, _("%s: failure while writing changes to %s\n"),
 			         Prog, pwd_file);
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", pwd_file));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", pwd_file));
 			fail_exit (E_CANTUPDATE);
 		}
 		if (is_shadow && (spw_close () == 0)) {
 			fprintf (stderr, _("%s: failure while writing changes to %s\n"),
 			         Prog, spw_file);
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", spw_file));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_file));
 			fail_exit (E_CANTUPDATE);
 		}
 	}

Modified: upstream/trunk/src/pwconv.c
===================================================================
--- upstream/trunk/src/pwconv.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/pwconv.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -125,6 +125,8 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	OPENLOG ("pwconv");
+
 	if (pw_lock () == 0) {
 		fprintf (stderr,
 		         _("%s: cannot lock %s; try again later.\n"),

Modified: upstream/trunk/src/pwunconv.c
===================================================================
--- upstream/trunk/src/pwunconv.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/pwunconv.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -86,6 +86,8 @@
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	OPENLOG ("pwunconv");
+
 	if (!spw_file_present ()) {
 		/* shadow not installed, do nothing */
 		exit (0);
@@ -157,6 +159,7 @@
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, spw_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
 		fail_exit (3);
 	}
 
@@ -164,12 +167,14 @@
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"),
 		         Prog, pw_dbname ());
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
 		fail_exit (3);
 	}
 
 	if (unlink (SHADOW) != 0) {
 		fprintf (stderr,
 			 _("%s: cannot delete %s\n"), Prog, SHADOW);
+		SYSLOG ((LOG_ERR, "cannot delete %s", SHADOW));
 		fail_exit (3);
 	}
 

Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/useradd.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -201,7 +201,7 @@
 	if (spw_locked) {
 		if (spw_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", spw_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking shadow file",
@@ -213,7 +213,7 @@
 	if (pw_locked) {
 		if (pw_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking passwd file",
@@ -225,7 +225,7 @@
 	if (gr_locked) {
 		if (gr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking group file",
@@ -238,7 +238,7 @@
 	if (sgr_locked) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",
@@ -1241,20 +1241,20 @@
 {
 	if (pw_close () == 0) {
 		fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", pw_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
 		fail_exit (E_PW_UPDATE);
 	}
 	if (is_shadow_pwd && (spw_close () == 0)) {
 		fprintf (stderr,
 		         _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ());
-		SYSLOG ((LOG_WARN, "failure while writing changes to %s", spw_dbname ()));
+		SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
 		fail_exit (E_PW_UPDATE);
 	}
 	if (do_grp_update) {
 		if (gr_close () == 0) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", gr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}
 #ifdef	SHADOWGRP
@@ -1262,7 +1262,7 @@
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"),
 			         Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failure while writing changes to %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}
 #endif
@@ -1270,7 +1270,7 @@
 	if (is_shadow_pwd) {
 		if (spw_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", spw_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking shadow file",
@@ -1282,7 +1282,7 @@
 	}
 	if (pw_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", pw_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking passwd file",
@@ -1293,7 +1293,7 @@
 	pw_locked = false;
 	if (gr_unlock () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
-		SYSLOG ((LOG_WARN, "failed to unlock %s", gr_dbname ()));
+		SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 		              "unlocking group file",
@@ -1306,7 +1306,7 @@
 	if (is_shadow_grp) {
 		if (sgr_unlock () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
-			SYSLOG ((LOG_WARN, "failed to unlock %s", sgr_dbname ()));
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
 			              "unlocking gshadow file",

Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/usermod.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -636,7 +636,7 @@
 			fprintf (stderr,
 			         _("%s: error adding new entry '%s' in %s\n"),
 			         Prog, ngrp->gr_name, gr_dbname ());
-			SYSLOG ((LOG_ERR, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
+			SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s", ngrp->gr_name, gr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}
 	}
@@ -755,7 +755,7 @@
 			fprintf (stderr,
 			         _("%s: error adding new entry '%s' in '%s\n"),
 			         Prog, nsgrp->sg_name, sgr_dbname ());
-			SYSLOG ((LOG_ERR, "error adding new entry '%s' in %s",
+			SYSLOG ((LOG_WARN, "error adding new entry '%s' in %s",
 			        nsgrp->sg_name, sgr_dbname ()));
 			fail_exit (E_GRP_UPDATE);
 		}

Modified: upstream/trunk/src/vipw.c
===================================================================
--- upstream/trunk/src/vipw.c	2008-08-22 02:29:31 UTC (rev 2281)
+++ upstream/trunk/src/vipw.c	2008-08-22 02:30:33 UTC (rev 2282)
@@ -144,6 +144,7 @@
 	if (filelocked) {
 		if ((*unlock) () == 0) {
 			fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
+			SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
 			/* continue */
 		}
 	}
@@ -276,8 +277,10 @@
 
 	if ((*file_unlock) () == 0) {
 		fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname);
+		SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
 		/* continue */
 	}
+	SYSLOG ((LOG_INFO, "file %s edited", fileeditname));
 }
 
 int main (int argc, char **argv)
@@ -293,6 +296,8 @@
 	progname = ((a = strrchr (*argv, '/')) ? a + 1 : *argv);
 	do_vipw = (strcmp (progname, "vigr") != 0);
 
+	OPENLOG (do_vipw ? "vipw" : "vigr");
+
 	{
 		/*
 		 * Parse the command line options.




More information about the Pkg-shadow-commits mailing list