[Freeipa-devel] [PATCH] 0148: ipa-sam: when deleting subtree, deal with possible LDAP errors
Alexander Bokovoy
abokovoy at redhat.com
Tue Mar 11 14:32:58 UTC 2014
Hi,
after discussing with Petr Spacek, following patch fixes ticket 4224.
--
/ Alexander Bokovoy
-------------- next part --------------
>From 83803494757e078c3a2850ddbb5eb886fd067dd1 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Tue, 11 Mar 2014 16:28:12 +0200
Subject: [PATCH 3/3] ipa-sam: when deleting subtree make sure to deal with
LDAP failures
https://fedorahosted.org/freeipa/ticket/4224
---
daemons/ipa-sam/ipa_sam.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
index 1ca504d..7a8eeb4 100644
--- a/daemons/ipa-sam/ipa_sam.c
+++ b/daemons/ipa-sam/ipa_sam.c
@@ -2456,10 +2456,16 @@ static int delete_subtree(struct ldapsam_privates *ldap_state, char* dn)
rc = smbldap_search(ldap_state->smbldap_state, dn, scope, filter, NULL, 0, &result);
TALLOC_FREE(filter);
- if (result != NULL) {
- smbldap_talloc_autofree_ldapmsg(dn, result);
+ if (rc != LDAP_SUCCESS) {
+ return rc;
}
+ if (result == NULL) {
+ return LDAP_NO_MEMORY;
+ }
+
+ smbldap_talloc_autofree_ldapmsg(dn, result);
+
for (entry = ldap_first_entry(state, result);
entry != NULL;
entry = ldap_next_entry(state, entry)) {
@@ -2467,6 +2473,9 @@ static int delete_subtree(struct ldapsam_privates *ldap_state, char* dn)
/* remove child entries */
if ((entry_dn != NULL) && (strcmp(entry_dn, dn) != 0)) {
rc = smbldap_delete(ldap_state->smbldap_state, entry_dn);
+ if (rc != LDAP_SUCCESS) {
+ return rc;
+ }
}
}
rc = smbldap_delete(ldap_state->smbldap_state, dn);
--
1.8.3.1
More information about the Freeipa-devel
mailing list