L
Lokesh Agrawal
Hi All,
I have written a scipt.
require 'rubygems'
require 'net/ldap'
require "env_variable.rb"
ldap = Net::LDAP.new :host => '10.44.169.24',
ort => 389,
:auth => {
:method => :simple,
:username => "cn=Manager,dc=ibm,dc=com",
assword => "secret"
}
filter = Net::LDAP::Filter.eq( "mail", $email )
treebase = "dc=ibm,dc=com"
attrs = ["status"]
ldap.search( :base => treebase, :filter => filter, :attributes =>
attrs ) do |entry|
entry.each do |attribute, values|
$i = 1
values.each do |$status|
end
puts $status
end
end
and I am getting output
Inactive
mail=$email,ou=people,o=external,dc=ibm,dc=com
means $status variable is holding text Inactive first time and second
time its value is
mail=$email,ou=people,o=external,dc=ibm,dc=com (first value get
replaced by new value)
I want to take both the values in variable or in array.
Can anyone help me please.
Thanks and Regards
Lokesh Agrawal
I have written a scipt.
require 'rubygems'
require 'net/ldap'
require "env_variable.rb"
ldap = Net::LDAP.new :host => '10.44.169.24',
ort => 389,
:auth => {
:method => :simple,
:username => "cn=Manager,dc=ibm,dc=com",
assword => "secret"
}
filter = Net::LDAP::Filter.eq( "mail", $email )
treebase = "dc=ibm,dc=com"
attrs = ["status"]
ldap.search( :base => treebase, :filter => filter, :attributes =>
attrs ) do |entry|
entry.each do |attribute, values|
$i = 1
values.each do |$status|
end
puts $status
end
end
and I am getting output
Inactive
mail=$email,ou=people,o=external,dc=ibm,dc=com
means $status variable is holding text Inactive first time and second
time its value is
mail=$email,ou=people,o=external,dc=ibm,dc=com (first value get
replaced by new value)
I want to take both the values in variable or in array.
Can anyone help me please.
Thanks and Regards
Lokesh Agrawal