Hi All,
I am new to Ruby and doing some automation testing.
I am using Net::LDAP to connect to my ldap server
My script is
require ''rubygems''
require ''net/ldap''
ldap = Net::LDAP.new :host => ''10.44.169.24'',
:port => 389,
:auth => {
:method => :simple,
:username => "cn=Manager,dc=ibm,dc=com",
:password => "secret"
}
#if ldap.bind
#puts ldap.inspect
#else
#puts ldap.get_operation_result.message
#end
filter = Net::LDAP::Filter.eq( "mail",
"lokesh-/E1597aS9LQAvxtiuMwx3w@public.gmane.org" )
treebase = "dc=ibm,dc=com"
attrs = ["userPassword"]
ldap.search( :base => treebase, :filter => filter, :attributes =>
attrs
) do |entry|
entry.each do |attribute, values|
values.each do |value|
puts "#{value}"
end
end
end
I am getting my expected result
i.e.
mail=lokesh-/E1597aS9LQAvxtiuMwx3w@public.gmane.org,ou=people,o=external,dc=ibm,dc=com
lI6z#f5C
Now I want to save the value lI6z#f5C (which is attribute password) and
lokesh-/E1597aS9LQAvxtiuMwx3w@public.gmane.org in to 2 seperate variables say
$passwd and $mail so
that I can use these values for some other purpose.
Can anyone help me how can I do that.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---