audit and syslog after the potential chroot.
* src/groupmod.c: The index of long options is not used.
in smaller messages.
* NEWS, src/usermod.c, man/usermod.8.xml: Likewise
* NEWS, src/groupadd.c, man/groupadd.8.xml: Add --root option. Open
- audit after the potential chroot.
+ audit and syslog after the potential chroot.
* src/groupadd.c: Check atexit failures.
* src/groupadd.c: Return E_SUCCESS instead of exit'ing at the end
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.
2011-10-22 Nicolas François <nicolas.francois@centraliens.net>
* 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.
- grpck
* NIS entries were dropped by -s (sort).
-login
<?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>
</variablelist>
</refsect1>
* Copyright (c) 1991 - 1993, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2000 - 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
#endif
/* local function prototypes */
-static void usage (int status);
+static /*@noreturn@*/void usage (int status);
static void new_grent (struct group *grent);
#ifdef SHADOWGRP
/*
* usage - display usage message and exit
*/
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
{
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout,
break;
case 'h':
usage (E_SUCCESS);
- break;
+ /*@notreached@*/break;
case 'K':
/*
* override login.defs defaults (-K name=value)
(void) fputs (_(" -o, --non-unique allow to use a duplicate (non-unique) GID\n"), usageout);
(void) fputs (_(" -p, --password PASSWORD change the password to this (encrypted)\n"
" PASSWORD\n"), usageout);
+ (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
(void) fputs ("\n", usageout);
exit (status);
}
*/
static void process_flags (int argc, char **argv)
{
- int option_index = 0;
int c;
static struct option long_options[] = {
{"gid", required_argument, NULL, 'g'},
{"new-name", required_argument, NULL, 'n'},
{"non-unique", no_argument, NULL, 'o'},
{"password", required_argument, NULL, 'p'},
+ {"root", required_argument, NULL, 'R'},
{NULL, 0, NULL, '\0'}
};
- while ((c =
- getopt_long (argc, argv, "g:hn:op:",
- long_options, &option_index)) != -1) {
+ while ((c = getopt_long (argc, argv, "g:hn:op:R:",
+ long_options, NULL)) != -1) {
switch (c) {
case 'g':
gflg = true;
group_passwd = optarg;
pflg = true;
break;
+ case 'R': /* no-op, handled in process_root_flag () */
+ break;
default:
usage (E_USAGE);
}
#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.
*/
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
+ process_root_flag ("-R", argc, argv);
+
+ OPENLOG ("groupmod");
+#ifdef WITH_AUDIT
+ audit_help_open ();
+#endif
+
if (atexit (do_cleanups) != 0) {
fprintf (stderr,
_("%s: Cannot setup cleanup service.\n"),
process_flags (argc, argv);
- OPENLOG ("groupmod");
-
#ifdef ACCT_TOOLS_SETUID
#ifdef USE_PAM
{