exception for root

Exception for root if sudo package is not installed
This commit is contained in:
lunardunno 2024-12-08 14:31:23 +04:00 committed by GitHub
parent 62497024f9
commit 45fb4b0982
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -766,7 +766,7 @@ ErrorCode ServerController::isUserInSudo(const ServerCredentials &credentials, D
if (credentials.userName != "root" && !stdOut.contains("sudo") && !stdOut.contains("wheel")) if (credentials.userName != "root" && !stdOut.contains("sudo") && !stdOut.contains("wheel"))
return ErrorCode::ServerUserNotInSudo; return ErrorCode::ServerUserNotInSudo;
if (stdOut.contains("sudo:") && !stdOut.contains("uname:") && stdOut.contains("not found")) if (credentials.userName != "root" && stdOut.contains("sudo:") && !stdOut.contains("uname:") && stdOut.contains("not found"))
return ErrorCode::SudoPackageIsNotPreinstalled; return ErrorCode::SudoPackageIsNotPreinstalled;
if (stdOut.contains("sudoers")) if (stdOut.contains("sudoers"))
return ErrorCode::ServerUserNotAllowedInSudoers; return ErrorCode::ServerUserNotAllowedInSudoers;