google-code-export / ruby-activeldap

Automatically exported from code.google.com/p/ruby-activeldap
Other
1 stars 1 forks source link

Delete entry found with :base => '' returns error because of trailing comma in user dn #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am attempting to .destroy an entry found with activeldap (currently trunk).

>> require 'active_ldap'
=> []
>> @user = User.find(:first,:base=>'',:scope => :sub, :filter =>"(uid=mike)")
=> #<User .......>
>> @user.destroy
ActiveLdap::DeleteError: Failed to delete LDAP entry: 
uid=mike,ou=People,dc=example,dc=com
    from /rails_root/vendor/activeldap-trunk/lib/active_ldap/base.rb:728:in 
`destroy_without_callbacks'
    from /Library/Ruby/Gems/1.8/gems/activerecord-
2.1.2/lib/active_record/callbacks.rb:289:in `destroy'
    from (irb):3

When I do a log of it in my application, I notice there is the following LDAP 
error:

LDAP: search (1.0ms): {:base=>"", :filter=>"objectClass=*", :scope=>:base, 
:attributes=>["subschemaSubentry"]}
  LDAP: search (35.3ms): {:base=>"cn=Subschema", :filter=>"(objectClass=subschema)", 
:scope=>:base, :attributes=>["objectClasses", "attributeTypes", 
"matchingRules", 
"matchingRuleUse", "dITStructureRules", "dITContentRules", "nameForms", 
"ldapSyntaxes"]}
  LDAP: delete: FAILED (0.0ms): {:error_message=>"Invalid DN syntax", 
:dn=>"uid=mike,ou=People,dc=example,dc=com,", :error=>"LDAP::ResultError"}

Note, the trailing comma in the DN it is attempting to delete.  I have been 
able to add and edit 
entries successfully.

This is the latest activeldap-trunk version.

# svn up

Fetching external item into 'activeldap-trunk'

Fetching external item into 'activeldap-trunk/test-unit'
External at revision 185.

At revision 799.
At revision 506.

Thanks very much for the help.  I very much appreciate it.

Original issue reported on code.google.com by michael....@gmail.com on 15 Jan 2009 at 8:41

GoogleCodeExporter commented 9 years ago
Thanks for reporting.
I've fixed it in trunk.

Original comment by kou...@gmail.com on 16 Jan 2009 at 3:22

GoogleCodeExporter commented 9 years ago
Thanks for fixing this.  I've tested it in trunk and it works for me.

Original comment by michael....@gmail.com on 21 Jan 2009 at 2:01