ruby-net-ldap icon indicating copy to clipboard operation
ruby-net-ldap copied to clipboard

Cant modify - Silent failure

Open kochd opened this issue 7 years ago • 1 comments

Code:

...

# Find a element
found = (LDAP.search :filter => (Net::LDAP::Filter.eq("cn", "OLDCN"))).first                                                                                                                                                                    

# Replace its CN
p LDAP.replace_attribute(found.dn, :cn, "NEWCN")                                                                                                                                                                                          

# Search by old CN
p (LDAP.search :filter => (Net::LDAP::Filter.eq("cn", "OLDCN"))).first                                                                                                                                                                          

# => Found it again

Output:

false
#<Net::LDAP::Entry:0x0000000101fd28 @myhash={:dn=>["CN=OLDCN,...]

There is no error. Nothing was stored apparently. This is either a bug or it should tell me that i am doing something wrong.

kochd avatar Dec 21 '17 11:12 kochd

I had a similar issue after a call to .add, and found I had to inspect LDAP.get_operation_result to detect errors. If LDAP.get_operation_result.code > 0, there's normally a useful message in LDAP.get_operation_result.message (http://www.rubydoc.info/gems/ruby-net-ldap/Net/LDAP:get_operation_result)

WillRochaThomas avatar Feb 13 '18 18:02 WillRochaThomas