From 4c2656d088ee09c4ee5bc31d4c54b4f43075ce69 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Jun 20 2016 23:00:09 +0000 Subject: Ticket #48892 - Wrong result code display in audit-failure log Bug Description: Although a command line returns an error code 32, audit-failure-log logs -1. Fix Description: In the backend code, if a target entry does not exist, -1 was internally set to ldap_result_code. The code was interpreted to LDAP_NO_SUCH_OBJECT in the frontend before returning to the client. But the audit-failure-log logged the internal code. This patch fixes it. https://fedorahosted.org/389/ticket/48892 Reviewed by wibrown@redhat.com (Thank you, William!!) --- diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c index 088f80c..7eb8fe9 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_add.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c @@ -1339,8 +1339,11 @@ common_return: done_with_pblock_entry(pb,SLAPI_ADD_EXISTING_DN_ENTRY); done_with_pblock_entry(pb,SLAPI_ADD_EXISTING_UNIQUEID_ENTRY); done_with_pblock_entry(pb,SLAPI_ADD_PARENT_ENTRY); - if(ldap_result_code!=-1) - { + if (ldap_result_code == -1) { + /* Reset to LDAP_NO_SUCH_OBJECT*/ + ldap_result_code = LDAP_NO_SUCH_OBJECT; + slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code); + } else { if (not_an_error) { /* This is mainly used by urp. Solved conflict is not an error. * And we don't want the supplier to halt sending the updates. */ diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c index fecd3b8..37225cd 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c @@ -946,8 +946,11 @@ common_return: modify_term(&ruv_c, be); } - if(ldap_result_code!=-1) - { + if (ldap_result_code == -1) { + /* Reset to LDAP_NO_SUCH_OBJECT*/ + ldap_result_code = LDAP_NO_SUCH_OBJECT; + slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code); + } else { if (not_an_error) { /* This is mainly used by urp. Solved conflict is not an error. * And we don't want the supplier to halt sending the updates. */ diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c index fd74d5f..c0cd2ab 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c @@ -1476,8 +1476,11 @@ common_return: modify_term(&ruv_c, be); } - if (ldap_result_code!=-1) - { + if (ldap_result_code == -1) { + /* Reset to LDAP_NO_SUCH_OBJECT*/ + ldap_result_code = LDAP_NO_SUCH_OBJECT; + slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code); + } else { if (not_an_error) { /* This is mainly used by urp. Solved conflict is not an error. * And we don't want the supplier to halt sending the updates. */