s4:NBT-WINS: test large scopes
authorStefan Metzmacher <metze@samba.org>
Mon, 1 Feb 2010 14:32:37 +0000 (15:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 1 Feb 2010 14:32:38 +0000 (15:32 +0100)
metze

source4/torture/nbt/wins.c

index 092215e2f11eb43c8c91472a413415424b208fd1..b372de8a55329eb10e97475266bdc5f1bea369fe 100644 (file)
@@ -405,6 +405,35 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
 }
 
 
+static char *test_nbt_wins_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++) {
+               switch (i) {
+               case 63:
+               case 63 + 1 + 63:
+               case 63 + 1 + 63 + 1 + 63:
+                       res[i] = '.';
+                       break;
+               default:
+                       res[i] = '0' + (i%10);
+                       break;
+               }
+       }
+
+       res[count] = '\0';
+
+       talloc_set_name_const(res, res);
+
+       return res;
+}
 
 /*
   test operations against a WINS server
@@ -488,6 +517,14 @@ static bool nbt_test_wins(struct torture_context *tctx)
        ret &= nbt_test_wins_name(tctx, address, &name,
                                  NBT_NODE_H, false, NBT_RCODE_OK);
 
+       name.scope = test_nbt_wins_scope_string(tctx, 237);
+       ret &= nbt_test_wins_name(tctx, address, &name,
+                                 NBT_NODE_H, false, NBT_RCODE_OK);
+
+       name.scope = test_nbt_wins_scope_string(tctx, 238);
+       ret &= nbt_test_wins_name(tctx, address, &name,
+                                 NBT_NODE_H, false, NBT_RCODE_SVR);
+
        return ret;
 }