1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

ldb_tdb: Read from @INDEXLIST or an override if we are using a GUID index

This allows all the previous patches to be enabled.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2017-08-15 15:57:57 +12:00
parent 2f8a8c765f
commit 50f36e4fb5
4 changed files with 43 additions and 0 deletions

View File

@ -395,3 +395,17 @@ void ldb_schema_set_override_indexlist(struct ldb_context *ldb,
ldb->schema.index_handler_override = true;
ldb->schema.one_level_indexes = one_level_indexes;
}
/*
* set that the GUID index mode is in operation
*
* The caller must ensure the supplied strings do not go out of
* scope (they are typically constant memory).
*/
void ldb_schema_set_override_GUID_index(struct ldb_context *ldb,
const char *GUID_index_attribute,
const char *GUID_index_dn_component)
{
ldb->schema.GUID_index_attribute = GUID_index_attribute;
ldb->schema.GUID_index_dn_component = GUID_index_dn_component;
}

View File

@ -183,6 +183,22 @@ void ldb_schema_attribute_set_override_handler(struct ldb_context *ldb,
void ldb_schema_set_override_indexlist(struct ldb_context *ldb,
bool one_level_indexes);
/**
\param ldb The ldb context
\param GUID_index_attribute The globally attribute (eg objectGUID)
on each entry
\param GUID_index_attribute The DN component matching the
globally attribute on each entry (eg GUID)
The caller must ensure the supplied strings do not go out of
scope (they are typically constant memory).
*/
void ldb_schema_set_override_GUID_index(struct ldb_context *ldb,
const char *GUID_index_attribute,
const char *GUID_index_dn_component);
/* A useful function to build comparison functions with */
int ldb_any_comparison(struct ldb_context *ldb, void *mem_ctx,
ldb_attr_handler_t canonicalise_fn,

View File

@ -98,6 +98,9 @@ struct ldb_schema {
*/
bool index_handler_override;
bool one_level_indexes;
const char *GUID_index_attribute;
const char *GUID_index_dn_component;
};
/*

View File

@ -243,6 +243,10 @@ static int ltdb_index_load(struct ldb_module *module,
*/
ltdb->cache->attribute_indexes = true;
ltdb->cache->one_level_indexes = ldb->schema.one_level_indexes;
ltdb->cache->GUID_index_attribute
= ldb->schema.GUID_index_attribute;
ltdb->cache->GUID_index_dn_component
= ldb->schema.GUID_index_dn_component;
return 0;
}
@ -276,6 +280,12 @@ static int ltdb_index_load(struct ldb_module *module,
if (ldb_msg_find_element(ltdb->cache->indexlist, LTDB_IDXATTR) != NULL) {
ltdb->cache->attribute_indexes = true;
}
ltdb->cache->GUID_index_attribute
= ldb_msg_find_attr_as_string(ltdb->cache->indexlist,
LTDB_IDXGUID, NULL);
ltdb->cache->GUID_index_dn_component
= ldb_msg_find_attr_as_string(ltdb->cache->indexlist,
LTDB_IDX_DN_GUID, NULL);
return 0;
}