K
kang cao
hi:
I am using ruby-ldap to connect with windows AD. but when I bind,it
alway gives me "Cann't contact LDAP Server". my code is:
require 'rubygems'
require 'ldap'
begin
ldap_host = '172.17.20.191'
ldap_port = 636
ldap_conn = LDAP::SSLConn.new(ldap_host,ldap_port)
puts "trace 2 ldap_conn: #{ldap_conn.class}"
ldap_conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
puts "trace 3 ldap_conn: #{ldap_conn.class}"
bind_dn = "cn=altirisadmin,ou=Golden-Altiris,dc=autonavi,dc=com"
password_dn = "Altirisadmin"
ldap_conn.bind(bind_dn,password_dn){ ldap_conn.perror("bind")}
puts "trace 4 ldap_conn: #{ldap_conn.class}"
rescue
puts "trace 5 oops, #{$!}"
end
I have alreay tried ldapsearch. it does work but ruby-ldap doesn't.
my system is centos 5.4 x64. ruby is "ruby 1.8.7 (2011-02-18 patchlevel
334) [x86_64-linux]". openldap was installed by yum and the version is
0.9.11.
I also tried to install openldap by downloadng source code and
compilering them. but it still gives me same answer.
I am using ruby-ldap to connect with windows AD. but when I bind,it
alway gives me "Cann't contact LDAP Server". my code is:
require 'rubygems'
require 'ldap'
begin
ldap_host = '172.17.20.191'
ldap_port = 636
ldap_conn = LDAP::SSLConn.new(ldap_host,ldap_port)
puts "trace 2 ldap_conn: #{ldap_conn.class}"
ldap_conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
puts "trace 3 ldap_conn: #{ldap_conn.class}"
bind_dn = "cn=altirisadmin,ou=Golden-Altiris,dc=autonavi,dc=com"
password_dn = "Altirisadmin"
ldap_conn.bind(bind_dn,password_dn){ ldap_conn.perror("bind")}
puts "trace 4 ldap_conn: #{ldap_conn.class}"
rescue
puts "trace 5 oops, #{$!}"
end
I have alreay tried ldapsearch. it does work but ruby-ldap doesn't.
my system is centos 5.4 x64. ruby is "ruby 1.8.7 (2011-02-18 patchlevel
334) [x86_64-linux]". openldap was installed by yum and the version is
0.9.11.
I also tried to install openldap by downloadng source code and
compilering them. but it still gives me same answer.