fix: fix su's lexer

This commit is contained in:
2023-12-14 04:18:29 +00:00
parent 4cfbbc2991
commit 2628177746
2 changed files with 3 additions and 1 deletions

View File

@ -115,8 +115,10 @@ std::vector<std::string> BookStoreEngineClass::ExecuteSu(
std::string user_id, password;
if (!CommandSuLexer(cmd, user_id, password))
return std::vector<std::string>({"Invalid"});
// debugPrint("su", user_id, " ", password);
if (login_stack.size() > 0 &&
user_data_base.GetPrevilege(login_stack.top().first) == 7) {
// debugPrint("has root previlege");
if (user_data_base.GetPrevilege(user_id) == -1)
return std::vector<std::string>({"Invalid"});
login_stack.push(std::make_pair(user_id, ""));