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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun Sep 18 17:32:04 UTC 2011


Author: nekral-guest
Date: 2011-09-18 17:32:04 +0000 (Sun, 18 Sep 2011)
New Revision: 3483

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/pwconv.c
Log:
	* src/pwconv.c: Fail if not called correctly.
	* src/pwconv.c: At the end of main, the passwd and shadow files
	are locked. No need to check before unlocking.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-09-18 17:29:52 UTC (rev 3482)
+++ upstream/trunk/ChangeLog	2011-09-18 17:32:04 UTC (rev 3483)
@@ -1,5 +1,11 @@
 2011-09-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/pwconv.c: Fail if not called correctly.
+	* src/pwconv.c: At the end of main, the passwd and shadow files
+	are locked. No need to check before unlocking.
+
+2011-09-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/newusers.c: Initially set the passwd's password to '*'
 	instead of 'x'. Only when it is confirmed that a shadow entry is
 	(will be) added, set the passwd's password to 'x'.

Modified: upstream/trunk/src/pwconv.c
===================================================================
--- upstream/trunk/src/pwconv.c	2011-09-18 17:29:52 UTC (rev 3482)
+++ upstream/trunk/src/pwconv.c	2011-09-18 17:32:04 UTC (rev 3483)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1996 - 2000, Marek Michałkiewicz
  * Copyright (c) 2002 - 2006, Tomasz Kłoczko
- * Copyright (c) 2009       , Nicolas François
+ * Copyright (c) 2009 - 2011, Nicolas François
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -124,6 +124,7 @@
 
 	if (1 != argc) {
 		(void) fputs (_("Usage: pwconv\n"), stderr);
+		fail_exit (E_USAGE);
 	}
 	Prog = Basename (argv[0]);
 
@@ -260,20 +261,16 @@
 		/* continue */
 	}
 
-	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 ()));
-			/* continue */
-		}
+	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 (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 ()));
-			/* continue */
-		}
+	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");




More information about the Pkg-shadow-commits mailing list