[SSSD] [PATCH] sysdb_set_entry_attr: dump attributes and values on error
Sumit Bose
sbose at redhat.com
Mon Mar 9 09:13:54 UTC 2015
Hi,
this is a patch I have in my tree for some time for debugging purposes.
Recently I've seen some bug reports with "ldb_modify failed" messages in
the logs and I think this patch might help in those cases.
Additionally I wonder if SSSDBG_MINOR_FAILURE is a suitable debug level
here. In most cases an error here prevents a user or group object to be
written to the cache, so maybe SSSDBG_CRIT_FAILURE is justified here?
bye,
Sumit
-------------- next part --------------
From b4f3aeeb14b3b79126890b7075c07a1c799b967b Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 21 Jan 2015 11:05:23 +0100
Subject: [PATCH] sysdb_set_entry_attr: dump attributes and values on error
---
src/db/sysdb_ops.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 6085762dcc5585114dd3049dd3a365856cb6b190..d659244cd6ad3ec5341c51cf9647b3c2e3d30443 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -671,6 +671,7 @@ int sysdb_set_entry_attr(struct sysdb_ctx *sysdb,
struct ldb_message *msg;
int i, ret;
int lret;
+ size_t c;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_new(NULL);
@@ -708,6 +709,16 @@ int sysdb_set_entry_attr(struct sysdb_ctx *sysdb,
if (lret != LDB_SUCCESS) {
DEBUG(SSSDBG_MINOR_FAILURE,
"ldb_modify failed: [%s]\n", ldb_strerror(lret));
+ if (DEBUG_IS_SET(SSSDBG_MINOR_FAILURE)) {
+ for (i = 0; i < msg->num_elements; i++) {
+ DEBUG(SSSDBG_MINOR_FAILURE, "Name: [%s].\n",
+ msg->elements[i].name);
+ for (c = 0; c < msg->elements[i].num_values; c++) {
+ DEBUG(SSSDBG_MINOR_FAILURE, " Value[%u]: [%s].\n",
+ c, msg->elements[i].values[c].data);
+ }
+ }
+ }
}
ret = sysdb_error_to_errno(lret);
--
2.1.0
More information about the sssd-devel
mailing list