https://bugs.openldap.org/show_bug.cgi?id=9737
Issue ID: 9737 Summary: ldapdelete unable to prune LDAP subentries Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: client tools Assignee: bugs@openldap.org Reporter: neuroc0der@gmail.com Target Milestone: ---
ldapdelete has a builtin capability to prune LDAP subentries (RFC 3672) by utilizing LDAP subentries control when tracking children however currently that logic does not work in the code and pruning always fails with 66 / 'not allowed on non-leaf'. the test case for this is a normal parent entry which has LDAP subentry type children underneath. the patch below addresses this issue.
From ba29cbf20804d1c73cc0b5ab16549c4faba75a9e Mon Sep 17 00:00:00 2001 From: Anton Bobrov antbob@users.noreply.github.com Date: Thu, 4 Nov 2021 17:27:34 +0100 Subject: [PATCH] ldapdelete unable to prune LDAP subentries
--- clients/tools/ldapdelete.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 8aa8e8c12..1a93aaadf 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -279,8 +279,13 @@ retry:; }
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, &ctrls, 1 ); + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n", + prog, ldap_err2string( rc ), rc ); + return rc; + }
- switch ( rc ) { + switch ( code ) { case LDAP_SUCCESS: break;
@@ -292,9 +297,7 @@ retry:; /* fallthru */
default: - fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n", - prog, ldap_err2string( rc ), rc ); - return rc; + break; }
if( code != LDAP_SUCCESS ) {
https://bugs.openldap.org/show_bug.cgi?id=9737
--- Comment #1 from neuroc0der@gmail.com --- I, Anton Bobrov, hereby place the following modifications to OpenLDAP Software (and only these modifications) into the public domain. Hence, these modifications may be freely used and/or redistributed for any purpose with or without attribution and/or other notice.
https://bugs.openldap.org/show_bug.cgi?id=9737
--- Comment #2 from neuroc0der@gmail.com --- Created attachment 852 --> https://bugs.openldap.org/attachment.cgi?id=852&action=edit patch
https://bugs.openldap.org/show_bug.cgi?id=9737
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.6.1 Keywords|needs_review | Assignee|bugs@openldap.org |hyc@openldap.org
https://bugs.openldap.org/show_bug.cgi?id=9737
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.6.1 |2.6.2
https://bugs.openldap.org/show_bug.cgi?id=9737
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |IN_PROGRESS Ever confirmed|0 |1
--- Comment #3 from Howard Chu hyc@openldap.org --- (In reply to neuroc0der from comment #2)
Created attachment 852 [details] patch
Thanks, looks good. https://git.openldap.org/openldap/openldap/-/merge_requests/503
https://bugs.openldap.org/show_bug.cgi?id=9737
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|IN_PROGRESS |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Quanah Gibson-Mount quanah@openldap.org --- head:
• 252a7dbb by Anton Bobrov at 2022-03-21T16:37:08+00:00 ITS#9737 ldapdelete unable to prune LDAP subentries
RE26:
• 99e6c70e by Anton Bobrov at 2022-03-21T17:49:27+00:00 ITS#9737 ldapdelete unable to prune LDAP subentries
https://bugs.openldap.org/show_bug.cgi?id=9737
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED