Ciao a tutti
Qualcuno potrebbe aiutami con Net::LDAP?
al replace_attribute mi risponde:
/var/lib/gems/1.8/gems/net-ldap-0.1.1/lib/net/ldap.rb:1502:in `modify’:
response missing or invalid (Net::LDAP::LdapError)
Ecco mio programino per intero.
require ‘rubygems’
require ‘net/ldap’
def cambia_email(ldap,nome,email)
filtro = Net::LDAP::Filter.eq(“cn”,nome)
ldap.search(:base => “dc=example,dc=local”, :filter => filtro){|ut|
p ut[:dn]
p ut[:email]
ldap.replace_attribute ut[:dn], :email, email
p ut[:email]
}
end
ldap = Net::LDAP.new
ldap.host = “192.168.2.6”
ldap.port = 389
ldap.auth “CN=User for Maintenance 2,OU=Other
Users,DC=example,DC=local”, “pass”
if ldap.bind
ldap.open{|ldap|
cambia_email(ldap,“Tom B.”,“[email protected]”)
}
else
puts “Cazzo”
end
Grazie per le risposte