On Jun 6, 2011, at 2:44 PM, Francesco Vollero wrote:

ACK.

(Tested using RHEV-M 2.2)

  -- Michal

> This patch is to fix a problem with Base64.b64encode for credentials in RHEVM 
> driver, due to a wrong way in pack to add \n every 60 chars i had to use this 
> hack.
> The issue is not present in Ruby 1.9.x in fact they use a method called 
> strict_encode64() that is the same as my hack.
> 
> 
> Signed-off-by: Francesco Vollero <[email protected]>
> ---
> .../lib/deltacloud/drivers/rhevm/rhevm_client.rb   |    4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb 
> b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> index 5d28b3d..80f5a91 100644
> --- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> +++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> @@ -150,7 +150,9 @@ module RHEVM
>     end
> 
>     def auth_header
> -      { :authorization => "Basic " + 
> Base64.encode64("#{@credentials[:username]}:#{@credentials[:password]}"), }
> +      # As RDOC says this is the function for strict_encode64:
> +      encoded_credentials = 
> ["#{@credentials[:username]}:#{@credentials[:password]}"].pack("m0").gsub(/\n/,'')
> +      { :authorization => "Basic " + encoded_credentials }
>     end
> 
>     def base_url
> --
> 1.7.4.1
> 

------------------------------------------------------
Michal Fojtik, [email protected]
Deltacloud API: http://deltacloud.org

Reply via email to