Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'net/ldap' # gem install ruby-net-ldap
- dn = "cn=#{ARGV[0]},cn=Users,dc=shared,dc=hosting,dc=local"
- ldap = Net::LDAP.new :host => '172.29.16.18',
- :port => 389,
- :auth => { :method => :simple, :username => dn, :password => ARGV[1] }
- puts "Binding: dn= '#{dn}' with password '#{ARGV[1]}'..."
- if ldap.bind
- puts "LDAP Bind sucessful."
- exit 0
- else
- puts "Result: #{ldap.get_operation_result.code}"
- puts "Message: #{ldap.get_operation_result.message}"
- exit -1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement