1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-24 02:03:52 +03:00

B #4590: Santize login, remove whitespace (#4655)

This commit is contained in:
Jan Orel 2020-05-05 12:15:19 +02:00 committed by GitHub
parent 6c01f40a26
commit 8b0503a500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@
#include "NebulaUtil.h"
#include "PoolObjectAuth.h"
#include "Nebula.h"
#include <regex>
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -206,6 +207,13 @@ void AuthManager::authenticate_action(AuthRequest * ar)
goto error_driver;
}
// ------------------------------------------------------------------------
// Sanitize the login - remove leading and trailing spaces
// ------------------------------------------------------------------------
ar->username = regex_replace(ar->username, regex("^(%20|%09|%0A|%0D)+"), "");
ar->username = regex_replace(ar->username, regex("(%20|%09|%0A|%0D)+$"), "");
// ------------------------------------------------------------------------
// Queue the request
// ------------------------------------------------------------------------