mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Merge branch 'bug-847' of git.opennebula.org:one into bug-847
This commit is contained in:
commit
1ee23da08a
@ -275,7 +275,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
if rc.first == 0
|
||||
pass = rc[1]
|
||||
else
|
||||
exit_with_code *rc
|
||||
pass = ""
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,7 +151,8 @@ public class User extends PoolElement{
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The user id (uid) of the target user we want to modify.
|
||||
* @param auth The new auth driver.
|
||||
* @param password The new password.
|
||||
* @param password The new password. If it is an empty string,
|
||||
* the user password is not changed
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse chauth(Client client,
|
||||
@ -229,7 +230,8 @@ public class User extends PoolElement{
|
||||
* Changes the auth driver and the password of the given user
|
||||
*
|
||||
* @param auth The new auth driver.
|
||||
* @param password The new password.
|
||||
* @param password The new password. If it is an empty string,
|
||||
* the user password is not changed
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse chauth(String auth, String password)
|
||||
@ -237,6 +239,17 @@ public class User extends PoolElement{
|
||||
return chauth(client, id, auth, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the auth driver of the given user
|
||||
*
|
||||
* @param auth The new auth driver.
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse chauth(String auth)
|
||||
{
|
||||
return chauth(auth, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the user template contents.
|
||||
*
|
||||
|
@ -119,10 +119,11 @@ module OpenNebula
|
||||
# Changes the auth driver and the password of the given User
|
||||
#
|
||||
# @param auth [String] the new auth driver
|
||||
# @param password [String] the new password
|
||||
# @param password [String] the new password. If it is an empty string,
|
||||
# the user password is not changed
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
# otherwise
|
||||
def chauth(auth, password)
|
||||
def chauth(auth, password="")
|
||||
return Error.new('ID not defined') if !@pe_id
|
||||
|
||||
rc = @client.call(USER_METHODS[:chauth],@pe_id, auth, password)
|
||||
|
@ -88,15 +88,18 @@ int UserChangeAuth::user_action(User * user,
|
||||
string new_auth = xmlrpc_c::value_string(paramList.getString(2));
|
||||
string new_pass = xmlrpc_c::value_string(paramList.getString(3));
|
||||
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
if (new_auth == UserPool::CORE_AUTH)
|
||||
if ( !new_pass.empty() )
|
||||
{
|
||||
new_pass = SSLTools::sha1_digest(new_pass);
|
||||
}
|
||||
if ( new_auth == UserPool::CORE_AUTH)
|
||||
{
|
||||
new_pass = SSLTools::sha1_digest(new_pass);
|
||||
}
|
||||
|
||||
// The password may be invalid, try to change it first
|
||||
rc = user->set_password(new_pass, error_str);
|
||||
// The password may be invalid, try to change it first
|
||||
rc = user->set_password(new_pass, error_str);
|
||||
}
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user