* 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.
This commit is contained in:
nekral-guest 2011-11-06 18:38:10 +00:00
parent bf90350fe7
commit 799f30b08d
6 changed files with 53 additions and 11 deletions

View File

@ -17,7 +17,7 @@
of main(). of main().
* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open * NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
audit and syslog after the potential chroot. 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: Add process_flags().
* src/groupdel.c, man/groupdel.8.xml: Add --help option. * src/groupdel.c, man/groupdel.8.xml: Add --help option.
* NEWS, src/groupdel.c, man/groupdel.8.xml: Add --root option. Open * NEWS, src/groupdel.c, man/groupdel.8.xml: Add --root option. Open
@ -29,6 +29,10 @@
Add --help option. Add --help option.
* src/pwconv.c, src/pwunconv.c, src/grpconv.c, src/grpunconv.c: * src/pwconv.c, src/pwunconv.c, src/grpconv.c, src/grpunconv.c:
Add process_flags() and usage(). 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> 2011-10-22 Nicolas François <nicolas.francois@centraliens.net>

2
NEWS
View File

@ -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 * When the gshadow file exists but there are no gshadow entries, an entry
is created if the password is changed and group requires a is created if the password is changed and group requires a
shadow entry. shadow entry.
* Add --root option.
-chpasswd -chpasswd
* PAM enabled versions: restore the -e option to allow restoring * PAM enabled versions: restore the -e option to allow restoring
passwords without knowing those passwords. Restore together the -m 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 * When the shadow file exists but there are no shadow entries, an entry
is created if the password is changed and passwd requires a is created if the password is changed and passwd requires a
shadow entry. shadow entry.
* Add --root option.
- faillog - faillog
* The -l, -m, -r, -t options only act on the existing users, unless -a is * The -l, -m, -r, -t options only act on the existing users, unless -a is
specified. specified.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (c) 2006 , Tomasz Kłoczko Copyright (c) 2006 , Tomasz Kłoczko
Copyright (c) 2007 - 2009, Nicolas François Copyright (c) 2007 - 2011, Nicolas François
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -128,6 +128,19 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </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"> <varlistentry condition="sha_crypt">
<term><option>-s</option>, <option>--sha-rounds</option></term> <term><option>-s</option>, <option>--sha-rounds</option></term>
<listitem> <listitem>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (c) 1991 , Julianne Frances Haugh Copyright (c) 1991 , Julianne Frances Haugh
Copyright (c) 2007 - 2009, Nicolas François Copyright (c) 2007 - 2011, Nicolas François
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -166,6 +166,19 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </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"> <varlistentry condition="sha_crypt">
<term> <term>
<option>-s</option>, <option>--sha-rounds</option> <option>-s</option>, <option>--sha-rounds</option>

View File

