usermod: Return error if -L and -U options are used simultaneously

This commit is contained in:
Tim Ledbetter 2023-06-16 20:17:38 +01:00 committed by Andreas Kling
parent 089ff7b94e
commit e86dd1cc89

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Brandon Pruitt <brapru@pm.me>
* Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -50,6 +51,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
if (lock && unlock) {
warnln("The -L and -U options are mutually exclusive");
args_parser.print_usage(stderr, arguments.strings[0]);
return 1;
}
auto account_or_error = Core::Account::from_name(username);
if (account_or_error.is_error()) {