diff options
Diffstat (limited to 'source4/torture/nbt')
-rw-r--r-- | source4/torture/nbt/browse.c | 4 | ||||
-rw-r--r-- | source4/torture/nbt/dgram.c | 23 | ||||
-rw-r--r-- | source4/torture/nbt/nbt.c | 19 | ||||
-rw-r--r-- | source4/torture/nbt/query.c | 9 | ||||
-rw-r--r-- | source4/torture/nbt/register.c | 14 | ||||
-rw-r--r-- | source4/torture/nbt/wins.c | 13 | ||||
-rw-r--r-- | source4/torture/nbt/winsbench.c | 7 | ||||
-rw-r--r-- | source4/torture/nbt/winsreplication.c | 39 |
8 files changed, 64 insertions, 64 deletions
diff --git a/source4/torture/nbt/browse.c b/source4/torture/nbt/browse.c index a9aac79469..e609e72055 100644 --- a/source4/torture/nbt/browse.c +++ b/source4/torture/nbt/browse.c @@ -33,7 +33,7 @@ bool torture_nbt_browse(struct torture_context *torture) struct nbt_name name; TALLOC_CTX *mem_ctx = talloc_new(NULL); NTSTATUS status; - BOOL ret = True; + bool ret = true; name.name = lp_workgroup(); name.type = NBT_NAME_BROWSER; @@ -45,7 +45,7 @@ bool torture_nbt_browse(struct torture_context *torture) printf("Failed to resolve %s - %s\n", name.name, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } talloc_free(mem_ctx); diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 2effe25ab7..e9cfda4b17 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -30,6 +30,7 @@ #include "libcli/resolve/resolve.h" #include "system/network.h" #include "lib/socket/netif.h" +#include "param/param.h" #define TEST_NAME "TORTURE_TEST" @@ -42,7 +43,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot, { NTSTATUS status; struct nbt_netlogon_packet netlogon; - int *replies = dgmslot->private; + int *replies = (int *)dgmslot->private; printf("netlogon reply from %s:%d\n", src->addr, src->port); @@ -77,7 +78,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -90,7 +91,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -156,7 +157,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -168,7 +169,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx) myaddress = talloc_strdup(dgmsock, iface_best_ip(address)); socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -227,7 +228,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot, { NTSTATUS status; struct nbt_ntlogon_packet ntlogon; - int *replies = dgmslot->private; + int *replies = (int *)dgmslot->private; printf("ntlogon reply from %s:%d\n", src->addr, src->port); @@ -265,7 +266,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -277,7 +278,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) myaddress = talloc_strdup(dgmsock, iface_best_ip(address)); socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -298,7 +299,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) ACB_WSTRUST, &machine_credentials); torture_assert(tctx, join_ctx != NULL, talloc_asprintf(tctx, "Failed to join domain %s as %s\n", - lp_workgroup(), TEST_NAME)); + lp_workgroup(global_loadparm), TEST_NAME)); dom_sid = torture_join_sid(join_ctx); @@ -340,9 +341,9 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) /* test nbt dgram operations */ -struct torture_suite *torture_nbt_dgram(void) +struct torture_suite *torture_nbt_dgram(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "DGRAM"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "DGRAM"); torture_suite_add_simple_test(suite, "netlogon", nbt_test_netlogon); torture_suite_add_simple_test(suite, "netlogon2", nbt_test_netlogon2); diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c index 5c941c60c9..2a3678ee75 100644 --- a/source4/torture/nbt/nbt.c +++ b/source4/torture/nbt/nbt.c @@ -29,7 +29,7 @@ bool torture_nbt_get_name(struct torture_context *tctx, const char **address) { make_nbt_name_server(name, strupper_talloc(tctx, - torture_setting_string(tctx, "host", NULL))); + torture_setting_string(tctx, "host", NULL))); /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, @@ -43,18 +43,17 @@ bool torture_nbt_get_name(struct torture_context *tctx, NTSTATUS torture_nbt_init(void) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), - "NBT"); + talloc_autofree_context(), "NBT"); /* nbt tests */ - torture_suite_add_suite(suite, torture_nbt_register()); - torture_suite_add_suite(suite, torture_nbt_wins()); - torture_suite_add_suite(suite, torture_nbt_dgram()); - torture_suite_add_suite(suite, torture_nbt_winsreplication()); - torture_suite_add_suite(suite, torture_bench_nbt()); - torture_suite_add_suite(suite, torture_bench_wins()); + torture_suite_add_suite(suite, torture_nbt_register(suite)); + torture_suite_add_suite(suite, torture_nbt_wins(suite)); + torture_suite_add_suite(suite, torture_nbt_dgram(suite)); + torture_suite_add_suite(suite, torture_nbt_winsreplication(suite)); + torture_suite_add_suite(suite, torture_bench_nbt(suite)); + torture_suite_add_suite(suite, torture_bench_wins(suite)); suite->description = talloc_strdup(suite, - "NetBIOS over TCP/IP and WINS tests"); + "NetBIOS over TCP/IP and WINS tests"); torture_register_suite(suite); diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c index 5794d840ec..1040335227 100644 --- a/source4/torture/nbt/query.c +++ b/source4/torture/nbt/query.c @@ -61,8 +61,8 @@ static bool bench_namequery(struct torture_context *tctx) io.in.name = name; io.in.dest_addr = address; - io.in.broadcast = False; - io.in.wins_lookup = False; + io.in.broadcast = false; + io.in.wins_lookup = false; io.in.timeout = 1; result = talloc_zero(tctx, struct result_struct); @@ -104,10 +104,9 @@ static bool bench_namequery(struct torture_context *tctx) /* benchmark how fast a server can respond to name queries */ -struct torture_suite *torture_bench_nbt(void) +struct torture_suite *torture_bench_nbt(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), - "BENCH"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "BENCH"); torture_suite_add_simple_test(suite, "namequery", bench_namequery); return suite; diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index 03cc4e6cee..9ff22c4bb9 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -68,9 +68,9 @@ static bool nbt_register_own(struct torture_context *tctx) io.in.dest_addr = address; io.in.address = myaddress; io.in.nb_flags = NBT_NODE_B | NBT_NM_ACTIVE; - io.in.register_demand = False; - io.in.broadcast = True; - io.in.multi_homed = False; + io.in.register_demand = false; + io.in.broadcast = true; + io.in.multi_homed = false; io.in.ttl = 1234; io.in.timeout = 3; io.in.retries = 0; @@ -86,7 +86,7 @@ static bool nbt_register_own(struct torture_context *tctx) /* check a register demand */ io.in.address = myaddress; - io.in.register_demand = True; + io.in.register_demand = true; status = nbt_name_register(nbtsock, tctx, &io); @@ -134,7 +134,7 @@ static bool nbt_refresh_own(struct torture_context *tctx) io.in.dest_addr = address; io.in.address = myaddress; io.in.nb_flags = NBT_NODE_B | NBT_NM_ACTIVE; - io.in.broadcast = False; + io.in.broadcast = false; io.in.ttl = 1234; io.in.timeout = 3; io.in.retries = 0; @@ -155,11 +155,11 @@ static bool nbt_refresh_own(struct torture_context *tctx) /* test name registration to a server */ -struct torture_suite *torture_nbt_register(void) +struct torture_suite *torture_nbt_register(TALLOC_CTX *mem_ctx) { struct torture_suite *suite; - suite = torture_suite_create(talloc_autofree_context(), "REGISTER"); + suite = torture_suite_create(mem_ctx, "REGISTER"); torture_suite_add_simple_test(suite, "register_own", nbt_register_own); torture_suite_add_simple_test(suite, "refresh_own", nbt_refresh_own); diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index 7f3ed8e415..e25c3e78f0 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -77,7 +77,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address release.in.dest_addr = address; release.in.address = myaddress; release.in.nb_flags = nb_flags; - release.in.broadcast = False; + release.in.broadcast = false; release.in.timeout = 3; release.in.retries = 0; @@ -113,8 +113,8 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address torture_comment(tctx, "query the name to make sure its there\n"); query.in.name = *name; query.in.dest_addr = address; - query.in.broadcast = False; - query.in.wins_lookup = True; + query.in.broadcast = false; + query.in.wins_lookup = true; query.in.timeout = 3; query.in.retries = 0; @@ -174,7 +174,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address release.in.dest_addr = address; release.in.address = myaddress; release.in.nb_flags = nb_flags; - release.in.broadcast = False; + release.in.broadcast = false; release.in.timeout = 3; release.in.retries = 0; @@ -284,10 +284,9 @@ static bool nbt_test_wins(struct torture_context *tctx) /* test WINS operations */ -struct torture_suite *torture_nbt_wins(void) +struct torture_suite *torture_nbt_wins(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), - "WINS"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "WINS"); torture_suite_add_simple_test(suite, "wins", nbt_test_wins); diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c index f06db648fc..27edd57206 100644 --- a/source4/torture/nbt/winsbench.c +++ b/source4/torture/nbt/winsbench.c @@ -282,11 +282,10 @@ static bool bench_wins(struct torture_context *tctx) benchmark how fast a WINS server can respond to a mixture of registration/refresh/release and name query requests */ -struct torture_suite *torture_bench_wins(void) +struct torture_suite *torture_bench_wins(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), - "BENCH-WINS"); + struct torture_suite *suite = torture_suite_create(mem_ctx, + "BENCH-WINS"); torture_suite_add_simple_test(suite, "wins", bench_wins); diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index bc370c8b4e..f0b17b9778 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -30,6 +30,7 @@ #include "librpc/gen_ndr/ndr_nbt.h" #include "torture/torture.h" #include "torture/nbt/proto.h" +#include "param/param.h" #define CHECK_STATUS(tctx, status, correct) \ torture_assert_ntstatus_equal(tctx, status, correct, \ @@ -97,10 +98,6 @@ static bool test_assoc_ctx1(struct torture_context *tctx) struct nbt_name name; const char *address; - if (!torture_setting_bool(tctx, "dangerous", false)) { - torture_skip(tctx, "winsrepl: cross connection assoc_ctx usage disabled - enable dangerous tests to use"); - } - if (!torture_nbt_get_name(tctx, &name, &address)) return false; @@ -224,7 +221,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx) /* display a replication entry */ -static void display_entry(TALLOC_CTX *tctx, struct wrepl_name *name) +static void display_entry(struct torture_context *tctx, struct wrepl_name *name) { int i; @@ -541,8 +538,8 @@ static const struct wrepl_ip addresses_X_3_4[] = { } }; -static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *tctx, - const char *address) +static struct test_wrepl_conflict_conn *test_create_conflict_ctx( + struct torture_context *tctx, const char *address) { struct test_wrepl_conflict_conn *ctx; struct wrepl_associate associate; @@ -632,7 +629,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *tct if (!ctx->nbtsock_srv) return NULL; /* Make a port 137 version of ctx->myaddr */ - nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port()); + nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port(global_loadparm)); if (!nbt_srv_addr) return NULL; /* And if possible, bind to it. This won't work unless we are root or in sockewrapper */ @@ -657,7 +654,8 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *tct /* Make a port 137 version of ctx->myaddr2 */ nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, - ctx->myaddr2->addr, lp_nbt_port()); + ctx->myaddr2->addr, + lp_nbt_port(global_loadparm)); if (!nbt_srv_addr) return NULL; /* And if possible, bind to it. This won't work unless we are root or in sockewrapper */ @@ -9158,7 +9156,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx, if (!ctx->nbtsock_srv) { torture_comment(tctx, "SKIP: Test Replica records vs. owned active records: not bound to port[%d]\n", - lp_nbt_port()); + lp_nbt_port(global_loadparm)); return true; } @@ -9454,7 +9452,8 @@ static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_ { struct nbt_name *name; struct nbt_name_packet *rep_packet; - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; _NBT_ASSERT(req_packet->qdcount, 1); _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS); @@ -9550,7 +9549,8 @@ static void test_conflict_owned_active_vs_replica_handler_release( { struct nbt_name *name; struct nbt_name_packet *rep_packet; - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; _NBT_ASSERT(req_packet->qdcount, 1); _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS); @@ -9601,7 +9601,8 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket struct nbt_name_packet *req_packet, struct socket_address *src) { - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; rec->defend.ret = false; @@ -9670,13 +9671,15 @@ static bool torture_nbt_winsreplication_owned(struct torture_context *tctx) /* test simple WINS replication operations */ -struct torture_suite *torture_nbt_winsreplication(void) +struct torture_suite *torture_nbt_winsreplication(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), - "WINSREPLICATION"); - torture_suite_add_simple_test(suite, "assoc_ctx1", - test_assoc_ctx1); + mem_ctx, "WINSREPLICATION"); + struct torture_tcase *tcase; + + tcase = torture_suite_add_simple_test(suite, "assoc_ctx1", + test_assoc_ctx1); + tcase->tests->dangerous = true; torture_suite_add_simple_test(suite, "assoc_ctx2", test_assoc_ctx2); |