ldb_tdb: Combine identical not GUID index and special DN cases
authorGary Lockyer <gary@catalyst.net.nz>
Mon, 26 Feb 2018 21:01:38 +0000 (10:01 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 3 Mar 2018 04:20:35 +0000 (05:20 +0100)
Fold together two identical cases to simplify the code.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_tdb/ldb_search.c

index 0af230f219bc17772818d77969a4cc1fcc92680b..d8bf865e78592aa261e0cfad5ea244df9834a058 100644 (file)
@@ -292,19 +292,9 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes
        };
        TALLOC_CTX *tdb_key_ctx = NULL;
 
-       if (ltdb->cache->GUID_index_attribute == NULL) {
-               tdb_key_ctx = talloc_new(msg);
-               if (!tdb_key_ctx) {
-                       return ldb_module_oom(module);
-               }
+       if (ltdb->cache->GUID_index_attribute == NULL ||
+               ldb_dn_is_special(dn)) {
 
-               /* form the key */
-               tdb_key = ltdb_key_dn(module, tdb_key_ctx, dn);
-               if (!tdb_key.dptr) {
-                       TALLOC_FREE(tdb_key_ctx);
-                       return LDB_ERR_OPERATIONS_ERROR;
-               }
-       } else if (ldb_dn_is_special(dn)) {
                tdb_key_ctx = talloc_new(msg);
                if (!tdb_key_ctx) {
                        return ldb_module_oom(module);