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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun Nov 6 18:38:57 UTC 2011


Author: nekral-guest
Date: 2011-11-06 18:38:57 +0000 (Sun, 06 Nov 2011)
New Revision: 3550

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/man/chage.1.xml
   upstream/trunk/src/chage.c
Log:
	* NEWS, src/chage.c, man/chage.1.xml: Add --root option. Open
	audit and syslog after the potential chroot. chage's usage split
	in smaller messages.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-11-06 18:38:51 UTC (rev 3549)
+++ upstream/trunk/ChangeLog	2011-11-06 18:38:57 UTC (rev 3550)
@@ -1,5 +1,11 @@
 2011-10-30  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* NEWS, src/chage.c, man/chage.1.xml: Add --root option. Open
+	audit and syslog after the potential chroot. chage's usage split
+	in smaller messages.
+
+2011-10-30  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/login.c: re-indent.
 	* src/login.c: Fix support for sub-logins.
 

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2011-11-06 18:38:51 UTC (rev 3549)
+++ upstream/trunk/NEWS	2011-11-06 18:38:57 UTC (rev 3550)
@@ -16,12 +16,14 @@
     configure options.
   * Added diagnosis for lock failures.
 
--chgpasswd
+- chage
+  * Add --root option.
+- chgpasswd
   * When the gshadow file exists but there are no gshadow entries, an entry
     is created if the password is changed and group requires a
     shadow entry.
   * Add --root option.
--chpasswd
+- chpasswd
   * PAM enabled versions: restore the -e option to allow restoring
     passwords without knowing those passwords. Restore together the -m
     and -c options. (These options were removed in shadow-4.1.4 on PAM

Modified: upstream/trunk/man/chage.1.xml
===================================================================
--- upstream/trunk/man/chage.1.xml	2011-11-06 18:38:51 UTC (rev 3549)
+++ upstream/trunk/man/chage.1.xml	2011-11-06 18:38:57 UTC (rev 3550)
@@ -176,6 +176,19 @@
       </varlistentry>
       <varlistentry>
 	<term>
+	  <option>-R</option>, <option>--root</option>
+	  <replaceable>CHROOT_DIR</replaceable>
+	</term>
+	<listitem>
+	  <para>
+	    Apply changes in the <replaceable>CHROOT_DIR</replaceable>
+	    directory and use the configuration files from the
+	    <replaceable>CHROOT_DIR</replaceable> directory.
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term>
 	  <option>-W</option>, <option>--warndays</option> <replaceable>WARN_DAYS</replaceable>
 	</term>
 	<listitem>

Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c	2011-11-06 18:38:51 UTC (rev 3549)
+++ upstream/trunk/src/chage.c	2011-11-06 18:38:57 UTC (rev 3550)
@@ -140,22 +140,25 @@
  */
 static /*@noreturn@*/void usage (int status)
 {
-	(void)
-	fputs (_("Usage: chage [options] LOGIN\n"
-	         "\n"
-	         "Options:\n"
-	         "  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY\n"
-	         "  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE\n"
-	         "  -h, --help                    display this help message and exit\n"
-	         "  -I, --inactive INACTIVE       set password inactive after expiration\n"
-	         "                                to INACTIVE\n"
-	         "  -l, --list                    show account aging information\n"
-	         "  -m, --mindays MIN_DAYS        set minimum number of days before password\n"
-	         "                                change to MIN_DAYS\n"
-	         "  -M, --maxdays MAX_DAYS        set maximim number of days before password\n"
-	         "                                change to MAX_DAYS\n"
-	         "  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS\n"
-	         "\n"), (E_SUCCESS != status) ? stderr : stdout);
+	FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
+	(void) fprintf (usageout,
+	                _("Usage: %s [options] LOGIN\n"
+	                  "\n"
+	                  "Options:\n"),
+	                Prog);
+	(void) fputs (_("  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY\n"), usageout);
+	(void) fputs (_("  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE\n"), usageout);
+	(void) fputs (_("  -h, --help                    display this help message and exit\n"), usageout);
+	(void) fputs (_("  -I, --inactive INACTIVE       set password inactive after expiration\n"
+	                "                                to INACTIVE\n"), usageout);
+	(void) fputs (_("  -l, --list                    show account aging information\n"), usageout);
+	(void) fputs (_("  -m, --mindays MIN_DAYS        set minimum number of days before password\n"
+	                "                                change to MIN_DAYS\n"), usageout);
+	(void) fputs (_("  -M, --maxdays MAX_DAYS        set maximim number of days before password\n"
+	                "                                change to MAX_DAYS\n"), usageout);
+	(void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
+	(void) fputs (_("  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS\n"), usageout);
+	(void) fputs ("\n", usageout);
 	exit (status);
 }
 
@@ -390,11 +393,12 @@
 		{"list", no_argument, NULL, 'l'},
 		{"mindays", required_argument, NULL, 'm'},
 		{"maxdays", required_argument, NULL, 'M'},
+		{"root", required_argument, NULL, 'R'},
 		{"warndays", required_argument, NULL, 'W'},
 		{NULL, 0, NULL, '\0'}
 	};
 
-	while ((c = getopt_long (argc, argv, "d:E:hI:lm:M:W:",
+	while ((c = getopt_long (argc, argv, "d:E:hI:lm:M:R:W:",
 	                         long_options, NULL)) != -1) {
 		switch (c) {
 		case 'd':
@@ -453,6 +457,8 @@
 				usage (E_USAGE);
 			}
 			break;
+		case 'R': /* no-op, handled in process_root_flag () */
+			break;
 		case 'W':
 			Wflg = true;
 			if (   (getlong (optarg, &warndays) == 0)
@@ -788,14 +794,23 @@
 	gid_t rgid;
 	const struct passwd *pw;
 
-#ifdef WITH_AUDIT
-	audit_help_open ();
-#endif
+	/*
+	 * Get the program name so that error messages can use it.
+	 */
+	Prog = Basename (argv[0]);
+
 	sanitize_env ();
 	(void) setlocale (LC_ALL, "");
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	process_root_flag ("-R", argc, argv);
+
+#ifdef WITH_AUDIT
+	audit_help_open ();
+#endif
+	OPENLOG ("chage");
+
 	ruid = getuid ();
 	rgid = getgid ();
 	amroot = (ruid == 0);
@@ -805,15 +820,8 @@
 	}
 #endif
 
-	/*
-	 * Get the program name so that error messages can use it.
-	 */
-	Prog = Basename (argv[0]);
-
 	process_flags (argc, argv);
 
-	OPENLOG ("chage");
-
 	check_perms ();
 
 	if (!spw_file_present ()) {




More information about the Pkg-shadow-commits mailing list