r20729: add a version number to struct dsdb_extended_replicated_objects
authorStefan Metzmacher <metze@samba.org>
Sat, 13 Jan 2007 11:37:13 +0000 (11:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:40:33 +0000 (14:40 -0500)
metze

source/dsdb/repl/replicated_objects.c
source/dsdb/samdb/ldb_modules/partition.c
source/dsdb/samdb/ldb_modules/repl_meta_data.c
source/dsdb/samdb/samdb.h

index aa92269c46f58b847639eca5f55cc1b956f9700d..274ba0894fd3c4ff53232ed92d758f99525670f8 100644 (file)
@@ -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;
index 31150b5f7bacff8a4234cb1a404531e18e2976f1..6ed113857d7a290d389640eb88abc800023a2afe 100644 (file)
@@ -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);
index 53fd46f11632243a82f014ba5ec0577dd7f0614a..d88ca5f05ea34fadaea1fc359201b957f238c93e 100644 (file)
@@ -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;
        }
 
index 678ae0996954facd1eab7944775c3126ba22035f..2a974affbbbf64e4552429272cef086e2af98eb8 100644 (file)
@@ -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;