Hello, Fix false error messages when nonexistent object/attribute is deleted.
This patch should go to branches v3 and master. -- Petr^2 Spacek
From cf67953f278ee1dc4d31bbbc99b8ef8fe63ccfa7 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Mon, 29 Jul 2013 11:47:46 +0200 Subject: [PATCH] Fix false error messages when nonexistent object/attribute is deleted. Signed-off-by: Petr Spacek <pspa...@redhat.com> --- src/ldap_helper.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ldap_helper.c b/src/ldap_helper.c index 0b1c67cdd6ae71ae291d145f222846825181bfb3..9a405ec2d335573d8e9baedec5c6dc649baea1e6 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -2757,16 +2757,18 @@ ldap_modify_do(ldap_instance_t *ldap_inst, const char *dn, LDAPMod **mods, &err_code), "ldap_modify_do(add) failed to obtain ldap error code"); operation_str = "adding"; + } else if (delete_node == ISC_TRUE && err_code == LDAP_NO_SUCH_OBJECT) { + /* deleting nonexistent object */ + result = ISC_R_SUCCESS; + } else if ((mods[0]->mod_op & ~LDAP_MOD_BVALUES) == LDAP_MOD_DELETE && + err_code == LDAP_NO_SUCH_ATTRIBUTE) { + /* deleting nonexistent attribute */ + result = ISC_R_SUCCESS; } - log_ldap_error(ldap_conn->handle, "while %s entry '%s'", operation_str, dn); + if (result != ISC_R_SUCCESS) + log_ldap_error(ldap_conn->handle, "while %s entry '%s'", operation_str, dn); - /* do not error out if we are trying to delete an - * unexisting attribute */ - if ((mods[0]->mod_op & ~LDAP_MOD_BVALUES) != LDAP_MOD_DELETE || - err_code != LDAP_NO_SUCH_ATTRIBUTE) { - result = ISC_R_FAILURE; - } cleanup: ldap_pool_putconnection(ldap_inst->pool, &ldap_conn); -- 1.8.3.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel