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

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


Author: nekral-guest
Date: 2011-11-06 18:39:24 +0000 (Sun, 06 Nov 2011)
New Revision: 3554

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/man/chfn.1.xml
   upstream/trunk/src/chfn.c
Log:
	* NEWS, src/chfn.c, man/chfn.1.xml: Add --root option.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-11-06 18:39:19 UTC (rev 3553)
+++ upstream/trunk/ChangeLog	2011-11-06 18:39:24 UTC (rev 3554)
@@ -2,6 +2,7 @@
 
 	* src/chfn.c, man/chfn.1.xml: Add support for long options.
 	* src/chfn.c, man/chfn.1.xml: Add -u/--help option
+	* NEWS, src/chfn.c, man/chfn.1.xml: Add --root option.
 
 2011-10-30  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2011-11-06 18:39:19 UTC (rev 3553)
+++ upstream/trunk/NEWS	2011-11-06 18:39:24 UTC (rev 3554)
@@ -18,6 +18,8 @@
 
 - chage
   * Add --root option.
+- chfn
+  * 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

Modified: upstream/trunk/man/chfn.1.xml
===================================================================
--- upstream/trunk/man/chfn.1.xml	2011-11-06 18:39:19 UTC (rev 3553)
+++ upstream/trunk/man/chfn.1.xml	2011-11-06 18:39:24 UTC (rev 3554)
@@ -132,6 +132,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>-u</option>, <option>--help</option>
 	</term>
 	<listitem>

Modified: upstream/trunk/src/chfn.c
===================================================================
--- upstream/trunk/src/chfn.c	2011-11-06 18:39:19 UTC (rev 3553)
+++ upstream/trunk/src/chfn.c	2011-11-06 18:39:24 UTC (rev 3554)
@@ -123,6 +123,7 @@
 	(void) fputs (_("  -h, --home-phone HOME_PHONE   change user's home phone number\n"), usageout);
 	(void) fputs (_("  -o, --other OTHER_INFO        change user's other GECOS information\n"), usageout);
 	(void) fputs (_("  -r, --room ROOM_NUMBER        change user's room number\n"), usageout);
+	(void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
 	(void) fputs (_("  -u, --help                    display this help message and exit\n"), usageout);
 	(void) fputs (_("  -w, --work-phone WORK_PHONE   change user's office phone number\n"), usageout);
 	(void) fputs ("\n", usageout);
@@ -272,6 +273,7 @@
 		{"home-phone", required_argument, NULL, 'h'},
 		{"other",      required_argument, NULL, 'o'},
 		{"room",       required_argument, NULL, 'r'},
+		{"root",       required_argument, NULL, 'R'},
 		{"help",       no_argument,       NULL, 'u'},
 		{"work-phone", required_argument, NULL, 'w'},
 		{NULL, 0, NULL, '\0'}
@@ -284,7 +286,7 @@
 	 * environment and must agree with the real UID. Also, the UID will
 	 * be checked for any commands which are restricted to root only.
 	 */
-	while ((c = getopt_long (argc, argv, "f:h:o:r:uw:",
+	while ((c = getopt_long (argc, argv, "f:h:o:r:R:uw:",
 	                         long_options, NULL)) != -1) {
 		switch (c) {
 		case 'f':
@@ -323,6 +325,8 @@
 			rflg = true;
 			STRFCPY (roomno, optarg);
 			break;
+		case 'R': /* no-op, handled in process_root_flag () */
+			break;
 		case 'u':
 			usage (E_SUCCESS);
 			/*@notreached@*/break;
@@ -626,23 +630,25 @@
 	char new_gecos[BUFSIZ];	/* buffer for new GECOS fields       */
 	char *user;
 
+	/*
+	 * Get the program name. The program name is used as a
+	 * prefix to most error messages.
+	 */
+	Prog = Basename (argv[0]);
+
 	sanitize_env ();
 	(void) setlocale (LC_ALL, "");
 	(void) bindtextdomain (PACKAGE, LOCALEDIR);
 	(void) textdomain (PACKAGE);
 
+	process_root_flag ("-R", argc, argv);
+
 	/*
 	 * This command behaves different for root and non-root
 	 * users.
 	 */
 	amroot = (getuid () == 0);
 
-	/*
-	 * Get the program name. The program name is used as a
-	 * prefix to most error messages.
-	 */
-	Prog = Basename (argv[0]);
-
 	OPENLOG ("chfn");
 
 	/* parse the command line options */




More information about the Pkg-shadow-commits mailing list