s4:NBT-WINSREPLICATION: test replication with names including scopes
authorStefan Metzmacher <metze@sernet.de>
Mon, 1 Feb 2010 16:39:46 +0000 (17:39 +0100)
committerStefan Metzmacher <metze@sernet.de>
Mon, 1 Feb 2010 17:30:42 +0000 (18:30 +0100)
metze
(cherry picked from commit c1d8dc01fc6f0fa3a22a405419917d880b832761)

source/torture/nbt/winsreplication.c

index 51bf07edf4d64bfc52f91bd984f474f0135d0515..1ee535c67311c8fc64ea4e4db10a9a622129de98 100644 (file)
@@ -803,9 +803,15 @@ static BOOL test_wrepl_is_applied(struct test_wrepl_conflict_conn *ctx,
                                                  names[0].state,
                                                  names[0].node,
                                                  names[0].is_static);
+               char *expected_scope = NULL;
                CHECK_VALUE(names[0].name.type, name->name->type);
                CHECK_VALUE_STRING(names[0].name.name, name->name->name);
-               CHECK_VALUE_STRING(names[0].name.scope, name->name->scope);
+               if (names[0].name.scope) {
+                       expected_scope = talloc_strndup(ctx,
+                                                       name->name->scope,
+                                                       237);
+               }
+               CHECK_VALUE_STRING(names[0].name.scope, expected_scope);
                CHECK_VALUE(flags, name->flags);
                CHECK_VALUE_UINT64(names[0].version_id, name->id);
 
@@ -1011,6 +1017,27 @@ done:
        return ret;
 }
 
+static char *test_nbt_winsrepl_scope_string(TALLOC_CTX *mem_ctx, uint8_t count)
+{
+       char *res;
+       uint8_t i;
+
+       res = talloc_array(mem_ctx, char, count+1);
+       if (res == NULL) {
+               return NULL;
+       }
+
+       for (i=0; i < count; i++) {
+               res[i] = '0' + (i%10);
+       }
+
+       res[count] = '\0';
+
+       talloc_set_name_const(res, res);
+
+       return res;
+}
+
 static BOOL test_conflict_same_owner(struct test_wrepl_conflict_conn *ctx)
 {
        BOOL ret = True;
@@ -1022,6 +1049,28 @@ static BOOL test_conflict_same_owner(struct test_wrepl_conflict_conn *ctx)
        uint32_t i,j;
        struct nbt_name names[] = {
                _NBT_NAME("_SAME_OWNER_A", 0x00, NULL),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 1)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 2)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 3)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 4)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 5)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 6)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 7)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 8)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 9)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 237)),
+               _NBT_NAME("_SAME_OWNER_A", 0x00,
+                         test_nbt_winsrepl_scope_string(ctx, 238)),
                _NBT_NAME("_SAME_OWNER_A", 0x1C, NULL),
        };
        struct {