1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-13 13:17:39 +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 59e72d93a4)
This commit is contained in:
Ruben S. Montero 2011-09-09 19:14:45 +02:00
parent d8a5325495
commit cb4dc7123a
2 changed files with 16 additions and 9 deletions

View File

@ -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);
}

View File

@ -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
{