summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_init.c
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2017-03-09 12:22:13 +1300
committerAndreas Schneider <asn@cryptomilk.org>2017-03-10 15:34:38 +0100
commit49c9ef641d82fd09faa6a7ce405e5b8aa1aeda69 (patch)
treef4e64efdec0099061d347a04e34f937347603044 /source4/dsdb/schema/schema_init.c
parent3314bf52aaef60ef5cc1110587b53064df7c475d (diff)
downloadsamba-49c9ef641d82fd09faa6a7ce405e5b8aa1aeda69.tar.gz
objectclass_attrs: Remove schema copy shallow from attr_handler2
This appears quite expensive (particularly in provision), and also unnecessary. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Mar 10 15:34:39 CET 2017 on sn-devel-144
Diffstat (limited to 'source4/dsdb/schema/schema_init.c')
-rw-r--r--source4/dsdb/schema/schema_init.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 199ee28053c..256c4677452 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -621,9 +621,15 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
} while (0)
/** Create an dsdb_attribute out of ldb message, attr must be already talloced
+ *
+ * If supplied the attribute will be checked against the prefixmap to
+ * ensure it can be mapped. However we can't have this attribute
+ * const as dsdb_schema_pfm_attid_from_oid calls
+ * dsdb_schema_pfm_make_attid_impl() which may modify prefixmap in
+ * other situations.
*/
-WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
+WERROR dsdb_attribute_from_ldb(struct dsdb_schema_prefixmap *prefixmap,
struct ldb_message *msg,
struct dsdb_attribute *attr)
{
@@ -646,13 +652,13 @@ WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
GET_STRING_LDB(msg, "lDAPDisplayName", attr, attr, lDAPDisplayName, true);
GET_STRING_LDB(msg, "attributeID", attr, attr, attributeID_oid, true);
- if (!schema->prefixmap || schema->prefixmap->length == 0) {
+ if (!prefixmap || prefixmap->length == 0) {
/* set an invalid value */
attr->attributeID_id = DRSUAPI_ATTID_INVALID;
} else {
- status = dsdb_schema_pfm_attid_from_oid(schema->prefixmap,
- attr->attributeID_oid,
- &attr->attributeID_id);
+ status = dsdb_schema_pfm_attid_from_oid(prefixmap,
+ attr->attributeID_oid,
+ &attr->attributeID_id);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("%s: '%s': unable to map attributeID %s: %s\n",
__location__, attr->lDAPDisplayName, attr->attributeID_oid,
@@ -676,11 +682,11 @@ WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
GET_UINT32_LDB(msg, "linkID", attr, linkID);
GET_STRING_LDB(msg, "attributeSyntax", attr, attr, attributeSyntax_oid, true);
- if (!schema->prefixmap || schema->prefixmap->length == 0) {
+ if (!prefixmap || prefixmap->length == 0) {
/* set an invalid value */
attr->attributeSyntax_id = DRSUAPI_ATTID_INVALID;
} else {
- status = dsdb_schema_pfm_attid_from_oid(schema->prefixmap,
+ status = dsdb_schema_pfm_attid_from_oid(prefixmap,
attr->attributeSyntax_oid,
&attr->attributeSyntax_id);
if (!W_ERROR_IS_OK(status)) {
@@ -723,7 +729,7 @@ WERROR dsdb_set_attribute_from_ldb_dups(struct ldb_context *ldb,
return WERR_NOT_ENOUGH_MEMORY;
}
- status = dsdb_attribute_from_ldb(schema, msg, attr);
+ status = dsdb_attribute_from_ldb(schema->prefixmap, msg, attr);
if (!W_ERROR_IS_OK(status)) {
return status;
}