mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Bug #847: Update the scheduler client, it does not hash the password
This commit is contained in:
parent
34359e7a60
commit
92b05d5971
@ -95,8 +95,6 @@ private:
|
||||
void set_one_endpoint(string endpoint);
|
||||
|
||||
int read_oneauth(string &secret);
|
||||
|
||||
int split_secret(const string& secret);
|
||||
};
|
||||
|
||||
#endif /*ONECLIENT_H_*/
|
||||
|
@ -45,15 +45,7 @@ void Client::set_one_auth(string secret)
|
||||
rc = read_oneauth(secret);
|
||||
}
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
rc = split_secret(secret);
|
||||
|
||||
if( rc != 0 )
|
||||
{
|
||||
throw runtime_error("Wrong format for auth token");
|
||||
}
|
||||
}
|
||||
one_auth = secret;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -117,39 +109,12 @@ int Client::read_oneauth(string &secret)
|
||||
if (rc != 0)
|
||||
{
|
||||
NebulaLog::log("XMLRPC",Log::ERROR,oss);
|
||||
throw runtime_error( oss.str() );
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int Client::split_secret(const string& secret)
|
||||
{
|
||||
size_t pos;
|
||||
|
||||
pos = secret.find(":");
|
||||
|
||||
if ( pos == string::npos )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( secret.rfind(":") == pos )
|
||||
{
|
||||
string user = secret.substr(0,pos);
|
||||
string pass = secret.substr(pos+1);
|
||||
|
||||
string sha1_pass = SSLTools::sha1_digest(pass);
|
||||
|
||||
one_auth = user + ":" + sha1_pass;
|
||||
}
|
||||
else
|
||||
{
|
||||
one_auth = secret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user