mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
parent
ad9b493789
commit
9a34feec87
@ -33,6 +33,9 @@ require 'scripts_common'
|
||||
require 'OpenNebulaDriver'
|
||||
require 'getoptlong'
|
||||
require 'shellwords'
|
||||
require 'uri'
|
||||
|
||||
URI_PARSER=URI::Parser.new
|
||||
|
||||
# This is a generic AuthZ/AuthN driver able to manage multiple authentication
|
||||
# protocols (simultaneosly). It also supports the definition of custom
|
||||
@ -111,8 +114,8 @@ class AuthDriver < OpenNebulaDriver
|
||||
authN_path = File.join(@local_scripts_path, driver)
|
||||
|
||||
command = File.join(authN_path, ACTION[:authN].downcase)
|
||||
command << ([user, password, secret].map do |p|
|
||||
Shellwords.escape(p)
|
||||
command << ' ' << ([user, password, secret].map do |p|
|
||||
Shellwords.escape(URI_PARSER.unescape(p))
|
||||
end.join(' '))
|
||||
|
||||
rc = LocalCommand.run(command, log_method(request_id))
|
||||
|
@ -29,8 +29,10 @@ end
|
||||
$: << RUBY_LIB_LOCATION
|
||||
|
||||
require 'yaml'
|
||||
require 'uri'
|
||||
require 'ldap_auth'
|
||||
require 'uri'
|
||||
|
||||
URI_PARSER=URI::Parser.new
|
||||
|
||||
user=ARGV[0]
|
||||
pass=ARGV[1]
|
||||
@ -77,8 +79,9 @@ begin
|
||||
end
|
||||
|
||||
if ldap.authenticate(user_name, secret)
|
||||
escaped_user=URI.escape(user_name, " \t\n\v\f\r")
|
||||
puts "ldap #{user} #{escaped_user}"
|
||||
escaped_user=URI_PARSER.escape(user_name)
|
||||
escaped_secret=URI_PARSER.escape(secret)
|
||||
puts "ldap #{escaped_user} #{escaped_secret}"
|
||||
authenticated=true
|
||||
break
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user