s4:NBT-WINSREPLICATION: use an array of nbt_names to loop over different names
authorStefan Metzmacher <metze@samba.org>
Fri, 29 Jan 2010 15:33:58 +0000 (16:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 1 Feb 2010 14:23:33 +0000 (15:23 +0100)
metze

source4/torture/nbt/winsreplication.c

index 1ad0543d662f8c501690412d2ae67c89ed96b7f5..6d75aac80efd5811e457f1d21e629849c0378956 100644 (file)
@@ -1008,14 +1008,16 @@ static bool test_conflict_same_owner(struct torture_context *tctx,
                                                                         struct test_wrepl_conflict_conn *ctx)
 {
        static bool ret = true;
-       struct nbt_name name;
        struct wrepl_wins_name wins_name1;
        struct wrepl_wins_name wins_name2;
        struct wrepl_wins_name *wins_name_tmp;
        struct wrepl_wins_name *wins_name_last;
        struct wrepl_wins_name *wins_name_cur;
        uint32_t i,j;
-       uint8_t types[] = { 0x00, 0x1C };
+       struct nbt_name names[] = {
+               _NBT_NAME("_SAME_OWNER_A", 0x00, NULL),
+               _NBT_NAME("_SAME_OWNER_A", 0x1C, NULL),
+       };
        struct {
                enum wrepl_name_type type;
                enum wrepl_name_state state;
@@ -1112,18 +1114,13 @@ static bool test_conflict_same_owner(struct torture_context *tctx,
                }
        };
 
-       name.name       = "_SAME_OWNER_A";
-       name.type       = 0;
-       name.scope      = NULL;
-
        wins_name_tmp   = NULL;
        wins_name_last  = &wins_name2;
        wins_name_cur   = &wins_name1;
 
-       for (j=0; ret && j < ARRAY_SIZE(types); j++) {
-               name.type = types[j];
+       for (j=0; ret && j < ARRAY_SIZE(names); j++) {
                torture_comment(tctx, "Test Replica Conflicts with same owner[%s] for %s\n",
-                       nbt_name_string(ctx, &name), ctx->a.address);
+                       nbt_name_string(ctx, &names[j]), ctx->a.address);
 
                for(i=0; ret && i < ARRAY_SIZE(records); i++) {
                        wins_name_tmp   = wins_name_last;
@@ -1142,7 +1139,7 @@ static bool test_conflict_same_owner(struct torture_context *tctx,
                                        "REPLACE");
                        }
 
-                       wins_name_cur->name     = &name;
+                       wins_name_cur->name     = &names[j];
                        wins_name_cur->flags    = WREPL_NAME_FLAGS(records[i].type,
                                                                   records[i].state,
                                                                   records[i].node,