]> granicus.if.org Git - shadow/commitdiff
* NEWS, src/chfn.c, man/chfn.1.xml: Add --root option.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:39:24 +0000 (18:39 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:39:24 +0000 (18:39 +0000)
ChangeLog
NEWS
man/chfn.1.xml
src/chfn.c

index 43eb13c2cbe1a9c1e6ccdc8d25808a75d574b6de..7cd4dd04262b18c5f813d865f5fa8298c7171b99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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@centraliens.net>
 
diff --git a/NEWS b/NEWS
index 5ddffa893e48952b0bc6f9fa85b14d41e45b1f32..fd0f1c9c0ae7f98e701e6111c0b194316f0651b4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ shadow-4.1.4.3 -> shadow-4.1.5                                        UNRELEASED
 
 - 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
index 0b56890090f2552abd970a985fb9f72d0a4b6071..3a3b1f74a9d7b33da5744d0220d08d50ebb69ed8 100644 (file)
          <para>Change the user's room number.</para>
        </listitem>
       </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>
index 70cb0f3908990a93219d46b7faecae41c2b5313f..40d6750b4d6accec704a66c84d729c69d7d1962d 100644 (file)
@@ -123,6 +123,7 @@ static /*@noreturn@*/void usage (int status)
        (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 @@ static void process_flags (int argc, char **argv)
                {"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 @@ static void process_flags (int argc, char **argv)
         * 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 @@ static void process_flags (int argc, char **argv)
                        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 @@ int main (int argc, char **argv)
        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 */