mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Bug #485: Moves passwd checks to user allocate. Driver responses are now better parsed, user creation fails if it contains spaces in passwd.
(cherry picked from commit 59e72d93a4979ad81dac8202ecf516e414213569)
This commit is contained in:
parent
d8a5325495
commit
cb4dc7123a
@ -242,13 +242,6 @@ int UserAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
ugname = GroupPool::USERS_NAME;
|
||||
}
|
||||
|
||||
if (!User::is_valid_password(passwd))
|
||||
{
|
||||
error_str = "Invalid password, it can not contain spaces.";
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return upool->allocate(&id,ugid,uname,ugname,passwd,true,error_str);
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,11 @@ int UserPool::allocate (
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
if (password.empty() || !User::is_valid_password(password))
|
||||
{
|
||||
goto error_pass;
|
||||
}
|
||||
|
||||
if ( uname.empty() )
|
||||
{
|
||||
goto error_name;
|
||||
@ -176,6 +181,10 @@ int UserPool::allocate (
|
||||
|
||||
return *oid;
|
||||
|
||||
error_pass:
|
||||
oss << "Invalid password, it can not contain spaces.";
|
||||
goto error_common;
|
||||
|
||||
error_name:
|
||||
oss << "NAME cannot be empty.";
|
||||
goto error_common;
|
||||
@ -293,7 +302,12 @@ bool UserPool::authenticate(const string& session,
|
||||
|
||||
if ( is.good() )
|
||||
{
|
||||
is >> mad_name >> ws >> mad_pass;
|
||||
is >> mad_name >> ws;
|
||||
}
|
||||
|
||||
if ( !is.fail() )
|
||||
{
|
||||
getline(is, mad_pass);
|
||||
}
|
||||
|
||||
if ( !is.fail() )
|
||||
@ -314,7 +328,7 @@ bool UserPool::authenticate(const string& session,
|
||||
oss << "Can't create user: " << error_str <<
|
||||
". Driver response: " << ar.message;
|
||||
|
||||
ar.message = oss.str();
|
||||
NebulaLog::log("AuM",Log::ERROR,oss);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user