@ -135,6 +135,7 @@ static /*@noreturn@*/void usage (int status)
(void) fputs (_(" -m, --md5 encrypt the clear text password using\n" (void) fputs (_(" -m, --md5 encrypt the clear text password using\n"
" the MD5 algorithm\n"), " the MD5 algorithm\n"),
usageout); usageout);
(void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
(void) fputs (_(" -s, --sha-rounds number of SHA rounds for the SHA*\n" (void) fputs (_(" -s, --sha-rounds number of SHA rounds for the SHA*\n"
" crypt algorithms\n"), " crypt algorithms\n"),
@ -152,13 +153,13 @@ static /*@noreturn@*/void usage (int status)
*/ */
static void process_flags (int argc, char **argv) static void process_flags (int argc, char **argv)
{ {
int option_index = 0;
int c; int c;
static struct option long_options[] = { static struct option long_options[] = {
{"crypt-method", required_argument, NULL, 'c'}, {"crypt-method", required_argument, NULL, 'c'},
{"encrypted", no_argument, NULL, 'e'}, {"encrypted", no_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"md5", no_argument, NULL, 'm'}, {"md5", no_argument, NULL, 'm'},
{"root", required_argument, NULL, 'R'},
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
{"sha-rounds", required_argument, NULL, 's'}, {"sha-rounds", required_argument, NULL, 's'},
#endif #endif
@ -167,11 +168,11 @@ static void process_flags (int argc, char **argv)
while ((c = getopt_long (argc, argv, while ((c = getopt_long (argc, argv,
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
"c:ehms:", "c:ehmR:s:",
#else #else
"c:ehm", "c:ehmR:",
#endif #endif
long_options, &option_index)) != -1) { long_options, NULL)) != -1) {
switch (c) { switch (c) {
case 'c': case 'c':
crypt_method = optarg; crypt_method = optarg;
@ -185,6 +186,8 @@ static void process_flags (int argc, char **argv)
case 'm': case 'm':
md5flg = true; md5flg = true;
break; break;
case 'R': /* no-op, handled in process_root_flag () */
break;
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
case 's': case 's':
sflg = true; sflg = true;
@ -396,6 +399,8 @@ int main (int argc, char **argv)
(void) bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE); (void) textdomain (PACKAGE);
process_root_flag ("-R", argc, argv);
process_flags (argc, argv); process_flags (argc, argv);
OPENLOG ("chgpasswd"); OPENLOG ("chgpasswd");

View File

@ -128,6 +128,7 @@ static /*@noreturn@*/void usage (int status)
(void) fputs (_(" -m, --md5 encrypt the clear text password using\n" (void) fputs (_(" -m, --md5 encrypt the clear text password using\n"
" the MD5 algorithm\n"), " the MD5 algorithm\n"),
usageout); usageout);
(void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
(void) fputs (_(" -s, --sha-rounds number of SHA rounds for the SHA*\n" (void) fputs (_(" -s, --sha-rounds number of SHA rounds for the SHA*\n"
" crypt algorithms\n"), " crypt algorithms\n"),
@ -145,12 +146,12 @@ static /*@noreturn@*/void usage (int status)
*/ */
static void process_flags (int argc, char **argv) static void process_flags (int argc, char **argv)
{ {
int option_index = 0;
int c; int c;
static struct option long_options[] = { static struct option long_options[] = {
{"crypt-method", required_argument, NULL, 'c'}, {"crypt-method", required_argument, NULL, 'c'},
{"encrypted", no_argument, NULL, 'e'}, {"encrypted", no_argument, NULL, 'e'},
{"md5", no_argument, NULL, 'm'}, {"md5", no_argument, NULL, 'm'},
{"root", required_argument, NULL, 'R'},
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
{"sha-rounds", required_argument, NULL, 's'}, {"sha-rounds", required_argument, NULL, 's'},
#endif /* USE_SHA_CRYPT */ #endif /* USE_SHA_CRYPT */
@ -160,11 +161,11 @@ static void process_flags (int argc, char **argv)
while ((c = getopt_long (argc, argv, while ((c = getopt_long (argc, argv,
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
"c:ehms:", "c:ehmR:s:",
#else /* !USE_SHA_CRYPT */ #else /* !USE_SHA_CRYPT */
"c:ehm", "c:ehmR:",
#endif /* !USE_SHA_CRYPT */ #endif /* !USE_SHA_CRYPT */
long_options, &option_index)) != -1) { long_options, NULL)) != -1) {
switch (c) { switch (c) {
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
@ -178,6 +179,8 @@ static void process_flags (int argc, char **argv)
case 'm': case 'm':
md5flg = true; md5flg = true;
break; break;
case 'R': /* no-op, handled in process_root_flag () */
break;
#ifdef USE_SHA_CRYPT #ifdef USE_SHA_CRYPT
case 's': case 's':
sflg = true; sflg = true;
@ -387,6 +390,8 @@ int main (int argc, char **argv)
(void) bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE); (void) textdomain (PACKAGE);
process_root_flag ("-R", argc, argv);
process_flags (argc, argv); process_flags (argc, argv);
#ifdef USE_PAM #ifdef USE_PAM