From 5e89476730adecd3ecd45af38bdf67d6573f8724 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 20 Aug 2008 12:46:37 +1000 Subject: Add a torture test for the new 'netlogon' flags. Signed-off-by: Andrew Bartlett (This used to be commit a484334fb4dafd1df514d1bf88f7e0c4f07dff86) --- source4/torture/ldap/cldap.c | 146 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c index 1631297793..3730193c86 100644 --- a/source4/torture/ldap/cldap.c +++ b/source4/torture/ldap/cldap.c @@ -227,6 +227,75 @@ static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest) return true; } +/* + test cldap netlogon server type flags +*/ +static bool test_cldap_netlogon_flags(struct torture_context *tctx, + const char *dest) +{ + struct cldap_socket *cldap; + NTSTATUS status; + struct cldap_netlogon search; + struct netlogon_samlogon_response n1; + uint32_t server_type; + + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + + printf("Printing out netlogon server type flags:\n"); + + ZERO_STRUCT(search); + search.in.dest_address = dest; + search.in.dest_port = lp_cldap_port(tctx->lp_ctx); + search.in.acct_control = -1; + search.in.version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX; + search.in.map_response = true; + + status = cldap_netlogon(cldap, tctx, &search); + CHECK_STATUS(status, NT_STATUS_OK); + + n1 = search.out.netlogon; + if (n1.ntver == NETLOGON_NT_VERSION_5) + server_type = n1.nt5.server_type; + else if (n1.ntver == NETLOGON_NT_VERSION_5EX) + server_type = n1.nt5_ex.server_type; + + printf("The word is: %i\n", server_type); + if (server_type & NBT_SERVER_PDC) + printf("NBT_SERVER_PDC "); + if (server_type & NBT_SERVER_GC) + printf("NBT_SERVER_GC "); + if (server_type & NBT_SERVER_LDAP) + printf("NBT_SERVER_LDAP "); + if (server_type & NBT_SERVER_DS) + printf("NBT_SERVER_DS "); + if (server_type & NBT_SERVER_KDC) + printf("NBT_SERVER_KDC "); + if (server_type & NBT_SERVER_TIMESERV) + printf("NBT_SERVER_TIMESERV "); + if (server_type & NBT_SERVER_CLOSEST) + printf("NBT_SERVER_CLOSEST "); + if (server_type & NBT_SERVER_WRITABLE) + printf("NBT_SERVER_WRITABLE "); + if (server_type & NBT_SERVER_GOOD_TIMESERV) + printf("NBT_SERVER_GOOD_TIMESERV "); + if (server_type & NBT_SERVER_NDNC) + printf("NBT_SERVER_NDNC "); + if (server_type & NBT_SERVER_SEL_SEC_DOM_6) + printf("NBT_SERVER_SEL_SEC_DOM_6 "); + if (server_type & NBT_SERVER_FUL_SEC_DOM_6) + printf("NBT_SERVER_FUL_SEC_DOM_6 "); + if (server_type & NBT_SERVER_DS_DNS_CONTR) + printf("NBT_SERVER_DS_DNS_CONTR "); + if (server_type & NBT_SERVER_DS_DNS_DOMAIN) + printf("NBT_SERVER_DS_DNS_DOMAIN "); + if (server_type & NBT_SERVER_DS_DNS_FOREST) + printf("NBT_SERVER_DS_DNS_FOREST "); + + printf("\n"); + + return true; +} + /* convert a ldap result message to a ldb message. This allows us to use the convenient ldif dump routines in ldb to print out cldap @@ -266,6 +335,81 @@ static void cldap_dump_results(struct cldap_search *search) talloc_free(ldb); } + +/* + test cldap netlogon server type flag "NBT_SERVER_DS_DNS_FOREST" +*/ +static bool test_cldap_netlogon_flag_ds_dns_forest(struct torture_context *tctx, + const char *dest) +{ + struct cldap_socket *cldap; + NTSTATUS status; + struct cldap_netlogon search; + uint32_t server_type; + struct netlogon_samlogon_response n1; + + bool result = true; + + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + + printf("Testing netlogon server type flag NBT_SERVER_DS_DNS_FOREST: "); + + ZERO_STRUCT(search); + search.in.dest_address = dest; + search.in.dest_port = lp_cldap_port(tctx->lp_ctx); + search.in.acct_control = -1; + search.in.version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX; + search.in.map_response = true; + + status = cldap_netlogon(cldap, tctx, &search); + CHECK_STATUS(status, NT_STATUS_OK); + + n1 = search.out.netlogon; + if (n1.ntver == NETLOGON_NT_VERSION_5) + server_type = n1.nt5.server_type; + else if (n1.ntver == NETLOGON_NT_VERSION_5EX) + server_type = n1.nt5_ex.server_type; + + if (server_type & NBT_SERVER_DS_DNS_FOREST) { + struct cldap_search search2; + const char *attrs[] = { "defaultNamingContext", "rootDomainNamingContext", + NULL }; + struct ldb_context *ldb; + struct ldb_message *msg; + + /* Trying to fetch the attributes "defaultNamingContext" and + "rootDomainNamingContext" */ + ZERO_STRUCT(search2); + search2.in.dest_address = dest; + search2.in.dest_port = lp_cldap_port(tctx->lp_ctx); + search2.in.timeout = 10; + search2.in.retries = 3; + search2.in.filter = "(objectclass=*)"; + search2.in.attributes = attrs; + + status = cldap_search(cldap, tctx, &search2); + CHECK_STATUS(status, NT_STATUS_OK); + + ldb = ldb_init(NULL, NULL); + + msg = ldap_msg_to_ldb(ldb, ldb, search2.out.response); + + /* Try to compare the two attributes */ + if (ldb_msg_element_compare(ldb_msg_find_element(msg, attrs[0]), + ldb_msg_find_element(msg, attrs[1]))) + result = false; + + talloc_free(ldb); + } + + if (result) + printf("passed\n"); + else + printf("failed\n"); + + return result; +} + /* test generic cldap operations */ @@ -343,6 +487,8 @@ bool torture_cldap(struct torture_context *torture) const char *host = torture_setting_string(torture, "host", NULL); ret &= test_cldap_netlogon(torture, host); + ret &= test_cldap_netlogon_flags(torture, host); + ret &= test_cldap_netlogon_flag_ds_dns_forest(torture, host); ret &= test_cldap_generic(torture, host); return ret; -- cgit From 75f594b285df4200369e1f767ffd4be5746fdd00 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 19 Aug 2008 10:36:24 +0200 Subject: drsuapi: fix samba4 callers after drsuapi.idl changes metze (This used to be commit 4b054cee51c39c5430bcadd5c06a94dc3e6b0d8f) --- source4/torture/rpc/dssync.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 2739081246..e9346f9605 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -747,9 +747,10 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) if (ret == true && *r.out.level == 1) { out_level = 1; ctr1 = &r.out.ctr.ctr1; - } else if (ret == true && *r.out.level == 2) { + } else if (ret == true && *r.out.level == 2 && + r.out.ctr.ctr2.mszip1.ts) { out_level = 1; - ctr1 = r.out.ctr.ctr2.mszip1.ctr1; + ctr1 = &r.out.ctr.ctr2.mszip1.ts->ctr1; } if (out_level == 1) { @@ -770,14 +771,16 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) ctr6 = &r.out.ctr.ctr6; } else if (ret == true && *r.out.level == 7 && r.out.ctr.ctr7.level == 6 - && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) { + && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP + && r.out.ctr.ctr7.ctr.mszip6.ts) { out_level = 6; - ctr6 = r.out.ctr.ctr7.ctr.mszip6.ctr6; + ctr6 = &r.out.ctr.ctr7.ctr.mszip6.ts->ctr6; } else if (ret == true && *r.out.level == 7 && r.out.ctr.ctr7.level == 6 - && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS) { + && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS + && r.out.ctr.ctr7.ctr.xpress6.ts) { out_level = 6; - ctr6 = r.out.ctr.ctr7.ctr.xpress6.ctr6; + ctr6 = &r.out.ctr.ctr7.ctr.xpress6.ts->ctr6; } if (out_level == 6) { -- cgit From 3efd7d22626d179b2bf28d7fb3473ed982ed7dcb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 23 Aug 2008 11:54:02 +1000 Subject: don't use zero data for the first file in RAW-OFFLINE the most likely bugs in HSM involve zero data, due to the dm_punch_hole() request (This used to be commit 330ab956ea7e0b344450eee60b1357d854fbef28) --- source4/torture/raw/offline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c index 9c66c3be9c..9240c76b6b 100644 --- a/source4/torture/raw/offline.c +++ b/source4/torture/raw/offline.c @@ -108,7 +108,7 @@ static void loadfile_callback(struct composite_context *ctx) } for (i=0;iloadfile->out.data[i] != state->fnumber % 256) { + if (state->loadfile->out.data[i] != 1+(state->fnumber % 255)) { printf("Bad data in file %u\n", state->fnumber); test_failed++; return; @@ -436,7 +436,7 @@ bool torture_test_offline(struct torture_context *torture) char buf[FILE_SIZE]; NTSTATUS status; - memset(buf, i % 256, sizeof(buf)); + memset(buf, 1+(i % 255), sizeof(buf)); fnum = smbcli_open(state[0].tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { -- cgit From b030743d7408a427cf8e36faa1a2a3b8386112e8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 24 Aug 2008 17:38:43 +1000 Subject: show the bad data in RAW-OFFLINE also show the worst case latencies so far, matching tsm_torture (This used to be commit 5859bb337ce2ec5091425ebd02cad14c4da40457) --- source4/torture/raw/offline.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c index 9240c76b6b..0f7787a92f 100644 --- a/source4/torture/raw/offline.c +++ b/source4/torture/raw/offline.c @@ -109,7 +109,10 @@ static void loadfile_callback(struct composite_context *ctx) for (i=0;iloadfile->out.data[i] != 1+(state->fnumber % 255)) { - printf("Bad data in file %u\n", state->fnumber); + printf("Bad data in file %u (got %u expected %u)\n", + state->fnumber, + state->loadfile->out.data[i], + 1+(state->fnumber % 255)); test_failed++; return; } @@ -344,12 +347,16 @@ static void report_rate(struct event_context *ev, struct timed_event *te, total_online += state[i].online_count; total_offline += state[i].offline_count; } - printf("ops/s=%4u offline=%5u online=%4u set_lat=%.1f get_lat=%.1f save_lat=%.1f load_lat=%.1f\r", + printf("ops/s=%4u offline=%5u online=%4u set_lat=%.1f/%.1f get_lat=%.1f/%.1f save_lat=%.1f/%.1f load_lat=%.1f/%.1f\n", total, total_offline, total_online, latencies[OP_SETOFFLINE], + worst_latencies[OP_SETOFFLINE], latencies[OP_GETOFFLINE], + worst_latencies[OP_GETOFFLINE], latencies[OP_SAVEFILE], - latencies[OP_LOADFILE]); + worst_latencies[OP_SAVEFILE], + latencies[OP_LOADFILE], + worst_latencies[OP_LOADFILE]); fflush(stdout); event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); -- cgit From a22b9d648553e5e7e0ee19606d9bceeb3b356241 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 24 Aug 2008 17:42:29 +1000 Subject: fixed the data in SAVEFILE op in RAW-OFFLINE (This used to be commit 3441ea5df5b750442d17b90de73d392d2d802ab1) --- source4/torture/raw/offline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c index 0f7787a92f..f2f0bf5d27 100644 --- a/source4/torture/raw/offline.c +++ b/source4/torture/raw/offline.c @@ -256,7 +256,7 @@ static void test_offline(struct offline_state *state) state->savefile->in.fname = state->fname; state->savefile->in.data = talloc_size(state->savefile, FILE_SIZE); state->savefile->in.size = FILE_SIZE; - memset(state->savefile->in.data, state->fnumber, FILE_SIZE); + memset(state->savefile->in.data, 1+(state->fnumber%255), FILE_SIZE); ctx = smb_composite_savefile_send(state->tree, state->savefile); if (ctx == NULL) { -- cgit