ldb_tdb: Improve debugging in ltdb_modify_index_dn() on casefold failure
authorAndrew Bartlett <abartlet@samba.org>
Mon, 21 Aug 2017 00:59:50 +0000 (12:59 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:23 +0000 (21:20 +0200)
This is unlikely, but when it happens it will be really painful to debug.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_tdb/ldb_index.c

index ae35cb386e0de0b94b46e5dcba9fc4efb057614a..5eaa5328940db881b4d9bc0448e2233ebdf85914 100644 (file)
@@ -1640,6 +1640,15 @@ static int ltdb_modify_index_dn(struct ldb_module *module,
 
        val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(dn));
        if (val.data == NULL) {
+               const char *dn_str = ldb_dn_get_linearized(dn);
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
+                                      __location__
+                                      ": Failed to modify %s "
+                                      "against %s in %s: failed "
+                                      "to get casefold DN",
+                                      index,
+                                      ltdb->cache->GUID_index_attribute,
+                                      dn_str);
                return LDB_ERR_OPERATIONS_ERROR;
        }