[Pkg-shadow-commits] r3543 - in upstream/trunk: . man src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Nov 6 18:38:16 UTC 2011
Author: nekral-guest
Date: 2011-11-06 18:38:16 +0000 (Sun, 06 Nov 2011)
New Revision: 3543
Modified:
upstream/trunk/ChangeLog
upstream/trunk/NEWS
upstream/trunk/man/passwd.1.xml
upstream/trunk/src/passwd.c
Log:
* NEWS, src/passwd.c, man/passwd.1.xml: Add --root option.
passwd's usage split in smaller messages.
* src/passwd.c: Call sanitize_env() before setting the locales.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-11-06 18:38:10 UTC (rev 3542)
+++ upstream/trunk/ChangeLog 2011-11-06 18:38:16 UTC (rev 3543)
@@ -33,6 +33,9 @@
man/chgpasswd.8.xml: Add --root option.
* src/chpasswd.c, src/chgpasswd.c: The getopt index of long
options is not used.
+ * NEWS, src/passwd.c, man/passwd.1.xml: Add --root option.
+ passwd's usage split in smaller messages.
+ * src/passwd.c: Call sanitize_env() before setting the locales.
2011-10-22 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS 2011-11-06 18:38:10 UTC (rev 3542)
+++ upstream/trunk/NEWS 2011-11-06 18:38:16 UTC (rev 3543)
@@ -37,6 +37,8 @@
* Add --root option.
- groupdel
* Add --root option.
+- groupmems
+ * Fix parsing of gshadow entries.
- groupmod
* Fixed groupmod when configured with --enable-account-tools-setuid.
* When the gshadow file exists but there are no gshadow entries, an entry
@@ -75,8 +77,10 @@
* Close PAM sessions as root. This will be more friendly to PAM modules
like pam_mount or pam_systemd.
* Added support for PAM modules which change PAM_USER.
-- newgrp, sg, groupmems
+- newgrp, sg
* Fix parsing of gshadow entries.
+- passwd
+ * Add --root option.
- pwpck
* NIS entries were dropped by -s (sort).
- pwconv
Modified: upstream/trunk/man/passwd.1.xml
===================================================================
--- upstream/trunk/man/passwd.1.xml 2011-11-06 18:38:10 UTC (rev 3542)
+++ upstream/trunk/man/passwd.1.xml 2011-11-06 18:38:16 UTC (rev 3543)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1989 - 1994, 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
@@ -280,6 +280,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>-S</option>, <option>--status</option>
</term>
<listitem>
Modified: upstream/trunk/src/passwd.c
===================================================================
--- upstream/trunk/src/passwd.c 2011-11-06 18:38:10 UTC (rev 3542)
+++ upstream/trunk/src/passwd.c 2011-11-06 18:38:16 UTC (rev 3543)
@@ -2,7 +2,7 @@
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2010, Nicolas François
+ * Copyright (c) 2007 - 2011, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -159,28 +159,31 @@
*/
static /*@noreturn@*/void usage (int status)
{
- (void)
- fputs (_("Usage: passwd [options] [LOGIN]\n"
- "\n"
- "Options:\n"
- " -a, --all report password status on all accounts\n"
- " -d, --delete delete the password for the named account\n"
- " -e, --expire force expire the password for the named account\n"
- " -h, --help display this help message and exit\n"
- " -k, --keep-tokens change password only if expired\n"
- " -i, --inactive INACTIVE set password inactive after expiration\n"
- " to INACTIVE\n"
- " -l, --lock lock the password of the named account\n"
- " -n, --mindays MIN_DAYS set minimum number of days before password\n"
- " change to MIN_DAYS\n"
- " -q, --quiet quiet mode\n"
- " -r, --repository REPOSITORY change password in REPOSITORY repository\n"
- " -S, --status report password status on the named account\n"
- " -u, --unlock unlock the password of the named account\n"
- " -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n"
- " -x, --maxdays MAX_DAYS set maximum number of days before password\n"
- " change to MAX_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 (_(" -a, --all report password status on all accounts\n"), usageout);
+ (void) fputs (_(" -d, --delete delete the password for the named account\n"), usageout);
+ (void) fputs (_(" -e, --expire force expire the password for the named account\n"), usageout);
+ (void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
+ (void) fputs (_(" -k, --keep-tokens change password only if expired\n"), usageout);
+ (void) fputs (_(" -i, --inactive INACTIVE set password inactive after expiration\n"
+ " to INACTIVE\n"), usageout);
+ (void) fputs (_(" -l, --lock lock the password of the named account\n"), usageout);
+ (void) fputs (_(" -n, --mindays MIN_DAYS set minimum number of days before password\n"
+ " change to MIN_DAYS\n"), usageout);
+ (void) fputs (_(" -q, --quiet quiet mode\n"), usageout);
+ (void) fputs (_(" -r, --repository REPOSITORY change password in REPOSITORY repository\n"), usageout);
+ (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
+ (void) fputs (_(" -S, --status report password status on the named account\n"), usageout);
+ (void) fputs (_(" -u, --unlock unlock the password of the named account\n"), usageout);
+ (void) fputs (_(" -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n"), usageout);
+ (void) fputs (_(" -x, --maxdays MAX_DAYS set maximum number of days before password\n"
+ " change to MAX_DAYS\n"), usageout);
+ (void) fputs ("\n", usageout);
exit (status);
}
@@ -771,31 +774,32 @@
const struct spwd *sp; /* Shadow file entry for user */
#endif /* !USE_PAM */
+ sanitize_env ();
+
+ /*
+ * Get the program name. The program name is used as a prefix to
+ * most error messages.
+ */
+ Prog = Basename (argv[0]);
+
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
+ process_root_flag ("-R", argc, argv);
+
/*
* The program behaves differently when executed by root than when
* executed by a normal user.
*/
amroot = (getuid () == 0);
- /*
- * Get the program name. The program name is used as a prefix to
- * most error messages.
- */
- Prog = Basename (argv[0]);
-
- sanitize_env ();
-
OPENLOG ("passwd");
{
/*
* Parse the command line options.
*/
- int option_index = 0;
int c;
static struct option long_options[] = {
{"all", no_argument, NULL, 'a'},
@@ -808,6 +812,7 @@
{"mindays", required_argument, NULL, 'n'},
{"quiet", no_argument, NULL, 'q'},
{"repository", required_argument, NULL, 'r'},
+ {"root", required_argument, NULL, 'R'},
{"status", no_argument, NULL, 'S'},
{"unlock", no_argument, NULL, 'u'},
{"warndays", required_argument, NULL, 'w'},
@@ -815,8 +820,8 @@
{NULL, 0, NULL, '\0'}
};
- while ((c = getopt_long (argc, argv, "adehi:kln:qr:Suw:x:",
- long_options, &option_index)) != -1) {
+ while ((c = getopt_long (argc, argv, "adehi:kln:qr:R:Suw:x:",
+ long_options, NULL)) != -1) {
switch (c) {
case 'a':
aflg = true;
@@ -872,6 +877,8 @@
exit (E_BAD_ARG);
}
break;
+ case 'R': /* no-op, handled in process_root_flag () */
+ break;
case 'S':
Sflg = true; /* ok for users */
break;
More information about the Pkg-shadow-commits
mailing list