From 5902a362b394cdae894173c898aee019177e39f1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 8 Aug 2016 13:02:21 +0200 Subject: [PATCH] s4:dsdb/objectclass_attrs: call dsdb_attribute_from_ldb() without a prefixmap We may not have a prefix mapping for the new attribute definition, it will be added later. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12128 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison (cherry picked from commit fa580f255ca0878b99946cda3f95913ff37f6d54) --- source4/dsdb/samdb/ldb_modules/objectclass_attrs.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c index e051913b2b9..f739c40ac83 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c @@ -437,13 +437,25 @@ static int attr_handler2(struct oc_context *ac) struct dsdb_attribute *att = talloc(ac, struct dsdb_attribute); const struct dsdb_syntax *attrSyntax; WERROR status; + struct dsdb_schema *tmp_schema = NULL; - status= dsdb_attribute_from_ldb(ac->schema, msg, att); + /* + * We temporary remove the prefix map from the schema, + * a new prefix map is added by dsdb_create_prefix_mapping() + * via the "schema_data" module. + */ + tmp_schema = dsdb_schema_copy_shallow(ac, ldb, ac->schema); + if (tmp_schema == NULL) { + return ldb_module_oom(ac->module); + } + TALLOC_FREE(tmp_schema->prefixmap); + status= dsdb_attribute_from_ldb(tmp_schema, msg, att); if (!W_ERROR_IS_OK(status)) { ldb_set_errstring(ldb, "objectclass: failed to translate the schemaAttribute to a dsdb_attribute"); return LDB_ERR_UNWILLING_TO_PERFORM; } + TALLOC_FREE(tmp_schema); attrSyntax = dsdb_syntax_for_attribute(att); if (!attrSyntax) {