From: Stefan Metzmacher Date: Mon, 8 Aug 2016 11:02:21 +0000 (+0200) Subject: s4:dsdb/objectclass_attrs: call dsdb_attribute_from_ldb() without a prefixmap X-Git-Tag: tevent-0.9.30~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa580f255ca0878b99946cda3f95913ff37f6d54;p=thirdparty%2Fsamba.git 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 --- 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; - - status= dsdb_attribute_from_ldb(ac->schema, msg, att); + struct dsdb_schema *tmp_schema = NULL; + + /* + * 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) {