Closed francescm closed 11 years ago
@francescm, this problem is fixed in version 0.9.16. Thank you for reporting!
Your example should really look like:
require 'ldap'
require 'ldap/ldif'
mod = LDAP::Mod.new(LDAP::LDAP_MOD_DELETE, "uid", ["malvezzi"])
puts LDAP::LDIF.mods_to_ldif("uid=malvezzi,ou=people,dc=unimore,dc=it" , [ mod ])
because with value ["uid=malvezzi"]
method generates:
dn: uid=malvezzi,ou=people,dc=unimore,dc=it
changetype: modify
delete: uid
uid: uid=malvezzi
where line uid: uid=malvezzi
does not seem to be correct.
Examples of usage can be found in test/tc_ldif.rb#L143 and test/tc_ldif.rb#L163
Cheers
Il 06/09/2013 09:17, Alexey Chebotar ha scritto:
@francescm https://github.com/francescm, this problem is fixed in version 0.9.16. Thank you for reporting!
Your example should really look like:
require 'ldap' require 'ldap/ldif'
mod = LDAP::Mod.new(LDAP::LDAP_MOD_DELETE, "uid", ["malvezzi"]) puts LDAP::LDIF.mods_to_ldif("uid=malvezzi,ou=people,dc=unimore,dc=it" , [ mod ])
oh, yes, sure.
because with value |["uid=malvezzi"]| method generates:
dn: uid=malvezzi,ou=people,dc=unimore,dc=it changetype: modify delete: uid uid: uid=malvezzi where line |uid: uid=malvezzi| does not seem to be correct.
Examples of usage can be found in test/tc_ldif.rb#L143 https://github.com/alexey-chebotar/ruby-ldap/blob/master/test/tc_ldif.rb#L143 and test/tc_ldif.rb#L163 https://github.com/alexey-chebotar/ruby-ldap/blob/master/test/tc_ldif.rb#L163
thank you really and thanks for the test references too,
Francesco
The following code fails with: undefined method `each' for "uid":String (NoMethodError) (ruby-1.9.3-p392)
encoding: utf-8
require 'ldap' require 'ldap/ldif'
mod = LDAP::Mod.new(LDAP::LDAP_MOD_DELETE, "uid", ["uid=malvezzi"]) puts LDAP::LDIF.mods_to_ldif("uid=malvezzi,ou=people,dc=unimore,dc=it" , [ mod ])
Is the correct usage of LDAP::LDIF.mods_to_ldif? If it is, a quick fix would be modify line 508 in ldap/ldif.rb from:
ldif << LDIF.to_ldif( change_type, mod.mod_type )
to
ldif << LDIF.to_ldif( change_type, [ mod.mod_type ])
thank you for your hard work,
Francesco