From: Tim Beale Date: Thu, 28 Sep 2017 02:01:21 +0000 (+1300) Subject: replmd: Remove static values passed to replmd_build_la_val() X-Git-Tag: tevent-0.9.34~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cef17ce4f04bacb50193cb7e7a2cfd53fdf61110;p=thirdparty%2Fsamba.git replmd: Remove static values passed to replmd_build_la_val() replmd_build_la_val() is used to populate a new link attribute value from scratch. The version parameter is always passed in as the initial value (zero), and deleted is always passed in as false. For cases (like replication) where we want to set version/deleted to something other than the defaults, we can use replmd_set_la_val() instead. This patch changes these 2 parameters to variables instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13059 Signed-off-by: Tim Beale Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index d21ae97a0eb..f4cad0d074f 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -923,7 +923,7 @@ static void replmd_ldb_message_sort(struct ldb_message *msg, static int replmd_build_la_val(TALLOC_CTX *mem_ctx, struct ldb_val *v, struct dsdb_dn *dsdb_dn, const struct GUID *invocation_id, uint64_t seq_num, - uint64_t local_usn, NTTIME nttime, uint32_t version, bool deleted); + uint64_t local_usn, NTTIME nttime); static int parsed_dn_compare(struct parsed_dn *pdn1, struct parsed_dn *pdn2); @@ -994,7 +994,7 @@ static int replmd_add_fix_la(struct ldb_module *module, TALLOC_CTX *mem_ctx, } ret = replmd_build_la_val(el->values, p->v, p->dsdb_dn, &ac->our_invocation_id, - ac->seq_num, ac->seq_num, now, 0, false); + ac->seq_num, ac->seq_num, now); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; @@ -2138,7 +2138,7 @@ static int get_parsed_dns_trusted(struct ldb_module *module, */ static int replmd_build_la_val(TALLOC_CTX *mem_ctx, struct ldb_val *v, struct dsdb_dn *dsdb_dn, const struct GUID *invocation_id, uint64_t seq_num, - uint64_t local_usn, NTTIME nttime, uint32_t version, bool deleted) + uint64_t local_usn, NTTIME nttime) { struct ldb_dn *dn = dsdb_dn->dn; const char *tstring, *usn_string, *flags_string; @@ -2150,7 +2150,8 @@ static int replmd_build_la_val(TALLOC_CTX *mem_ctx, struct ldb_val *v, struct ds int ret; const char *dnstring; char *vstring; - uint32_t rmd_flags = deleted?DSDB_RMD_FLAG_DELETED:0; + uint32_t version = 0; + uint32_t rmd_flags = 0; tstring = talloc_asprintf(mem_ctx, "%llu", (unsigned long long)nttime); if (!tstring) { @@ -2600,8 +2601,7 @@ static int replmd_modify_la_add(struct ldb_module *module, /* Make the new linked attribute ldb_val. */ ret = replmd_build_la_val(new_values, &new_values[num_values], dns[i].dsdb_dn, invocation_id, - seq_num, seq_num, - now, 0, false); + seq_num, seq_num, now); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; @@ -3083,8 +3083,7 @@ static int replmd_modify_la_replace(struct ldb_module *module, new_p->v, new_p->dsdb_dn, invocation_id, - seq_num, seq_num, - now, 0, false); + seq_num, seq_num, now); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret;