From 6397c362ace92abb3b17d83b31dd9beb290f4eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 22 Nov 2011 03:33:01 -0800 Subject: [PATCH 1/2] Bug #998: Duplicate the password argument object in oneuser, to avoid frozen string error --- src/cli/one_helper/oneuser_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/one_helper/oneuser_helper.rb b/src/cli/one_helper/oneuser_helper.rb index 48b87abead..187e8f8584 100644 --- a/src/cli/one_helper/oneuser_helper.rb +++ b/src/cli/one_helper/oneuser_helper.rb @@ -37,7 +37,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper return -1, "Can not read file: #{arg}" end else - password = arg + password = arg.dup end if options[:driver] == OpenNebula::User::X509_AUTH From 8153b4d5e67a6ab047cfd6a33758a27d71bcdd82 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 22 Nov 2011 12:08:14 +0100 Subject: [PATCH 2/2] Do not SHA1-hash passwords when creating or passwd-ing users in Sunstone. One Core takes care of it now. (cherry picked from commit d62d57ece67ddf87adcb59000174e0e3f0a02ba4) --- src/sunstone/models/OpenNebulaJSON/UserJSON.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sunstone/models/OpenNebulaJSON/UserJSON.rb b/src/sunstone/models/OpenNebulaJSON/UserJSON.rb index 0fe15fdcc5..726845d23c 100644 --- a/src/sunstone/models/OpenNebulaJSON/UserJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/UserJSON.rb @@ -26,9 +26,9 @@ module OpenNebulaJSON return user_hash end - password = Digest::SHA1.hexdigest(user_hash['password']) - - self.allocate(user_hash['name'], password, user_hash['auth_driver']) + self.allocate(user_hash['name'], + user_hash['password'], + user_hash['auth_driver']) end def perform_action(template_json) @@ -40,7 +40,7 @@ module OpenNebulaJSON rc = case action_hash['perform'] when "passwd" then self.passwd(action_hash['params']) when "chgrp" then self.chgrp(action_hash['params']) - when "chauth" then self.chauth(action_hash['params']) + when "chauth" then self.chauth(action_hash['params']) when "update" then self.update(action_hash['params']) when "addgroup" then self.addgroup(action_hash['params']) when "delgroup" then self.delgroup(action_hash['params']) @@ -52,8 +52,7 @@ module OpenNebulaJSON end def passwd(params=Hash.new) - password = Digest::SHA1.hexdigest(params['password']) - super(password) + super(params['password']) end def chgrp(params=Hash.new)