Hi,

In <1177410494.1808491226769419255.JavaMail.root / zcs10>
  "Re: Active Directory access - not just users, but computers too" on Sun, 16 Nov 2008 02:14:42 +0900,
  Matt Mencel <MR-Mencel / wiu.edu> wrote:

> I know you from the ActiveLdap list and probably should have asked my question there first.  :)  My AD server requires secure LDAP so I have to use 636.
> 
> 
> >>>ad.rb<<<
> 
> require 'myconstants'
> 
> class AdUser < ActiveLdap::Base
>   ldap_mapping :dn_attribute => 'sAMAccountName', :prefix => 'dc=ad',
>   				:classes => ['top','person','user']
> end
> 
> class AdGroup < ActiveLdap::Base
>   ldap_mapping :dn_attribute => 'cn', :prefix => '',
>                :classes => ['top','group']
> end
> 
> ActiveLdap::Base.establish_connection(:host => 'ldap.dom.edu',
>                          :port => 636,
>                          :base => 'dc=dom,dc=edu',
>                          :bind_dn => AdAdmin, 
>                          :password => AdPW,
>                          :allow_anonymous => false )
> 
> # Retrieve all users with some attribute
> def ad_user_search(attribute, value, returns)
>   AdUser.find(
>     :all,
>     :attribute => attribute,
>     :value => value,
>     :attributes => returns
>   )
> end
> 
> 
> >>>test.rb<<<
> 
> #!/usr/local/bin/ruby
> 
> 
> # NOTE...RUBY TIME CLASS MAY BE FASTER THAN DATE CLASS???
> $LOAD_PATH << '../dom_ruby_libs'
> require 'rubygems'
> require 'active_ldap'
> require 'ad'
> require 'myconstants'
> 
> puts "===AD==="
> ad_user = ad_user_search('sAMAccountName', 'myusername', ['cn','sn'])
> ad_user.each do |user|
>   puts user.inspect
> end

It seems that you miss :method => :ssl option in
establish_connection options. And did you get what error
message?


Thanks,
--
kou