<?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
</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>
*/
static void usage (int status)
{
- fputs (_("Usage: userdel [options] LOGIN\n"
- "\n"
- "Options:\n"
- " -f, --force force removal of files,\n"
- " even if not owned by user\n"
- " -h, --help display this help message and exit\n"
- " -r, --remove remove home directory and mail spool\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 (_(" -f, --force force removal of files,\n"
+ " even if not owned by user\n"),
+ usageout);
+ (void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
+ (void) fputs (_(" -r, --remove remove home directory and mail spool\n"), usageout);
+ (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
+ (void) fputs ("\n", usageout);
exit (status);
}
#endif /* USE_PAM */
#endif /* ACCT_TOOLS_SETUID */
-#ifdef WITH_AUDIT
- audit_help_open ();
-#endif /* WITH_AUDIT */
-
/*
* 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 ("userdel");
+#ifdef WITH_AUDIT
+ audit_help_open ();
+#endif /* WITH_AUDIT */
+
{
/*
* Parse the command line options.
{"force", no_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
{"remove", no_argument, NULL, 'r'},
+ {"root", required_argument, NULL, 'R'},
{NULL, 0, NULL, '\0'}
};
- while ((c = getopt_long (argc, argv, "fhr",
+ while ((c = getopt_long (argc, argv, "fhrR:",
long_options, NULL)) != -1) {
switch (c) {
case 'f': /* force remove even if not owned by user */
case 'r': /* remove home dir and mailbox */
rflg = true;
break;
+ case 'R': /* no-op, handled in process_root_flag () */
+ break;
default:
usage (E_USAGE);
}
usage (E_USAGE);
}
- OPENLOG ("userdel");
-
#ifdef ACCT_TOOLS_SETUID
#ifdef USE_PAM
{