From 4155ab5ec65d94746b4328bb3dd93beb09f89c73 Mon Sep 17 00:00:00 2001 From: Jan Orel Date: Tue, 26 May 2020 13:36:29 +0200 Subject: [PATCH] M #-: Validate username before authentication --- src/um/UserPool.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index 2becedf6ae..21fa55d32b 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -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