From 966c7febaf0245516481bde924ea6cd738eeb78b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 12 Oct 2018 18:43:25 +0200 Subject: [PATCH] s4:repl_meta_data: pass down struct replmd_replicated_request to replmd_modify_handle_linked_attribs() This will simplify further changes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13418 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 584fd2185a2..e5baefc4cb4 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -3120,8 +3120,9 @@ static int replmd_modify_la_replace(struct ldb_module *module, */ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, struct replmd_private *replmd_private, + struct replmd_replicated_request *ac, struct ldb_message *msg, - uint64_t seq_num, time_t t, + time_t t, struct ldb_request *parent) { struct ldb_result *res; @@ -3130,8 +3131,6 @@ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, struct ldb_context *ldb = ldb_module_get_ctx(module); struct ldb_message *old_msg; - const struct dsdb_schema *schema; - if (dsdb_functional_level(ldb) == DS_DOMAIN_FUNCTION_2000) { /* * Nothing special is required for modifying or vanishing links @@ -3165,10 +3164,6 @@ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, if (ret != LDB_SUCCESS) { return ret; } - schema = dsdb_get_schema(ldb, res); - if (!schema) { - return LDB_ERR_OPERATIONS_ERROR; - } old_msg = res->msgs[0]; @@ -3177,7 +3172,7 @@ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, struct ldb_message_element *old_el, *new_el; unsigned int mod_type = LDB_FLAG_MOD_TYPE(el->flags); const struct dsdb_attribute *schema_attr - = dsdb_attribute_by_lDAPDisplayName(schema, el->name); + = dsdb_attribute_by_lDAPDisplayName(ac->schema, el->name); if (!schema_attr) { ldb_asprintf_errstring(ldb, "%s: attribute %s is not a valid attribute in schema", @@ -3213,22 +3208,22 @@ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, switch (mod_type) { case LDB_FLAG_MOD_REPLACE: ret = replmd_modify_la_replace(module, replmd_private, - schema, msg, el, old_el, - schema_attr, seq_num, t, + ac->schema, msg, el, old_el, + schema_attr, ac->seq_num, t, old_msg->dn, parent); break; case LDB_FLAG_MOD_DELETE: ret = replmd_modify_la_delete(module, replmd_private, - schema, msg, el, old_el, - schema_attr, seq_num, t, + ac->schema, msg, el, old_el, + schema_attr, ac->seq_num, t, old_msg->dn, parent); break; case LDB_FLAG_MOD_ADD: ret = replmd_modify_la_add(module, replmd_private, - schema, msg, el, old_el, - schema_attr, seq_num, t, + ac->schema, msg, el, old_el, + schema_attr, ac->seq_num, t, old_msg->dn, parent); break; @@ -3500,7 +3495,7 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req) } ret = replmd_modify_handle_linked_attribs(module, replmd_private, - msg, ac->seq_num, t, req); + ac, msg, t, req); if (ret != LDB_SUCCESS) { talloc_free(ac); return ret; -- 2.11.4.GIT