-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the correct way to delete a non-leaf node #407
Comments
You'll have to empty the container first before you can delete it. You can also use the Subtree Delete Control within your delete request to delete all child elements. Lines 533 to 535 in 7d3b8d4
|
@cpuschma Hi , I had use the Subtree Delete Control like this func TestDeleteNonLeafNode(t *testing.T) {
conn, err := ldap.DialURL("ldap://localhost:389")
assert.Nil(t, err)
assert.NotNil(t, conn)
defer conn.Close()
control := make([]ldap.Control, 0)
control = append(control, ldap.NewControlSubtreeDelete())
simpleBindRequest := ldap.NewSimpleBindRequest("cn=admin,dc=example,dc=org", "admin", control)
_, err = conn.SimpleBind(simpleBindRequest)
assert.Nil(t, err)
delReq := ldap.NewDelRequest("o=test,dc=example,dc=org", control)
err = conn.Del(delReq)
t.Log(err)
assert.Nil(t, err)
} but not working |
Can you show the ldap.Error field values? |
Hi, i got same error. |
Just chiming in -- I was able to make the above function work without issues on my test system - subtree deleted 107 entries (not including the parent) on the first try. Before:
For simplicity, I just added the above function to Delete:
After:
|
Which control OID is that? 1.2.840.113556.1.4.805? |
Yes that seems to be correct. I can trace that OID to a
... which indicates my server supports it. |
Hi, I have a non-leaf node in OpenLDAP directory. I want to delete the node. One approach is to delete all the children from the bottom most level in the tree and then finally delete the non-leaf node. Is there any other approach to solve this issue?
When I try to delete the non-leaf node, sends me the following exception:
LDAP Result Code 66 "Not Allowed On Non Leaf": subordinate objects must be deleted first
The text was updated successfully, but these errors were encountered: