[Pkg-shadow-commits] r2246 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Thu Aug 7 08:02:35 UTC 2008
Author: nekral-guest
Date: 2008-08-07 08:02:34 +0000 (Thu, 07 Aug 2008)
New Revision: 2246
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/pwconv.c
Log:
* src/pwconv.c: Report failure to unlock the passwd or shadow file
to stderr and syslog.
* src/pwconv.c: Report failure to chmod the backup file.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-08-07 08:02:13 UTC (rev 2245)
+++ upstream/trunk/ChangeLog 2008-08-07 08:02:34 UTC (rev 2246)
@@ -1,5 +1,11 @@
2008-08-06 Nicolas François <nicolas.francois at centraliens.net>
+ * src/pwconv.c: Report failure to unlock the passwd or shadow file
+ to stderr and syslog.
+ * src/pwconv.c: Report failure to chmod the backup file.
+
+2008-08-06 Nicolas François <nicolas.francois at centraliens.net>
+
* src/grpunconv.c: Report failure to unlock the group or gshadow
files to stderr and syslog.
Modified: upstream/trunk/src/pwconv.c
===================================================================
--- upstream/trunk/src/pwconv.c 2008-08-07 08:02:13 UTC (rev 2245)
+++ upstream/trunk/src/pwconv.c 2008-08-07 08:02:34 UTC (rev 2246)
@@ -87,16 +87,26 @@
static bool passwd_locked = false;
/* local function prototypes */
-static void fail_exit (int);
+static void fail_exit (int status);
static void fail_exit (int status)
{
+ if (passwd_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 ()));
+ /* continue */
+ }
+ }
+
if (shadow_locked) {
- spw_unlock ();
+ if (spw_unlock () == 0) {
+ fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
+ SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+ /* continue */
+ }
}
- if (passwd_locked) {
- pw_unlock ();
- }
+
exit (status);
}
@@ -207,18 +217,42 @@
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 (E_FAILURE);
}
if (pw_close () == 0) {
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 (E_FAILURE);
}
- chmod (PASSWD_FILE "-", 0600); /* /etc/passwd- (backup file) */
- spw_unlock ();
- pw_unlock ();
+ /* /etc/passwd- (backup file) */
+ if (chmod (PASSWD_FILE "-", 0600) != 0) {
+ fprintf (stderr,
+ _("%s: failed to change the mode of %s to 0600\n"),
+ Prog, PASSWD_FILE "-");
+ SYSLOG ((LOG_ERR, "failed to change the mode of %s to 0600", PASSWD_FILE "-"));
+ /* continue */
+ }
+
+ if (passwd_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 ()));
+ /* continue */
+ }
+ }
+
+ if (shadow_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 ()));
+ /* continue */
+ }
+ }
+
nscd_flush_cache ("passwd");
exit (E_SUCCESS);
More information about the Pkg-shadow-commits
mailing list