[Pkg-shadow-commits] r3537 - in upstream/trunk: . man src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Nov 6 18:37:39 UTC 2011
Author: nekral-guest
Date: 2011-11-06 18:37:39 +0000 (Sun, 06 Nov 2011)
New Revision: 3537
Modified:
upstream/trunk/ChangeLog
upstream/trunk/NEWS
upstream/trunk/man/usermod.8.xml
upstream/trunk/src/usermod.c
Log:
* NEWS, src/usermod.c, man/usermod.8.xml: Add --root option. Open
audit and syslog after the potential chroot. userdel's usage split
in smaller messages.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-11-06 18:37:32 UTC (rev 3536)
+++ upstream/trunk/ChangeLog 2011-11-06 18:37:39 UTC (rev 3537)
@@ -9,6 +9,7 @@
* NEWS, src/userdel.c, man/userdel.8.xml: Add --root option. Open
audit and syslog after the potential chroot. userdel's usage split
in smaller messages.
+ * NEWS, src/usermod.c, man/usermod.8.xml: Likewise
2011-10-22 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS 2011-11-06 18:37:32 UTC (rev 3536)
+++ upstream/trunk/NEWS 2011-11-06 18:37:39 UTC (rev 3537)
@@ -83,6 +83,7 @@
* 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, or if aging features are used (-e or -f).
+ * Add --root option.
*** translation
* Updated Brazilian Portuguese translation.
Modified: upstream/trunk/man/usermod.8.xml
===================================================================
--- upstream/trunk/man/usermod.8.xml 2011-11-06 18:37:32 UTC (rev 3536)
+++ upstream/trunk/man/usermod.8.xml 2011-11-06 18:37:39 UTC (rev 3537)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1991 - 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
@@ -296,6 +296,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>--shell</option>
<replaceable>SHELL</replaceable>
</term>
Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c 2011-11-06 18:37:32 UTC (rev 3536)
+++ upstream/trunk/src/usermod.c 2011-11-06 18:37:39 UTC (rev 3537)
@@ -310,38 +310,37 @@
*/
static /*@noreturn@*/void usage (int status)
{
- fprintf ((E_SUCCESS != status) ? stderr : stdout,
- _("Usage: usermod [options] LOGIN\n"
- "\n"
- "Options:\n"
- " -c, --comment COMMENT new value of the GECOS field\n"
- " -d, --home HOME_DIR new home directory for the user account\n"
- " -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"
- " -f, --inactive INACTIVE set password inactive after expiration\n"
- " to INACTIVE\n"
- " -g, --gid GROUP force use GROUP as new primary group\n"
- " -G, --groups GROUPS new list of supplementary GROUPS\n"
- " -a, --append append the user to the supplemental GROUPS\n"
- " mentioned by the -G option without removing\n"
- " him/her from other groups\n"
- " -h, --help display this help message and exit\n"
- " -l, --login NEW_LOGIN new value of the login name\n"
- " -L, --lock lock the user account\n"
- " -m, --move-home move contents of the home directory to the\n"
- " new location (use only with -d)\n"
- " -o, --non-unique allow using duplicate (non-unique) UID\n"
- " -p, --password PASSWORD use encrypted password for the new password\n"
- " -s, --shell SHELL new login shell for the user account\n"
- " -u, --uid UID new UID for the user account\n"
- " -U, --unlock unlock the user account\n"
- "%s"
- "\n"),
+ FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
+ (void) fprintf (usageout,
+ _("Usage: %s [options] LOGIN\n"
+ "\n"
+ "Options:\n"),
+ Prog);
+ (void) fputs (_(" -c, --comment COMMENT new value of the GECOS field\n"), usageout);
+ (void) fputs (_(" -d, --home HOME_DIR new home directory for the user account\n"), usageout);
+ (void) fputs (_(" -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"), usageout);
+ (void) fputs (_(" -f, --inactive INACTIVE set password inactive after expiration\n"
+ " to INACTIVE\n"), usageout);
+ (void) fputs (_(" -g, --gid GROUP force use GROUP as new primary group\n"), usageout);
+ (void) fputs (_(" -G, --groups GROUPS new list of supplementary GROUPS\n"), usageout);
+ (void) fputs (_(" -a, --append append the user to the supplemental GROUPS\n"
+ " mentioned by the -G option without removing\n"
+ " him/her from other groups\n"), usageout);
+ (void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
+ (void) fputs (_(" -l, --login NEW_LOGIN new value of the login name\n"), usageout);
+ (void) fputs (_(" -L, --lock lock the user account\n"), usageout);
+ (void) fputs (_(" -m, --move-home move contents of the home directory to the\n"
+ " new location (use only with -d)\n"), usageout);
+ (void) fputs (_(" -o, --non-unique allow using duplicate (non-unique) UID\n"), usageout);
+ (void) fputs (_(" -p, --password PASSWORD use encrypted password for the new password\n"), usageout);
+ (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
+ (void) fputs (_(" -s, --shell SHELL new login shell for the user account\n"), usageout);
+ (void) fputs (_(" -u, --uid UID new UID for the user account\n"), usageout);
+ (void) fputs (_(" -U, --unlock unlock the user account\n"), usageout);
#ifdef WITH_SELINUX
- _(" -Z, --selinux-user new SELinux user mapping for the user account\n")
-#else
- ""
+ (void) fputs (_(" -Z, --selinux-user new SELinux user mapping for the user account\n"), usageout);
#endif
- );
+ (void) fputs ("\n", usageout);
exit (status);
}
@@ -889,6 +888,7 @@
{"move-home", no_argument, NULL, 'm'},
{"non-unique", no_argument, NULL, 'o'},
{"password", required_argument, NULL, 'p'},
+ {"root", required_argument, NULL, 'R'},
#ifdef WITH_SELINUX
{"selinux-user", required_argument, NULL, 'Z'},
#endif
@@ -899,9 +899,9 @@
};
while ((c = getopt_long (argc, argv,
#ifdef WITH_SELINUX
- "ac:d:e:f:g:G:hl:Lmop:s:u:UZ:",
+ "ac:d:e:f:g:G:hl:Lmop:R:s:u:UZ:",
#else
- "ac:d:e:f:g:G:hl:Lmop:s:u:U",
+ "ac:d:e:f:g:G:hl:Lmop:R:s:u:U",
#endif
long_options, NULL)) != -1) {
switch (c) {
@@ -996,6 +996,8 @@
user_pass = optarg;
pflg = true;
break;
+ case 'R': /* no-op, handled in process_root_flag () */
+ break;
case 's':
if (!VALID (optarg)) {
fprintf (stderr,
@@ -1788,10 +1790,6 @@
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
-#ifdef WITH_AUDIT
- audit_help_open ();
-#endif
-
/*
* Get my name so that I can use it to report errors.
*/
@@ -1801,12 +1799,17 @@
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
+ process_root_flag ("-R", argc, argv);
+
+ OPENLOG ("usermod");
+#ifdef WITH_AUDIT
+ audit_help_open ();
+#endif
+
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
user_groups = (char **) malloc (sizeof (char *) * (1 + sys_ngroups));
user_groups[0] = (char *) 0;
- OPENLOG ("usermod");
-
is_shadow_pwd = spw_file_present ();
#ifdef SHADOWGRP
is_shadow_grp = sgr_file_present ();
More information about the Pkg-shadow-commits
mailing list