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

dsdb: specify attributes when loading schema

The LDB code performs better when the required attributes are listed, even when it is almost
all the attributes

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2016-10-14 15:43:46 +13:00
parent c6c1463852
commit 37395322c5
2 changed files with 62 additions and 4 deletions

View File

@ -278,12 +278,18 @@ static int dsdb_schema_from_db(struct ldb_module *module,
struct ldb_dn *schema_dn = ldb_get_schema_basedn(ldb);
struct ldb_result *schema_res;
struct ldb_result *res;
static const char *schema_attrs[] = {
static const char *schema_head_attrs[] = {
"prefixMap",
"schemaInfo",
"fSMORoleOwner",
NULL
};
static const char *schema_attrs[] = {
DSDB_SCHEMA_COMMON_ATTRS,
DSDB_SCHEMA_ATTR_ATTRS,
DSDB_SCHEMA_CLASS_ATTRS,
NULL
};
unsigned flags;
tmp_ctx = talloc_new(module);
@ -299,7 +305,7 @@ static int dsdb_schema_from_db(struct ldb_module *module,
* setup the prefix mappings and schema info
*/
ret = dsdb_module_search_dn(module, tmp_ctx, &schema_res,
schema_dn, schema_attrs,
schema_dn, schema_head_attrs,
DSDB_FLAG_NEXT_MODULE, NULL);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ldb_reset_err_string(ldb);
@ -314,10 +320,11 @@ static int dsdb_schema_from_db(struct ldb_module *module,
}
/*
* load the attribute definitions
* load the attribute definitions.
*/
ret = dsdb_module_search(module, tmp_ctx, &res,
schema_dn, LDB_SCOPE_ONELEVEL, NULL,
schema_dn, LDB_SCOPE_ONELEVEL,
schema_attrs,
DSDB_FLAG_NEXT_MODULE |
DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT,
NULL,

View File

@ -266,6 +266,57 @@ struct dsdb_schema {
bool resolving_in_progress;
};
#define DSDB_SCHEMA_COMMON_ATTRS \
"objectClass", \
"cn", \
"lDAPDisplayName", \
"schemaIDGUID", \
"objectGUID", \
"systemFlags", \
"schemaFlagsEx", \
"msDs-Schema-Extensions", \
"showInAdvancedViewOnly", \
"adminDisplayName", \
"adminDescription", \
"isDefunct", \
"systemOnly"
#define DSDB_SCHEMA_ATTR_ATTRS \
"attributeID", \
"msDS-IntId", \
"mAPIID", \
"attributeSecurityGUID", \
"searchFlags", \
"isMemberOfPartialAttributeSet", \
"linkID", \
"attributeSyntax", \
"oMSyntax", \
"oMObjectClass", \
"isSingleValued", \
"rangeLower", \
"rangeUpper", \
"extendedCharsAllowed", \
"classDisplayName", \
"isEphemeral"
#define DSDB_SCHEMA_CLASS_ATTRS \
"governsID", \
"objectClassCategory", \
"rDNAttID", \
"defaultObjectCategory", \
"subClassOf", \
"systemAuxiliaryClass", \
"auxiliaryClass", \
"systemMustContain", \
"systemMayContain", \
"mustContain", \
"mayContain", \
"systemPossSuperiors", \
"possSuperiors", \
"defaultSecurityDescriptor", \
"classDisplayName", \
"defaultHidingValue"
enum dsdb_attr_list_query {
DSDB_SCHEMA_ALL_MAY,
DSDB_SCHEMA_ALL_MUST,