1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

dsdb: Set that Samba uses the GUID index in LDB

This is optional, but only to aid the downgrade script (and in case
there is some major issue found with it).  We don't support that mode,
as that would require us to test and maintain multiple code paths and
not optimise queries to be GUID centric.

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:58:57 +12:00
parent a205369697
commit effac54893

View File

@ -69,9 +69,16 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb,
struct ldb_message *msg; struct ldb_message *msg;
struct ldb_message *msg_idx; struct ldb_message *msg_idx;
struct loadparm_context *lp_ctx =
talloc_get_type(ldb_get_opaque(ldb, "loadparm"),
struct loadparm_context);
/* setup our own attribute name to schema handler */ /* setup our own attribute name to schema handler */
ldb_schema_attribute_set_override_handler(ldb, dsdb_attribute_handler_override, schema); ldb_schema_attribute_set_override_handler(ldb, dsdb_attribute_handler_override, schema);
ldb_schema_set_override_indexlist(ldb, true); ldb_schema_set_override_indexlist(ldb, true);
if (lp_ctx == NULL ||
lpcfg_parm_bool(lp_ctx, NULL, "dsdb", "guid index", true)) {
ldb_schema_set_override_GUID_index(ldb, "objectGUID", "GUID");
}
if (!write_indices_and_attributes) { if (!write_indices_and_attributes) {
return ret; return ret;
@ -108,6 +115,18 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb,
goto op_error; goto op_error;
} }
if (lp_ctx == NULL ||
lpcfg_parm_bool(lp_ctx, NULL, "dsdb", "guid index", true)) {
ret = ldb_msg_add_string(msg_idx, "@IDXGUID", "objectGUID");
if (ret != LDB_SUCCESS) {
goto op_error;
}
ret = ldb_msg_add_string(msg_idx, "@IDX_DN_GUID", "GUID");
if (ret != LDB_SUCCESS) {
goto op_error;
}
}
ret = ldb_msg_add_string(msg_idx, "@IDXVERSION", SAMDB_INDEXING_VERSION); ret = ldb_msg_add_string(msg_idx, "@IDXVERSION", SAMDB_INDEXING_VERSION);
if (ret != LDB_SUCCESS) { if (ret != LDB_SUCCESS) {