return ldb_module_oom(module);
}
- /* 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;
+ if (ltdb->cache->GUID_index_attribute == NULL) {
+ /* 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)) {
+ /* 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 {
+ /* Look in the index to find the key for this DN */
+ ret = ltdb_key_dn_from_idx(module, ltdb, tdb_key_ctx,
+ dn, &tdb_key);
+ if (ret != LDB_SUCCESS) {
+ TALLOC_FREE(tdb_key_ctx);
+ return ret;
+ }
}
ret = ltdb_search_key(module, ltdb, tdb_key, msg, unpack_flags);