Issue 9497 - update debug logging in ipa_otp_counter

Fixes: https://pagure.io/freeipa/issue/9497

Signed-off-by: Mark Reynolds <mreynolds@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Mark Reynolds 2023-12-12 08:39:47 -05:00 committed by Florence Blanc-Renaud
parent 79b08556a4
commit 2a1d454c74
2 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@
* Authors:
* Nathaniel McCallum <npmccallum@redhat.com>
*
* Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2014-2023 Red Hat, Inc.
* All rights reserved.
* END COPYRIGHT BLOCK **/
@ -295,14 +295,16 @@ preop_mod(Slapi_PBlock *pb)
}
if (!simulate(mods, attr, cpre, &cpost) && repl == 0) {
msg = slapi_ch_smprintf("Invalid operation sequence on %s", attr);
msg = slapi_ch_smprintf("Invalid operation sequence on %s (%s)",
attr, slapi_entry_get_dn_const(epre));
goto error;
}
if (cpost < cpre) {
if (repl == 0) {
msg = slapi_ch_smprintf("Will not %s %s",
cpost == COUNTER_UNSET ? "delete" : "decrement", attr);
msg = slapi_ch_smprintf("Will not %s %s (%s)",
cpost == COUNTER_UNSET ? "delete" : "decrement",
attr, slapi_entry_get_dn_const(epre));
goto error;
}
@ -321,6 +323,9 @@ preop_mod(Slapi_PBlock *pb)
error:
rc = LDAP_UNWILLING_TO_PERFORM;
if (msg) {
LOG("%s - error %d\n", msg, rc);
}
slapi_send_ldap_result(pb, rc, NULL, msg, 0, NULL);
if (slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc)) {
LOG_FATAL("slapi_pblock_set failed!\n");

View File

@ -33,7 +33,7 @@
* Authors:
* Nathaniel McCallum <npmccallum@redhat.com>
*
* Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2014-2023 Red Hat, Inc.
* All rights reserved.
* END COPYRIGHT BLOCK **/
@ -41,6 +41,8 @@
#include <slapi-plugin.h>
#define IPA_PLUGIN_NAME "ipa-otp-counter"
long long
ldapmod_get_value(const LDAPMod *mod, long long def);