M #-: Validate username before authentication

This commit is contained in:
Jan Orel committed 2020-05-26 16:58:44 +02:00
1 parent 66579c5525
commit 4155ab5ec6
1 file changed
+7
+7
View File
@@ -1351,6 +1351,7 @@ bool UserPool::authenticate(const string& session,
User * user = 0;
string username;
string token;
string error_str;
int rc;
bool ar;
@@ -1362,6 +1363,12 @@ bool UserPool::authenticate(const string& session,
return false;
}
if (!PoolObjectSQL::name_is_valid(username, User::INVALID_NAME_CHARS, error_str))
{
NebulaLog::log("AuM",Log::ERROR, "User is invalid, " + error_str );
return false;
}
user = get(username);
if (user != 0 ) //User known to OpenNebula