From 21729fff115046ede3a316028b6a4e95cc7c590b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 13 Jan 2007 11:37:13 +0000 Subject: r20729: add a version number to struct dsdb_extended_replicated_objects metze (This used to be commit 2e79863d54030526841e5858e7be6a815c25593b) --- source4/dsdb/repl/replicated_objects.c | 3 ++- source4/dsdb/samdb/ldb_modules/partition.c | 9 ++++++++- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 7 +++++++ source4/dsdb/samdb/samdb.h | 7 +++++++ 4 files changed, 24 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index aa92269c46..274ba0894f 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -192,8 +192,9 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb, out = talloc_zero(mem_ctx, struct dsdb_extended_replicated_objects); W_ERROR_HAVE_NO_MEMORY(out); + out->version = DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION; - out->partition_dn = ldb_dn_new(out, ldb, partition_dn); + out->partition_dn = ldb_dn_new(out, ldb, partition_dn); W_ERROR_HAVE_NO_MEMORY(out->partition_dn); out->source_dsa = source_dsa; diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index 31150b5f7b..6ed113857d 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -571,7 +571,14 @@ static int partition_extended_replicated_objects(struct ldb_module *module, stru ext = talloc_get_type(req->op.extended.data, struct dsdb_extended_replicated_objects); if (!ext) { - return LDB_ERR_OTHER; + ldb_debug(module->ldb, LDB_DEBUG_FATAL, "partition_extended_replicated_objects: invalid extended data\n"); + return LDB_ERR_PROTOCOL_ERROR; + } + + if (ext->version != DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION) { + ldb_debug(module->ldb, LDB_DEBUG_FATAL, "partition_extended_replicated_objects: extended data invalid version [%u != %u]\n", + ext->version, DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION); + return LDB_ERR_PROTOCOL_ERROR; } return partition_replicate(module, req, ext->partition_dn); diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 53fd46f116..d88ca5f05e 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -1272,6 +1272,13 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct objs = talloc_get_type(req->op.extended.data, struct dsdb_extended_replicated_objects); if (!objs) { + ldb_debug(module->ldb, LDB_DEBUG_FATAL, "replmd_extended_replicated_objects: invalid extended data\n"); + return LDB_ERR_PROTOCOL_ERROR; + } + + if (objs->version != DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION) { + ldb_debug(module->ldb, LDB_DEBUG_FATAL, "replmd_extended_replicated_objects: extended data invalid version [%u != %u]\n", + objs->version, DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION); return LDB_ERR_PROTOCOL_ERROR; } diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 678ae09969..2a974affbb 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -44,6 +44,13 @@ struct dsdb_extended_replicated_object { }; struct dsdb_extended_replicated_objects { + /* + * this is the version of the dsdb_extended_replicated_objects + * version 0: initial implementation + */ +#define DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION 0 + uint32_t version; + struct ldb_dn *partition_dn; const struct repsFromTo1 *source_dsa; -- cgit