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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Mar 18 09:46:16 UTC 2010


Author: nekral-guest
Date: 2010-03-18 09:46:15 +0000 (Thu, 18 Mar 2010)
New Revision: 3144

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/pwck.c
Log:
	* src/pwck.c: Do not use pwd_file and spw_file. Always use the
	dbname() functions.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2010-03-18 09:33:55 UTC (rev 3143)
+++ upstream/trunk/ChangeLog	2010-03-18 09:46:15 UTC (rev 3144)
@@ -1,5 +1,10 @@
 2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/pwck.c: Do not use pwd_file and spw_file. Always use the
+	dbname() functions.
+
+2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/pwck.c: Re-indent.
 
 2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c	2010-03-18 09:33:55 UTC (rev 3143)
+++ upstream/trunk/src/pwck.c	2010-03-18 09:46:15 UTC (rev 3144)
@@ -68,9 +68,7 @@
  */
 char *Prog;
 
-static const char *pwd_file = PASSWD_FILE;
 static bool use_system_pw_file = true;
-static const char *spw_file = SHADOW_FILE;
 static bool use_system_spw_file = true;
 
 static bool is_shadow = false;
@@ -176,13 +174,11 @@
 	 * and shadow password filenames.
 	 */
 	if (optind != argc) {
-		pwd_file = argv[optind];
-		pw_setdbname (pwd_file);
+		pw_setdbname (argv[optind]);
 		use_system_pw_file = false;
 	}
 	if ((optind + 2) == argc) {
-		spw_file = argv[optind + 1];
-		spw_setdbname (spw_file);
+		spw_setdbname (argv[optind + 1]);
 		is_shadow = true;
 		use_system_spw_file = false;
 	} else if (optind == argc) {
@@ -210,7 +206,7 @@
 		if (pw_lock () == 0) {
 			fprintf (stderr,
 			         _("%s: cannot lock %s; try again later.\n"),
-			         Prog, pwd_file);
+			         Prog, pw_dbname ());
 			fail_exit (E_CANTLOCK);
 		}
 		pw_locked = true;
@@ -231,9 +227,9 @@
 	 */
 	if (pw_open (read_only ? O_RDONLY : O_RDWR) == 0) {
 		fprintf (stderr, _("%s: cannot open %s\n"),
-		         Prog, pwd_file);
+		         Prog, pw_dbname ());
 		if (use_system_pw_file) {
-			SYSLOG ((LOG_WARN, "cannot open %s", pwd_file));
+			SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
 		}
 		fail_exit (E_CANTOPEN);
 	}
@@ -269,10 +265,10 @@
 		if (pw_opened && pw_close () == 0) {
 			fprintf (stderr,
 			         _("%s: failure while writing changes to %s\n"),
-			         Prog, pwd_file);
+			         Prog, pw_dbname ());
 			SYSLOG ((LOG_ERR,
 			         "failure while writing changes to %s",
-			         pwd_file));
+			         pw_dbname ()));
 			fail_exit (E_CANTUPDATE);
 		}
 		pw_opened = false;
@@ -571,7 +567,7 @@
 				 */
 				if (strcmp (pwd->pw_passwd, SHADOW_PASSWD_STRING) != 0) {
 					printf (_("user %s has an entry in %s, but its password field in %s is not set to 'x'\n"),
-					        pwd->pw_name, spw_dbname (), pwd_file);
+					        pwd->pw_name, spw_dbname (), pw_dbname ());
 					*errors += 1;
 				}
 			}
@@ -722,7 +718,7 @@
 			 * /etc/passwd entry and ask them to delete it.
 			 */
 			printf (_("no matching password file entry in %s\n"),
-			        pwd_file);
+			        pw_dbname ());
 			printf (_("delete line '%s'? "), spe->line);
 			*errors += 1;
 




More information about the Pkg-shadow-commits mailing list