* NEWS, src/chfn.c, man/chfn.1.xml: Add --root option.
This commit is contained in:
parent
b26f73f427
commit
0530588266
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* src/chfn.c, man/chfn.1.xml: Add support for long options.
|
* src/chfn.c, man/chfn.1.xml: Add support for long options.
|
||||||
* src/chfn.c, man/chfn.1.xml: Add -u/--help option
|
* src/chfn.c, man/chfn.1.xml: Add -u/--help option
|
||||||
|
* NEWS, src/chfn.c, man/chfn.1.xml: Add --root option.
|
||||||
|
|
||||||
2011-10-30 Nicolas François <nicolas.francois@centraliens.net>
|
2011-10-30 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
2
NEWS
2
NEWS
@ -18,6 +18,8 @@ shadow-4.1.4.3 -> shadow-4.1.5 UNRELEASED
|
|||||||
|
|
||||||
- chage
|
- chage
|
||||||
* Add --root option.
|
* Add --root option.
|
||||||
|
- chfn
|
||||||
|
* Add --root option.
|
||||||
- chgpasswd
|
- chgpasswd
|
||||||
* 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
|
||||||
|
@ -130,6 +130,19 @@
|
|||||||
<para>Change the user's room number.</para>
|
<para>Change the user's room number.</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>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<option>-u</option>, <option>--help</option>
|
<option>-u</option>, <option>--help</option>
|
||||||
|
20
src/chfn.c
20
src/chfn.c
@ -123,6 +123,7 @@ static /*@noreturn@*/void usage (int status)
|
|||||||
(void) fputs (_(" -h, --home-phone HOME_PHONE change user's home phone number\n"), usageout);
|
(void) fputs (_(" -h, --home-phone HOME_PHONE change user's home phone number\n"), usageout);
|
||||||
(void) fputs (_(" -o, --other OTHER_INFO change user's other GECOS information\n"), usageout);
|
(void) fputs (_(" -o, --other OTHER_INFO change user's other GECOS information\n"), usageout);
|
||||||
(void) fputs (_(" -r, --room ROOM_NUMBER change user's room number\n"), usageout);
|
(void) fputs (_(" -r, --room ROOM_NUMBER change user's room number\n"), usageout);
|
||||||
|
(void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
|
||||||
(void) fputs (_(" -u, --help display this help message and exit\n"), usageout);
|
(void) fputs (_(" -u, --help display this help message and exit\n"), usageout);
|
||||||
(void) fputs (_(" -w, --work-phone WORK_PHONE change user's office phone number\n"), usageout);
|
(void) fputs (_(" -w, --work-phone WORK_PHONE change user's office phone number\n"), usageout);
|
||||||
(void) fputs ("\n", usageout);
|
(void) fputs ("\n", usageout);
|
||||||
@ -272,6 +273,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
{"home-phone", required_argument, NULL, 'h'},
|
{"home-phone", required_argument, NULL, 'h'},
|
||||||
{"other", required_argument, NULL, 'o'},
|
{"other", required_argument, NULL, 'o'},
|
||||||
{"room", required_argument, NULL, 'r'},
|
{"room", required_argument, NULL, 'r'},
|
||||||
|
{"root", required_argument, NULL, 'R'},
|
||||||
{"help", no_argument, NULL, 'u'},
|
{"help", no_argument, NULL, 'u'},
|
||||||
{"work-phone", required_argument, NULL, 'w'},
|
{"work-phone", required_argument, NULL, 'w'},
|
||||||
{NULL, 0, NULL, '\0'}
|
{NULL, 0, NULL, '\0'}
|
||||||
@ -284,7 +286,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
* environment and must agree with the real UID. Also, the UID will
|
* environment and must agree with the real UID. Also, the UID will
|
||||||
* be checked for any commands which are restricted to root only.
|
* be checked for any commands which are restricted to root only.
|
||||||
*/
|
*/
|
||||||
while ((c = getopt_long (argc, argv, "f:h:o:r:uw:",
|
while ((c = getopt_long (argc, argv, "f:h:o:r:R:uw:",
|
||||||
long_options, NULL)) != -1) {
|
long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'f':
|
case 'f':
|
||||||
@ -323,6 +325,8 @@ static void process_flags (int argc, char **argv)
|
|||||||
rflg = true;
|
rflg = true;
|
||||||
STRFCPY (roomno, optarg);
|
STRFCPY (roomno, optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'R': /* no-op, handled in process_root_flag () */
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
usage (E_SUCCESS);
|
usage (E_SUCCESS);
|
||||||
/*@notreached@*/break;
|
/*@notreached@*/break;
|
||||||
@ -626,23 +630,25 @@ int main (int argc, char **argv)
|
|||||||
char new_gecos[BUFSIZ]; /* buffer for new GECOS fields */
|
char new_gecos[BUFSIZ]; /* buffer for new GECOS fields */
|
||||||
char *user;
|
char *user;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the program name. The program name is used as a
|
||||||
|
* prefix to most error messages.
|
||||||
|
*/
|
||||||
|
Prog = Basename (argv[0]);
|
||||||
|
|
||||||
sanitize_env ();
|
sanitize_env ();
|
||||||
(void) setlocale (LC_ALL, "");
|
(void) setlocale (LC_ALL, "");
|
||||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||||
(void) textdomain (PACKAGE);
|
(void) textdomain (PACKAGE);
|
||||||
|
|
||||||
|
process_root_flag ("-R", argc, argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This command behaves different for root and non-root
|
* This command behaves different for root and non-root
|
||||||
* users.
|
* users.
|
||||||
*/
|
*/
|
||||||
amroot = (getuid () == 0);
|
amroot = (getuid () == 0);
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the program name. The program name is used as a
|
|
||||||
* prefix to most error messages.
|
|
||||||
*/
|
|
||||||
Prog = Basename (argv[0]);
|
|
||||||
|
|
||||||
OPENLOG ("chfn");
|
OPENLOG ("chfn");
|
||||||
|
|
||||||
/* parse the command line options */
|
/* parse the command line options */
|
||||||
|
Loading…
Reference in New Issue
Block a user