]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
* NEWS, src/chpasswd.c, man/chpasswd.8.xml, src/chgpasswd.c,
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:38:10 +0000 (18:38 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 6 Nov 2011 18:38:10 +0000 (18:38 +0000)
man/chgpasswd.8.xml: Add --root option.
* src/chpasswd.c, src/chgpasswd.c: The getopt index of long
options is not used.

ChangeLog
NEWS
man/chgpasswd.8.xml
man/chpasswd.8.xml
src/chgpasswd.c
src/chpasswd.c

index ddce933c4cce8029eee3d14446ee81444cb74ff4..c37b768086ae534a98c9381a0ed8a6a116d13632 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,7 +17,7 @@
        of main().
        * NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
        audit and syslog after the potential chroot.
-       * src/groupmod.c: The index of long options is not used.
+       * src/groupmod.c: The getopt index of long options is not used.
        * src/groupdel.c: Add process_flags().
        * src/groupdel.c, man/groupdel.8.xml: Add --help option.
        * NEWS, src/groupdel.c, man/groupdel.8.xml: Add --root option. Open
        Add --help option.
        * src/pwconv.c, src/pwunconv.c, src/grpconv.c, src/grpunconv.c:
        Add process_flags() and usage().
+       * NEWS, src/chpasswd.c, man/chpasswd.8.xml, src/chgpasswd.c,
+       man/chgpasswd.8.xml: Add --root option.
+       * src/chpasswd.c, src/chgpasswd.c: The getopt index of long
+       options is not used.
 
 2011-10-22  Nicolas François  <nicolas.francois@centraliens.net>
 
diff --git a/NEWS b/NEWS
index bd85597fcb1df53eae49aaff2d0c75a71edec9ec..f7b9eb20f926fedd4ada4c392b284ced8d3cf01d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ shadow-4.1.4.3 -> shadow-4.1.5                                        UNRELEASED
   * 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
   * PAM enabled versions: restore the -e option to allow restoring
     passwords without knowing those passwords. Restore together the -m
@@ -28,6 +29,7 @@ shadow-4.1.4.3 -> shadow-4.1.5                                        UNRELEASED
   * When the shadow file exists but there are no shadow entries, an entry
     is created if the password is changed and passwd requires a
     shadow entry.
+  * Add --root option.
 - faillog
   * The -l, -m, -r, -t options only act on the existing users, unless -a is
     specified.
index 18a0337b0ee0d4331abe2fe6dc4548760393e889..467ac801c648a4e0cca27ead39c694e513294926 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
    Copyright (c) 2006       , Tomasz Kłoczko
-   Copyright (c) 2007 - 2009, Nicolas François
+   Copyright (c) 2007 - 2011, Nicolas François
    All rights reserved.
   
    Redistribution and use in source and binary forms, with or without
          </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 condition="sha_crypt">
        <term><option>-s</option>, <option>--sha-rounds</option></term>
        <listitem>
index 32eae172b6afb49027ceee1c5f984d653bc2cb83..acaa488b0b41baf6ae9a3dfe92ebbbd344dd7c2c 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
    Copyright (c) 1991       , Julianne Frances Haugh
-   Copyright (c) 2007 - 2009, Nicolas François
+   Copyright (c) 2007 - 2011, Nicolas François
    All rights reserved.
   
    Redistribution and use in source and binary forms, with or without
          </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 condition="sha_crypt">
        <term>
          <option>-s</option>, <option>--sha-rounds</option>
index 2aadf46a5ef7984874e2e78cc81909991ac98f60..5c4ded6bef13192a70b295a2787d3042622e4dcf 100644 (file)
@@ -135,6 +135,7 @@ static /*@noreturn@*/void usage (int status)
        (void) fputs (_("  -m, --md5                     encrypt the clear text password using\n"
                        "                                the MD5 algorithm\n"),
                      usageout);
+       (void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
 #ifdef USE_SHA_CRYPT
        (void) fputs (_("  -s, --sha-rounds              number of SHA rounds for the SHA*\n"
                        "                                crypt algorithms\n"),
@@ -152,13 +153,13 @@ static /*@noreturn@*/void usage (int status)
  */
 static void process_flags (int argc, char **argv)
 {
-       int option_index = 0;
        int c;
        static struct option long_options[] = {
                {"crypt-method", required_argument, NULL, 'c'},
                {"encrypted", no_argument, NULL, 'e'},
                {"help", no_argument, NULL, 'h'},
                {"md5", no_argument, NULL, 'm'},
+               {"root", required_argument, NULL, 'R'},
 #ifdef USE_SHA_CRYPT
                {"sha-rounds", required_argument, NULL, 's'},
 #endif
@@ -167,11 +168,11 @@ static void process_flags (int argc, char **argv)
 
        while ((c = getopt_long (argc, argv,
 #ifdef USE_SHA_CRYPT
-                                "c:ehms:",
+                                "c:ehmR:s:",
 #else
-                                "c:ehm",
+                                "c:ehmR:",
 #endif
-                                long_options, &option_index)) != -1) {
+                                long_options, NULL)) != -1) {
                switch (c) {
                case 'c':
                        crypt_method = optarg;
@@ -185,6 +186,8 @@ static void process_flags (int argc, char **argv)
                case 'm':
                        md5flg = true;
                        break;
+               case 'R': /* no-op, handled in process_root_flag () */
+                       break;
 #ifdef USE_SHA_CRYPT
                case 's':
                        sflg = true;
@@ -396,6 +399,8 @@ int main (int argc, char **argv)
        (void) bindtextdomain (PACKAGE, LOCALEDIR);
        (void) textdomain (PACKAGE);
 
+       process_root_flag ("-R", argc, argv);
+
        process_flags (argc, argv);
 
        OPENLOG ("chgpasswd");
index b4515e615063ae0628bd55922874f076f4390d50..f945f5df4d95250bb343feebbe6fa54aafaf348d 100644 (file)
@@ -128,6 +128,7 @@ static /*@noreturn@*/void usage (int status)
        (void) fputs (_("  -m, --md5                     encrypt the clear text password using\n"
                        "                                the MD5 algorithm\n"),
                      usageout);
+       (void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
 #ifdef USE_SHA_CRYPT
        (void) fputs (_("  -s, --sha-rounds              number of SHA rounds for the SHA*\n"
                        "                                crypt algorithms\n"),
@@ -145,12 +146,12 @@ static /*@noreturn@*/void usage (int status)
  */
 static void process_flags (int argc, char **argv)
 {
-       int option_index = 0;
        int c;
        static struct option long_options[] = {
                {"crypt-method", required_argument, NULL, 'c'},
                {"encrypted", no_argument, NULL, 'e'},
                {"md5", no_argument, NULL, 'm'},
+               {"root", required_argument, NULL, 'R'},
 #ifdef USE_SHA_CRYPT
                {"sha-rounds", required_argument, NULL, 's'},
 #endif                         /* USE_SHA_CRYPT */
@@ -160,11 +161,11 @@ static void process_flags (int argc, char **argv)
 
        while ((c = getopt_long (argc, argv,
 #ifdef USE_SHA_CRYPT
-                                "c:ehms:",
+                                "c:ehmR:s:",
 #else                          /* !USE_SHA_CRYPT */
-                                "c:ehm",
+                                "c:ehmR:",
 #endif                         /* !USE_SHA_CRYPT */
-                                long_options, &option_index)) != -1) {
+                                long_options, NULL)) != -1) {
                switch (c) {
                case 'h':
                        usage (E_SUCCESS);
@@ -178,6 +179,8 @@ static void process_flags (int argc, char **argv)
                case 'm':
                        md5flg = true;
                        break;
+               case 'R': /* no-op, handled in process_root_flag () */
+                       break;
 #ifdef USE_SHA_CRYPT
                case 's':
                        sflg = true;
@@ -387,6 +390,8 @@ int main (int argc, char **argv)
        (void) bindtextdomain (PACKAGE, LOCALEDIR);
        (void) textdomain (PACKAGE);
 
+       process_root_flag ("-R", argc, argv);
+
        process_flags (argc, argv);
 
 #ifdef USE_PAM