* src/usermod.c (process_flags): Report usage if no options are
provided. Update the error message. * src/usermod.c (process_flags): Check option compatibility and dependency before options are discarded when no changes are requested.
This commit is contained in:
parent
d51420bb01
commit
a5ded26850
@ -4,6 +4,11 @@
|
|||||||
* src/usermod.c (move_home): It is always an error to use -m if
|
* src/usermod.c (move_home): It is always an error to use -m if
|
||||||
the new home directory already exist (independently from the
|
the new home directory already exist (independently from the
|
||||||
existence of the old home directory did not exist)
|
existence of the old home directory did not exist)
|
||||||
|
* src/usermod.c (process_flags): Report usage if no options are
|
||||||
|
provided. Update the error message.
|
||||||
|
* src/usermod.c (process_flags): Check option compatibility and
|
||||||
|
dependency before options are discarded when no changes are
|
||||||
|
requested.
|
||||||
|
|
||||||
2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
|
2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -1053,10 +1053,37 @@ static void process_flags (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!anyflag) {
|
if (!anyflag) {
|
||||||
fprintf (stderr, _("%s: no flags given\n"), Prog);
|
fprintf (stderr, _("%s: no options\n"), Prog);
|
||||||
exit (E_USAGE);
|
usage (E_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aflg && (!Gflg)) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: %s flag is only allowed with the %s flag\n"),
|
||||||
|
Prog, "-a", "-G");
|
||||||
|
usage (E_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Lflg && (pflg || Uflg)) || (pflg && Uflg)) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: the -L, -p, and -U flags are exclusive\n"),
|
||||||
|
Prog);
|
||||||
|
usage (E_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oflg && !uflg) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: %s flag is only allowed with the %s flag\n"),
|
||||||
|
Prog, "-o", "-u");
|
||||||
|
usage (E_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mflg && !dflg) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: %s flag is only allowed with the %s flag\n"),
|
||||||
|
Prog, "-m", "-d");
|
||||||
|
usage (E_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_newid == user_id) {
|
if (user_newid == user_id) {
|
||||||
@ -1106,38 +1133,6 @@ static void process_flags (int argc, char **argv)
|
|||||||
exit (E_USAGE);
|
exit (E_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aflg && (!Gflg)) {
|
|
||||||
fprintf (stderr,
|
|
||||||
_("%s: %s flag is only allowed with the %s flag\n"),
|
|
||||||
Prog, "-a", "-G");
|
|
||||||
usage (E_USAGE);
|
|
||||||
exit (E_USAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Lflg && (pflg || Uflg)) || (pflg && Uflg)) {
|
|
||||||
fprintf (stderr,
|
|
||||||
_("%s: the -L, -p, and -U flags are exclusive\n"),
|
|
||||||
Prog);
|
|
||||||
usage (E_USAGE);
|
|
||||||
exit (E_USAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oflg && !uflg) {
|
|
||||||
fprintf (stderr,
|
|
||||||
_("%s: %s flag is only allowed with the %s flag\n"),
|
|
||||||
Prog, "-o", "-u");
|
|
||||||
usage (E_USAGE);
|
|
||||||
exit (E_USAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mflg && !dflg) {
|
|
||||||
fprintf (stderr,
|
|
||||||
_("%s: %s flag is only allowed with the %s flag\n"),
|
|
||||||
Prog, "-m", "-d");
|
|
||||||
usage (E_USAGE);
|
|
||||||
exit (E_USAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* local, no need for xgetpwnam */
|
/* local, no need for xgetpwnam */
|
||||||
if (lflg && (getpwnam (user_newname) != NULL)) {
|
if (lflg && (getpwnam (user_newname) != NULL)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
Loading…
Reference in New Issue
Block a user