s4:repl_meta_data: pass down struct replmd_replicated_request to replmd_modify_la_rep...
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Oct 2018 16:43:25 +0000 (18:43 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 30 Oct 2018 06:30:21 +0000 (07:30 +0100)
This will simplify further changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13418

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 3ce69e06920e4dbfbca7af95b424a8d71ea1d729..5ef5fee6fa2d776e18ed8eddc8142cc8139fdf65 100644 (file)
@@ -2874,12 +2874,11 @@ static int replmd_modify_la_delete(struct ldb_module *module,
  */
 static int replmd_modify_la_replace(struct ldb_module *module,
                                    struct replmd_private *replmd_private,
-                                   const struct dsdb_schema *schema,
+                                   struct replmd_replicated_request *ac,
                                    struct ldb_message *msg,
                                    struct ldb_message_element *el,
                                    struct ldb_message_element *old_el,
                                    const struct dsdb_attribute *schema_attr,
-                                   uint64_t seq_num,
                                    time_t t,
                                    struct ldb_dn *msg_dn,
                                    struct ldb_request *parent)
@@ -2888,7 +2887,6 @@ static int replmd_modify_la_replace(struct ldb_module *module,
        struct parsed_dn *dns, *old_dns;
        TALLOC_CTX *tmp_ctx = talloc_new(msg);
        int ret;
-       const struct GUID *invocation_id;
        struct ldb_context *ldb = ldb_module_get_ctx(module);
        struct ldb_val *new_values = NULL;
        const char *ldap_oid = schema_attr->syntax->ldap_oid;
@@ -2899,11 +2897,6 @@ static int replmd_modify_la_replace(struct ldb_module *module,
 
        unix_to_nt_time(&now, t);
 
-       invocation_id = samdb_ntds_invocation_id(ldb);
-       if (!invocation_id) {
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
        /*
         * The replace operation is unlike the replace and delete cases in that
         * we need to look at every existing link to see whether it is being
@@ -3003,8 +2996,8 @@ static int replmd_modify_la_replace(struct ldb_module *module,
                                ret = replmd_update_la_val(new_values, old_p->v,
                                                           old_p->dsdb_dn,
                                                           old_p->dsdb_dn,
-                                                          invocation_id,
-                                                          seq_num, seq_num,
+                                                          &ac->our_invocation_id,
+                                                          ac->seq_num, ac->seq_num,
                                                           now, true);
                                if (ret != LDB_SUCCESS) {
                                        talloc_free(tmp_ctx);
@@ -3012,7 +3005,7 @@ static int replmd_modify_la_replace(struct ldb_module *module,
                                }
 
                                ret = replmd_add_backlink(module, replmd_private,
-                                                         schema, 
+                                                         ac->schema,
                                                          msg_dn,
                                                          &old_p->guid, false,
                                                          schema_attr,
@@ -3037,8 +3030,8 @@ static int replmd_modify_la_replace(struct ldb_module *module,
                        ret = replmd_update_la_val(new_values, old_p->v,
                                                   new_p->dsdb_dn,
                                                   old_p->dsdb_dn,
-                                                  invocation_id,
-                                                  seq_num, seq_num,
+                                                  &ac->our_invocation_id,
+                                                  ac->seq_num, ac->seq_num,
                                                   now, false);
                        if (ret != LDB_SUCCESS) {
                                talloc_free(tmp_ctx);
@@ -3048,7 +3041,7 @@ static int replmd_modify_la_replace(struct ldb_module *module,
                        rmd_flags = dsdb_dn_rmd_flags(old_p->dsdb_dn->dn);
                        if ((rmd_flags & DSDB_RMD_FLAG_DELETED) != 0) {
                                ret = replmd_add_backlink(module, replmd_private,
-                                                         schema, 
+                                                         ac->schema,
                                                          msg_dn,
                                                          &new_p->guid, true,
                                                          schema_attr,
@@ -3070,14 +3063,14 @@ static int replmd_modify_la_replace(struct ldb_module *module,
                        ret = replmd_build_la_val(new_values,
                                                  new_p->v,
                                                  new_p->dsdb_dn,
-                                                 invocation_id,
-                                                 seq_num, now);
+                                                 &ac->our_invocation_id,
+                                                 ac->seq_num, now);
                        if (ret != LDB_SUCCESS) {
                                talloc_free(tmp_ctx);
                                return ret;
                        }
                        ret = replmd_add_backlink(module, replmd_private,
-                                                 schema,
+                                                 ac->schema,
                                                  msg_dn,
                                                  &new_p->guid, true,
                                                  schema_attr,
@@ -3196,8 +3189,8 @@ 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,
-                                                      ac->schema, msg, el, old_el,
-                                                      schema_attr, ac->seq_num, t,
+                                                      ac, msg, el, old_el,
+                                                      schema_attr, t,
                                                       old_msg->dn,
                                                       parent);
                        break;