fix: bug in passwd's lexer

This commit is contained in:
2023-12-13 10:31:13 +00:00
parent e620762102
commit 702f8072dc
2 changed files with 5 additions and 2 deletions

View File

@ -102,7 +102,7 @@ bool CommandRegisterLexer(const std::string &command, std::string &user_id,
bool CommandPasswdLexer(const std::string &command, std::string &user_id,
std::string &old_password, std::string &new_password) {
static std::basic_regex main_pattern(
R"(^ *passwd +(?:[0-9a-zA-Z_]{1,30}) +(?:[0-9a-zA-Z_]{1,30})? +(?:[0-9a-zA-Z_]{1,30}) *$)",
R"(^ *passwd +(?:[0-9a-zA-Z_]{1,30})(?: +(?:[0-9a-zA-Z_]{1,30}))? +(?:[0-9a-zA-Z_]{1,30}) *$)",
std::regex_constants::optimize);
if (std::regex_match(command, main_pattern)) {
std::stringstream ss(command);