ldb_tdb: Optionally use GUID index values a direct TDB keys
authorAndrew Bartlett <abartlet@samba.org>
Thu, 10 Aug 2017 05:05:37 +0000 (17:05 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:23 +0000 (21:20 +0200)
This connects the GUID based index records to GUID based TDB keys.

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

index a5cd523f3b2cbbc3f7355a2873d7bb55fee6a152..f8d80e9e49069c55dacf6d0039502e342c3c471f 100644 (file)
@@ -256,6 +256,10 @@ TDB_DATA ltdb_idx_to_key(struct ldb_module *module,
        struct ldb_context *ldb = ldb_module_get_ctx(module);
        struct ldb_dn *dn;
 
+       if (ltdb->cache->GUID_index_attribute != NULL) {
+               return ltdb_guid_to_key(module, ltdb, mem_ctx, idx_val);
+       }
+
        dn = ldb_dn_from_ldb_val(mem_ctx, ldb, idx_val);
        if (dn == NULL) {
                errno = EINVAL;