ldb_tdb: Give a good error message on add without an objectGUID
authorAndrew Bartlett <abartlet@samba.org>
Sat, 2 Sep 2017 04:19:39 +0000 (16:19 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:24 +0000 (21:20 +0200)
(or whatever the @IDX_GUID value is)

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

index dc3aa46bfb0a38f55d05fd0cb65ec255aefe8402..16e4b8ea26e8eef67e3faba993444ce947e8b1c3 100644 (file)
@@ -303,6 +303,12 @@ TDB_DATA ltdb_key_msg(struct ldb_module *module, TALLOC_CTX *mem_ctx,
        guid_val = ldb_msg_find_ldb_val(msg,
                                       ltdb->cache->GUID_index_attribute);
        if (guid_val == NULL) {
+               ldb_asprintf_errstring(ldb_module_get_ctx(module),
+                                      "Did not find GUID attribute %s "
+                                      "in %s, required for TDB record "
+                                      "key in " LTDB_IDXGUID " mode.",
+                                      ltdb->cache->GUID_index_attribute,
+                                      ldb_dn_get_linearized(msg->dn));
                errno = EINVAL;
                key.dptr = NULL;
                key.dsize = 0;