mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
su: Only check for an interactive tty if a password is actually needed
This commit is contained in:
parent
a8a5707467
commit
3c04d22e38
Notes:
sideshowbarker
2024-07-17 00:20:02 +09:00
Author: https://github.com/karolba Commit: https://github.com/SerenityOS/serenity/commit/3c04d22e38 Pull-request: https://github.com/SerenityOS/serenity/pull/17347 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/Popaulol ✅ Reviewed-by: https://github.com/kleinesfilmroellchen
1 changed files with 3 additions and 3 deletions
|
@ -16,9 +16,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath tty exec id"));
|
||||
|
||||
if (!TRY(Core::System::isatty(STDIN_FILENO)))
|
||||
return Error::from_string_literal("Standard input is not a terminal");
|
||||
|
||||
StringView first_positional;
|
||||
StringView second_positional;
|
||||
DeprecatedString command;
|
||||
|
@ -46,6 +43,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath tty exec id"));
|
||||
|
||||
if (getuid() != 0 && account.has_password()) {
|
||||
if (!TRY(Core::System::isatty(STDIN_FILENO)))
|
||||
return Error::from_string_literal("Standard input is not a terminal");
|
||||
|
||||
auto password = TRY(Core::get_password());
|
||||
if (!account.authenticate(password))
|
||||
return Error::from_string_literal("Incorrect or disabled password.");
|
||||
|
|
Loading…
Reference in a new issue