diff options
Diffstat (limited to 'source4/torture')
29 files changed, 134 insertions, 91 deletions
diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 917a24ad59..739a048d29 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -33,7 +33,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) TALLOC_CTX *mem_ctx = tctx; torture_assert_ntstatus_ok(tctx, - gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx), + gensec_client_start(mem_ctx, &gensec_security, + tctx->ev, tctx->lp_ctx), "gensec client start"); gensec_set_credentials(gensec_security, cmdline_credentials); @@ -87,7 +88,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) talloc_free(gensec_security); torture_assert_ntstatus_ok(tctx, - gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx), + gensec_client_start(mem_ctx, &gensec_security, + tctx->ev, tctx->lp_ctx), "Failed to start GENSEC for NTLMSSP"); gensec_set_credentials(gensec_security, cmdline_credentials); diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 3a3a7c2fd5..966d436935 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -55,7 +55,8 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx) lp_smbcli_options(tctx->lp_ctx, &options); - if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) { + if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev, + lp_resolve_context(tctx->lp_ctx), &options)) { torture_comment(tctx, "Failed to connect with %s\n", host); goto failed; } diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 6d872c687b..ae18fe809c 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -19,6 +19,7 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" +#include "lib/events/events.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/raw/request.h" @@ -154,7 +155,8 @@ static bool connect_servers_fast(void) /***************************************************** connect to the servers *******************************************************/ -static bool connect_servers(struct loadparm_context *lp_ctx) +static bool connect_servers(struct event_context *ev, + struct loadparm_context *lp_ctx) { int i, j; @@ -193,7 +195,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx) servers[i].share_name, NULL, servers[i].credentials, lp_resolve_context(lp_ctx), - NULL, &smb_options); + ev, &smb_options); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to \\\\%s\\%s - %s\n", servers[i].server_name, servers[i].share_name, @@ -1937,11 +1939,11 @@ static struct { run the test with the current set of op_parms parameters return the number of operations that completed successfully */ -static int run_test(struct loadparm_context *lp_ctx) +static int run_test(struct event_context *ev, struct loadparm_context *lp_ctx) { int op, i; - if (!connect_servers(lp_ctx)) { + if (!connect_servers(ev, lp_ctx)) { printf("Failed to connect to servers\n"); exit(1); } @@ -2018,7 +2020,8 @@ static int run_test(struct loadparm_context *lp_ctx) perform a backtracking analysis of the minimal set of operations to generate an error */ -static void backtrack_analyze(struct loadparm_context *lp_ctx) +static void backtrack_analyze(struct event_context *ev, + struct loadparm_context *lp_ctx) { int chunk, ret; @@ -2039,7 +2042,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx) } printf("Testing %d ops with %d-%d disabled\n", options.numops, base, max-1); - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); printf("Completed %d of %d ops\n", ret, options.numops); for (i=base;i<max; i++) { op_parms[i].disabled = false; @@ -2071,7 +2074,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx) } while (chunk > 0); printf("Reduced to %d ops\n", options.numops); - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); if (ret != options.numops - 1) { printf("Inconsistent result? ret=%d numops=%d\n", ret, options.numops); } @@ -2080,7 +2083,8 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx) /* start the main gentest process */ -static bool start_gentest(struct loadparm_context *lp_ctx) +static bool start_gentest(struct event_context *ev, + struct loadparm_context *lp_ctx) { int op; int ret; @@ -2116,15 +2120,15 @@ static bool start_gentest(struct loadparm_context *lp_ctx) } } - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); if (ret != options.numops && options.analyze) { options.numops = ret+1; - backtrack_analyze(lp_ctx); + backtrack_analyze(ev, lp_ctx); } else if (options.analyze_always) { - backtrack_analyze(lp_ctx); + backtrack_analyze(ev, lp_ctx); } else if (options.analyze_continuous) { - while (run_test(lp_ctx) == options.numops) ; + while (run_test(ev, lp_ctx) == options.numops) ; } return ret == options.numops; @@ -2171,6 +2175,7 @@ static bool split_unc_name(const char *unc, char **server, char **share) int i, username_count=0; bool ret; char *ignore_file=NULL; + struct event_context *ev; struct loadparm_context *lp_ctx; poptContext pc; int argc_new; @@ -2278,9 +2283,11 @@ static bool split_unc_name(const char *unc, char **server, char **share) printf("seed=%u\n", options.seed); + ev = event_context_init(talloc_autofree_context()); + gensec_init(lp_ctx); - ret = start_gentest(lp_ctx); + ret = start_gentest(ev, lp_ctx); if (ret) { printf("gentest completed - no errors\n"); diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c index dbe9d2f9a4..ca4d9b7705 100644 --- a/source4/torture/ldap/cldap.c +++ b/source4/torture/ldap/cldap.c @@ -38,13 +38,15 @@ */ static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; NTSTATUS status; struct cldap_netlogon search, empty_search; union nbt_cldap_netlogon n1; struct GUID guid; int i; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + ZERO_STRUCT(search); search.in.dest_address = dest; search.in.dest_port = lp_cldap_port(tctx->lp_ctx); @@ -244,13 +246,15 @@ static void cldap_dump_results(struct cldap_search *search) */ static bool test_cldap_generic(struct torture_context *tctx, const char *dest) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; NTSTATUS status; struct cldap_search search; const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL }; const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL }; const char *attrs3[] = { "netlogon", NULL }; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + ZERO_STRUCT(search); search.in.dest_address = dest; search.in.dest_port = lp_cldap_port(tctx->lp_ctx); diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c index 51586ac733..df2a5b0551 100644 --- a/source4/torture/ldap/cldapbench.c +++ b/source4/torture/ldap/cldapbench.c @@ -51,7 +51,7 @@ static void request_handler(struct cldap_request *req) */ static bool bench_cldap(struct torture_context *tctx, const char *address) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; int num_sent=0; struct timeval tv = timeval_current(); bool ret = true; @@ -59,6 +59,8 @@ static bool bench_cldap(struct torture_context *tctx, const char *address) struct cldap_netlogon search; struct bench_state *state; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + state = talloc_zero(tctx, struct bench_state); ZERO_STRUCT(search); diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index 65b02ed5e8..5913163822 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -65,7 +65,7 @@ NTSTATUS torture_ldap_connection(struct torture_context *tctx, return NT_STATUS_INVALID_PARAMETER; } - *conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL); + *conn = ldap4_new_connection(tctx, tctx->lp_ctx, tctx->ev); status = ldap_connect(*conn, url); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index eb6abc45d5..7d5be368c2 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_lsa"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc, - cmdline_credentials, NULL, torture->lp_ctx); + cmdline_credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; @@ -330,7 +330,7 @@ bool torture_domain_close_samr(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_samr"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr, - ctx->cred, NULL, torture->lp_ctx); + ctx->cred, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 618568acf9..8959232edb 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -19,6 +19,7 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" +#include "lib/events/events.h" #include "system/filesys.h" #include "system/time.h" #include "pstring.h" @@ -107,7 +108,8 @@ static struct record *recorded; /***************************************************** return a connection to a server *******************************************************/ -static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, +static struct smbcli_state *connect_one(struct event_context *ev, + struct loadparm_context *lp_ctx, char *share, int snum, int conn) { struct smbcli_state *c; @@ -162,7 +164,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, share, NULL, servers[snum], lp_resolve_context(lp_ctx), - NULL, &options); + ev, &options); if (!NT_STATUS_IS_OK(status)) { sleep(2); } @@ -176,7 +178,8 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, } -static void reconnect(struct loadparm_context *lp_ctx, +static void reconnect(struct event_context *ev, + struct loadparm_context *lp_ctx, struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES], char *share[NSERVERS]) { @@ -193,7 +196,7 @@ static void reconnect(struct loadparm_context *lp_ctx, } talloc_free(cli[server][conn]); } - cli[server][conn] = connect_one(lp_ctx, share[server], + cli[server][conn] = connect_one(ev, lp_ctx, share[server], server, conn); if (!cli[server][conn]) { DEBUG(0,("Failed to connect to %s\n", share[server])); @@ -396,7 +399,9 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) +static int test_locks(struct event_context *ev, + struct loadparm_context *lp_ctx, + char *share[NSERVERS]) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; @@ -447,7 +452,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) #endif } - reconnect(lp_ctx, cli, fnum, share); + reconnect(ev, lp_ctx, cli, fnum, share); open_files(cli, fnum); n = retest(cli, fnum, numops); @@ -465,7 +470,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) n1 = n; close_files(cli, fnum); - reconnect(lp_ctx, cli, fnum, share); + reconnect(ev, lp_ctx, cli, fnum, share); open_files(cli, fnum); for (i=0;i<n-skip;i+=skip) { @@ -503,7 +508,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) } close_files(cli, fnum); - reconnect(lp_ctx, cli, fnum, share); + reconnect(ev, lp_ctx, cli, fnum, share); open_files(cli, fnum); showall = true; n1 = retest(cli, fnum, n); @@ -543,6 +548,7 @@ static void usage(poptContext pc) int opt; int seed, server; int username_count=0; + struct event_context *ev; struct loadparm_context *lp_ctx; poptContext pc; int argc_new, i; @@ -631,12 +637,14 @@ static void usage(poptContext pc) servers[1] = servers[0]; } + ev = event_context_init(talloc_autofree_context()); + gensec_init(lp_ctx); DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n", seed, lock_base, lock_range, min_length)); srandom(seed); - return test_locks(lp_ctx, share); + return test_locks(ev, lp_ctx, share); } diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c index 0fe3725385..1784a0a729 100644 --- a/source4/torture/locktest2.c +++ b/source4/torture/locktest2.c @@ -19,6 +19,7 @@ #include "includes.h" #include "system/passwd.h" +#include "lib/events/events.h" static fstring password; static fstring username; @@ -137,7 +138,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype, return a connection to a server *******************************************************/ static struct smbcli_state *connect_one(char *share, const char **ports, - struct smb_options *options) + struct smb_options *optionsi, + struct event_context *ev) { struct smbcli_state *c; char *server_n; @@ -165,7 +167,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports, nt_status = smbcli_full_connection(NULL, &c, myname, server_n, ports, share, NULL, - username, lp_workgroup(), password, NULL, + username, lp_workgroup(), password, ev, options); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status))); @@ -183,6 +185,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES], const char **ports, struct smbcli_options *options, + struct event_context *ev, char *share1, char *share2) { int server, conn, f, fstype; @@ -201,7 +204,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], smbcli_ulogoff(cli[server][conn]); talloc_free(cli[server][conn]); } - cli[server][conn] = connect_one(share[server], ports, options); + cli[server][conn] = connect_one(share[server], ports, options, ev); if (!cli[server][conn]) { DEBUG(0,("Failed to connect to %s\n", share[server])); exit(1); @@ -347,7 +350,11 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options) +static void test_locks(char *share1, char *share2, + char *nfspath1, char *nfspath2, + const char **ports, + struct smbcli_options *options, + struct event_context *ev) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; char *nfs[NSERVERS]; @@ -376,7 +383,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath recorded[n].needed = true; } - reconnect(cli, nfs, fnum, ports, options, share1, share2); + reconnect(cli, nfs, fnum, ports, options, ev, share1, share2); open_files(cli, nfs, fnum); n = retest(cli, nfs, fnum, numops); @@ -387,7 +394,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath n1 = n; close_files(cli, nfs, fnum); - reconnect(cli, nfs, fnum, ports, options, share1, share2); + reconnect(cli, nfs, fnum, ports, options, ev, share1, share2); open_files(cli, nfs, fnum); for (i=0;i<n-1;i++) { @@ -414,7 +421,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath } close_files(cli, nfs, fnum); - reconnect(cli, nfs, fnum, ports, options, share1, share2); + reconnect(cli, nfs, fnum, ports, options, ev, share1, share2); open_files(cli, nfs, fnum); showall = true; n1 = retest(cli, nfs, fnum, n); @@ -466,6 +473,7 @@ static void usage(void) char *p; int seed; struct loadparm_context *lp_ctx; + struct event_context *ev; setlinebuf(stdout); @@ -542,10 +550,12 @@ static void usage(void) DEBUG(0,("seed=%u\n", seed)); srandom(seed); + ev = event_context_init(talloc_autofree_context()); + locking_init(1); lp_smbcli_options(lp_ctx, &options); test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx), - &options); + &options, ev); return(0); } diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index ac7029aa50..39b1296dbe 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -30,6 +30,7 @@ #include "param/param.h" #include "dynconfig.h" #include "libcli/resolve/resolve.h" +#include "lib/events/events.h" static bool showall = false; static bool old_list = false; @@ -73,6 +74,7 @@ static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name, return a connection to a server *******************************************************/ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, + struct event_context *ev, char *share, const char **ports, struct smbcli_options *options) { @@ -92,7 +94,7 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, server, ports, share, NULL, - cmdline_credentials, resolve_ctx, NULL, + cmdline_credentials, resolve_ctx, ev, options); if (!NT_STATUS_IS_OK(status)) { @@ -291,6 +293,7 @@ static void usage(poptContext pc) struct smbcli_state *cli; int opt; int seed; + struct event_context *ev; struct loadparm_context *lp_ctx; struct smbcli_options options; poptContext pc; @@ -352,11 +355,13 @@ static void usage(poptContext pc) lp_ctx = cmdline_lp_ctx; + ev = event_context_init(talloc_autofree_context()); + gensec_init(lp_ctx); lp_smbcli_options(lp_ctx, &options); - cli = connect_one(lp_resolve_context(lp_ctx), share, + cli = connect_one(lp_resolve_context(lp_ctx), ev, share, lp_smb_ports(lp_ctx), &options); if (!cli) { DEBUG(0,("Failed to connect to %s\n", share)); diff --git a/source4/torture/nbt/browse.c b/source4/torture/nbt/browse.c index e609e72055..a0e7b7d9ca 100644 --- a/source4/torture/nbt/browse.c +++ b/source4/torture/nbt/browse.c @@ -40,7 +40,7 @@ bool torture_nbt_browse(struct torture_context *torture) name.scope = NULL; /* do an initial name resolution to find its IP */ - status = resolve_name(&name, mem_ctx, &address, NULL); + status = resolve_name(&name, mem_ctx, &address, torture->ev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to resolve %s - %s\n", name.name, nt_errstr(status)); diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index a4c8be888c..a3585896eb 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -64,7 +64,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot, static bool nbt_test_netlogon(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; const char *myaddress; @@ -147,7 +147,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) static bool nbt_test_netlogon2(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; const char *myaddress; @@ -257,7 +257,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot, static bool nbt_test_ntlogon(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; struct test_join *join_ctx; diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c index 6cb9507398..d27a26eb30 100644 --- a/source4/torture/nbt/nbt.c +++ b/source4/torture/nbt/nbt.c @@ -34,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx, /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, - resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, NULL), + resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev), talloc_asprintf(tctx, "Failed to resolve %s", name->name)); diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c index 1ba6172e5c..3f3a15cca5 100644 --- a/source4/torture/nbt/query.c +++ b/source4/torture/nbt/query.c @@ -47,7 +47,7 @@ static void increment_handler(struct nbt_name_request *req) */ static bool bench_namequery(struct torture_context *tctx) { - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); int num_sent=0; struct result_struct *result; diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index b9f06c479d..a8681f828f 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -44,7 +44,7 @@ static bool nbt_register_own(struct torture_context *tctx) { struct nbt_name_register io; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *socket_address; struct nbt_name name; @@ -114,7 +114,7 @@ static bool nbt_refresh_own(struct torture_context *tctx) { struct nbt_name_refresh io; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); const char *myaddress; struct socket_address *socket_address; diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index 059b2dc919..ae20de6e2f 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -53,7 +53,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address struct nbt_name_refresh_wins refresh; struct nbt_name_release release; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); const char *myaddress; struct socket_address *socket_address; struct interface *ifaces; diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c index ea4abaf21b..a0d90fb653 100644 --- a/source4/torture/nbt/winsbench.c +++ b/source4/torture/nbt/winsbench.c @@ -225,7 +225,7 @@ static void generate_request(struct nbt_name_socket *nbtsock, struct wins_state */ static bool bench_wins(struct torture_context *tctx) { - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); int num_sent=0; struct timeval tv = timeval_current(); bool ret = true; diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index 470eee8310..ee7a1510d5 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -103,8 +103,8 @@ static bool test_assoc_ctx1(struct torture_context *tctx) torture_comment(tctx, "Test if assoc_ctx is only valid on the conection it was created on\n"); - wrepl_socket1 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); - wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket1 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket2 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup 2 wrepl connections\n"); status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -186,7 +186,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx) torture_comment(tctx, "Test if we always get back the same assoc_ctx\n"); - wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup wrepl connections\n"); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -255,7 +255,7 @@ static bool test_wins_replication(struct torture_context *tctx) torture_comment(tctx, "Test one pull replication cycle\n"); - wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup wrepl connections\n"); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -553,7 +553,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( if (!ctx) return NULL; ctx->address = address; - ctx->pull = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->pull = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->pull) return NULL; torture_comment(tctx, "Setup wrepl conflict pull connection\n"); @@ -610,7 +610,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( talloc_free(pull_table.out.partners); - ctx->nbtsock = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock) return NULL; load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); @@ -628,7 +628,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0); if (!NT_STATUS_IS_OK(status)) return NULL; - ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock_srv = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock_srv) return NULL; /* Make a port 137 version of ctx->myaddr */ @@ -645,7 +645,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( } if (ctx->myaddr2 && ctx->nbtsock_srv) { - ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock2 = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock2) return NULL; status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0); @@ -722,7 +722,7 @@ static bool test_wrepl_update_one(struct torture_context *tctx, uint32_t assoc_ctx; NTSTATUS status; - wrepl_socket = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address); CHECK_STATUS(tctx, status, NT_STATUS_OK); diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index 1f31fbc515..d73ac1327e 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -296,7 +296,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct c[i]->async.private_data = count; } - event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); + event_ctx = tctx->ev; printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(event_ctx); @@ -354,7 +354,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx) printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops); - event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); + event_ctx = tctx->ev; c = talloc_array(tctx, struct composite_context *, torture_numops); for (i=0; i<torture_numops; i++) { diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index b28e429a75..00617f4072 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -178,12 +178,11 @@ static bool _test_DsBind(struct torture_context *tctx, { NTSTATUS status; bool ret = true; - struct event_context *event = NULL; status = dcerpc_pipe_connect_b(ctx, &b->pipe, ctx->drsuapi_binding, &ndr_table_drsuapi, - credentials, event, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); @@ -254,10 +253,11 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx) struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; bool ret = true; - - struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; struct cldap_netlogon search; - + + cldap = cldap_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + r.in.bind_handle = &ctx->admin.drsuapi.bind_handle; r.in.level = 1; r.in.req.req1.codepage = 1252; /* western european */ diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index 849b9fd1e9..cd5eb32fa8 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -39,7 +39,7 @@ bool torture_rpc_join(struct torture_context *torture) "IPC$", NULL, machine_account, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); @@ -65,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture) "IPC$", NULL, machine_account, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 6e38d0465a..7c8e78b160 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx, status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL, tctx->lp_ctx); + cmdline_credentials, tctx->ev, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { printf("Failed to connect to remote server: %s %s\n", @@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx, binding->assoc_group_id = assoc_group_id; status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL, tctx->lp_ctx); + cmdline_credentials, tctx->ev, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { *p = NULL; @@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL, tctx->lp_ctx); + tcase_data->credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); @@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL, tctx->lp_ctx); + tcase_data->credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 8eb1f54b4f..40a7c156f4 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -89,7 +89,7 @@ bool torture_bind_authcontext(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -303,7 +303,7 @@ bool torture_bind_samba3(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1220,7 +1220,7 @@ bool torture_netlogon_samba3(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, anon_creds, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1307,7 +1307,7 @@ static bool test_join3(struct torture_context *tctx, lp_smb_ports(tctx->lp_ctx), "IPC$", NULL, smb_creds, lp_resolve_context(tctx->lp_ctx), - NULL, &options); + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1682,7 +1682,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); @@ -1709,7 +1709,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, anon_creds, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) anon smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 24b2511bc7..ab3283a952 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1602,7 +1602,7 @@ bool torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_pipe_connect_b(mem_ctx, &p, b, &ndr_table_netlogon, - machine_credentials, NULL, torture->lp_ctx); + machine_credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 3b152d92aa..9705f7b0de 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -1560,7 +1560,7 @@ bool torture_rpc_samsync(struct torture_context *torture) status = dcerpc_pipe_connect_b(samsync_state, &samsync_state->p, b, &ndr_table_netlogon, - credentials, NULL, torture->lp_ctx); + credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); @@ -1598,7 +1598,7 @@ bool torture_rpc_samsync(struct torture_context *torture) &samsync_state->p_netlogon_wksta, b_netlogon_wksta, &ndr_table_netlogon, - credentials_wksta, NULL, torture->lp_ctx); + credentials_wksta, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 46605e53e6..c89b71baaf 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -258,7 +258,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -328,7 +328,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -370,7 +370,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags &= ~DCERPC_AUTH_OPTIONS; status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel"); torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds), @@ -453,12 +453,12 @@ bool torture_rpc_schannel2(struct torture_context *torture) printf("Opening first connection\n"); status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon, - credentials1, NULL, torture->lp_ctx); + credentials1, torture->ev, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); torture_comment(torture, "Opening second connection\n"); status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon, - credentials2, NULL, torture->lp_ctx); + credentials2, torture->ev, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); credentials1->netlogon_creds = NULL; diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c index fcb828ddb2..0df7e576ee 100644 --- a/source4/torture/rpc/session_key.c +++ b/source4/torture/rpc/session_key.c @@ -158,7 +158,11 @@ static bool test_secrets(struct torture_context *torture, const void *_data) binding->flags |= settings->bindoptions; torture_assert_ntstatus_ok(torture, - dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx), + dcerpc_pipe_connect_b(torture, &p, binding, + &ndr_table_lsarpc, + cmdline_credentials, + torture->ev, + torture->lp_ctx), "connect"); if (!test_lsa_OpenPolicy2(p, torture, &handle)) { diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c index c14be9e2d0..d7482ddcf1 100644 --- a/source4/torture/unix/unix_info2.c +++ b/source4/torture/unix/unix_info2.c @@ -63,8 +63,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx) lp_smb_ports(tctx->lp_ctx), share, NULL, cmdline_credentials, - lp_resolve_context(tctx->lp_ctx), NULL, - &options); + lp_resolve_context(tctx->lp_ctx), + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { printf("failed to connect to //%s/%s: %s\n", diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index a1333ac5bd..d4f19bb57a 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -84,7 +84,7 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx, lp_smb_ports(tctx->lp_ctx), share, NULL, creds, lp_resolve_context(tctx->lp_ctx), - NULL, &options); + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { printf("failed to connect to //%s/%s: %s\n", |