diff --git a/libcli/echo/tests/echo.c b/libcli/echo/tests/echo.c index 8e5150403ee..e465b99956f 100644 --- a/libcli/echo/tests/echo.c +++ b/libcli/echo/tests/echo.c @@ -85,13 +85,13 @@ NTSTATUS torture_libcli_echo_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - suite = torture_suite_create(talloc_autofree_context(), "echo"); + suite = torture_suite_create(ctx, "echo"); NT_STATUS_HAVE_NO_MEMORY(suite); torture_suite_add_simple_test(suite, "udp", torture_echo_udp); suite->description = talloc_strdup(suite, "libcli/echo interface tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index f5ee966eac8..6e989bfbf01 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -1937,7 +1937,7 @@ static bool run_birthtimetest(struct torture_context *tctx, NTSTATUS torture_base_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "base"); + struct torture_suite *suite = torture_suite_create(ctx, "base"); torture_suite_add_2smb_test(suite, "fdpass", run_fdpasstest); torture_suite_add_suite(suite, torture_base_locktest(suite)); @@ -1996,7 +1996,7 @@ NTSTATUS torture_base_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "Basic SMB tests (imported from the original smbtorture)"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/dfs/domaindfs.c b/source4/torture/dfs/domaindfs.c index 82e6843bbcf..4bc51926082 100644 --- a/source4/torture/dfs/domaindfs.c +++ b/source4/torture/dfs/domaindfs.c @@ -503,7 +503,7 @@ static bool test_low_referral_level(struct torture_context *tctx, NTSTATUS torture_dfs_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "dfs"); + struct torture_suite *suite = torture_suite_create(ctx, "dfs"); struct torture_suite *suite_basic = torture_suite_create(suite, "domain"); torture_suite_add_suite(suite, suite_basic); @@ -534,7 +534,7 @@ NTSTATUS torture_dfs_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "DFS referrals calls"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/dns/dlz_bind9.c b/source4/torture/dns/dlz_bind9.c index 7a01ec0ec28..f16d16ec061 100644 --- a/source4/torture/dns/dlz_bind9.c +++ b/source4/torture/dns/dlz_bind9.c @@ -1084,12 +1084,11 @@ NTSTATUS torture_bind_dns_init(TALLOC_CTX *); NTSTATUS torture_bind_dns_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - TALLOC_CTX *mem_ctx = talloc_autofree_context(); /* register DNS related test cases */ - suite = dlz_bind9_suite(mem_ctx); + suite = dlz_bind9_suite(ctx); if (!suite) return NT_STATUS_NO_MEMORY; - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/dns/internal_dns.c b/source4/torture/dns/internal_dns.c index ac234e1b38b..2ccc7ed5aa1 100644 --- a/source4/torture/dns/internal_dns.c +++ b/source4/torture/dns/internal_dns.c @@ -179,12 +179,11 @@ NTSTATUS torture_internal_dns_init(TALLOC_CTX *); NTSTATUS torture_internal_dns_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - TALLOC_CTX *mem_ctx = talloc_autofree_context(); /* register internal DNS torture test cases */ - suite = internal_dns_suite(mem_ctx); + suite = internal_dns_suite(ctx); if (!suite) return NT_STATUS_NO_MEMORY; - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/drs/drs_init.c b/source4/torture/drs/drs_init.c index 2dcb6f1b56d..bbe246d189c 100644 --- a/source4/torture/drs/drs_init.c +++ b/source4/torture/drs/drs_init.c @@ -65,17 +65,16 @@ static struct torture_suite * torture_drs_unit_suite(TALLOC_CTX *mem_ctx, NTSTATUS torture_drs_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - TALLOC_CTX *mem_ctx = talloc_autofree_context(); /* register RPC related test cases */ - suite = torture_drs_rpc_suite(mem_ctx, "drs.rpc"); + suite = torture_drs_rpc_suite(ctx, "drs.rpc"); if (!suite) return NT_STATUS_NO_MEMORY; - torture_register_suite(suite); + torture_register_suite(ctx, suite); /* register DRS Unit test cases */ - suite = torture_drs_unit_suite(mem_ctx, "drs.unit"); + suite = torture_drs_unit_suite(ctx, "drs.unit"); if (!suite) return NT_STATUS_NO_MEMORY; - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/krb5/kdc-heimdal.c b/source4/torture/krb5/kdc-heimdal.c index b6c811724bc..2cf972cea6f 100644 --- a/source4/torture/krb5/kdc-heimdal.c +++ b/source4/torture/krb5/kdc-heimdal.c @@ -687,7 +687,7 @@ static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx) NTSTATUS torture_krb5_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "krb5"); + struct torture_suite *suite = torture_suite_create(ctx, "krb5"); struct torture_suite *kdc_suite = torture_suite_create(suite, "kdc"); suite->description = talloc_strdup(suite, "Kerberos tests"); kdc_suite->description = talloc_strdup(kdc_suite, "Kerberos KDC tests"); @@ -719,6 +719,6 @@ NTSTATUS torture_krb5_init(TALLOC_CTX *ctx) torture_suite_add_suite(kdc_suite, torture_krb5_canon(kdc_suite)); torture_suite_add_suite(suite, kdc_suite); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/krb5/kdc-mit.c b/source4/torture/krb5/kdc-mit.c index 29cb93d9e62..77fa8c34a95 100644 --- a/source4/torture/krb5/kdc-mit.c +++ b/source4/torture/krb5/kdc-mit.c @@ -749,7 +749,7 @@ static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx) NTSTATUS torture_krb5_init(TALLOC_CTX *ctx) { struct torture_suite *suite = - torture_suite_create(talloc_autofree_context(), "krb5"); + torture_suite_create(ctx, "krb5"); struct torture_suite *kdc_suite = torture_suite_create(suite, "kdc"); suite->description = talloc_strdup(suite, "Kerberos tests"); kdc_suite->description = talloc_strdup(kdc_suite, "Kerberos KDC tests"); @@ -788,7 +788,7 @@ NTSTATUS torture_krb5_init(TALLOC_CTX *ctx) torture_suite_add_suite(suite, kdc_suite); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index 50c5e033cb5..9d53da4b01c 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -131,7 +131,7 @@ NTSTATUS torture_ldap_close(struct ldap_connection *conn) NTSTATUS torture_ldap_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "ldap"); + struct torture_suite *suite = torture_suite_create(ctx, "ldap"); torture_suite_add_simple_test(suite, "bench-cldap", torture_bench_cldap); torture_suite_add_simple_test(suite, "basic", torture_ldap_basic); torture_suite_add_simple_test(suite, "sort", torture_ldap_sort); @@ -144,7 +144,7 @@ NTSTATUS torture_ldap_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "LDAP and CLDAP tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/libnet/libnet.c b/source4/torture/libnet/libnet.c index 7b9c31a6daa..faf7bca1a5e 100644 --- a/source4/torture/libnet/libnet.c +++ b/source4/torture/libnet/libnet.c @@ -27,7 +27,7 @@ NTSTATUS torture_net_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "net"); + ctx, "net"); torture_suite_add_simple_test(suite, "userinfo", torture_userinfo); torture_suite_add_simple_test(suite, "useradd", torture_useradd); @@ -64,7 +64,7 @@ NTSTATUS torture_net_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "libnet convenience interface tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/libnetapi/libnetapi.c b/source4/torture/libnetapi/libnetapi.c index 856b2c8f997..9d3973a2bb8 100644 --- a/source4/torture/libnetapi/libnetapi.c +++ b/source4/torture/libnetapi/libnetapi.c @@ -84,7 +84,7 @@ NTSTATUS torture_libnetapi_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - suite = torture_suite_create(talloc_autofree_context(), "netapi"); + suite = torture_suite_create(ctx, "netapi"); torture_suite_add_simple_test(suite, "server", torture_libnetapi_server); torture_suite_add_simple_test(suite, "group", torture_libnetapi_group); @@ -93,7 +93,7 @@ NTSTATUS torture_libnetapi_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "libnetapi convenience interface tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/libsmbclient/libsmbclient.c b/source4/torture/libsmbclient/libsmbclient.c index c714a975c76..b93fda00b69 100644 --- a/source4/torture/libsmbclient/libsmbclient.c +++ b/source4/torture/libsmbclient/libsmbclient.c @@ -205,7 +205,7 @@ NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx) { struct torture_suite *suite; - suite = torture_suite_create(talloc_autofree_context(), "libsmbclient"); + suite = torture_suite_create(ctx, "libsmbclient"); torture_suite_add_simple_test(suite, "version", torture_libsmbclient_version); torture_suite_add_simple_test(suite, "initialize", torture_libsmbclient_initialize); @@ -215,7 +215,7 @@ NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "libsmbclient interface tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c index e7231524a51..d1c523bdc1f 100644 --- a/source4/torture/local/local.c +++ b/source4/torture/local/local.c @@ -83,7 +83,7 @@ NTSTATUS torture_local_init(TALLOC_CTX *ctx) { int i; struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "local"); + ctx, "local"); torture_suite_add_simple_test(suite, "talloc", torture_local_talloc); torture_suite_add_simple_test(suite, "replace", torture_local_replace); @@ -103,12 +103,12 @@ NTSTATUS torture_local_init(TALLOC_CTX *ctx) for (i = 0; suite_generators[i]; i++) torture_suite_add_suite(suite, - suite_generators[i](talloc_autofree_context())); + suite_generators[i](ctx)); suite->description = talloc_strdup(suite, "Local, Samba-specific tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index 979f16e5666..8e4a984c9b5 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -287,12 +287,12 @@ bool torture_nbench(struct torture_context *torture) NTSTATUS torture_nbench_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "bench"); + ctx, "bench"); torture_suite_add_simple_test(suite, "nbench", torture_nbench); suite->description = talloc_strdup(suite, "Benchmarks"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c index ac53c9167c5..f350885ed49 100644 --- a/source4/torture/nbt/nbt.c +++ b/source4/torture/nbt/nbt.c @@ -51,7 +51,7 @@ bool torture_nbt_get_name(struct torture_context *tctx, NTSTATUS torture_nbt_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "nbt"); + ctx, "nbt"); /* nbt tests */ torture_suite_add_suite(suite, torture_nbt_register(suite)); torture_suite_add_suite(suite, torture_nbt_wins(suite)); @@ -63,7 +63,7 @@ NTSTATUS torture_nbt_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "NetBIOS over TCP/IP and WINS tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/ntp/ntp_signd.c b/source4/torture/ntp/ntp_signd.c index 1963e573246..d2a41819fcf 100644 --- a/source4/torture/ntp/ntp_signd.c +++ b/source4/torture/ntp/ntp_signd.c @@ -286,7 +286,7 @@ static bool test_ntp_signd(struct torture_context *tctx, NTSTATUS torture_ntp_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "ntp"); + struct torture_suite *suite = torture_suite_create(ctx, "ntp"); struct torture_rpc_tcase *tcase; tcase = torture_suite_add_machine_workstation_rpc_iface_tcase(suite, @@ -296,7 +296,7 @@ NTSTATUS torture_ntp_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "NTP tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index 043154b4621..054e01141e0 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -243,7 +243,7 @@ bool torture_rap_scan(struct torture_context *torture, struct smbcli_state *cli) NTSTATUS torture_rap_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "rap"); + struct torture_suite *suite = torture_suite_create(ctx, "rap"); struct torture_suite *suite_basic = torture_suite_create(suite, "basic"); torture_suite_add_suite(suite, suite_basic); @@ -269,7 +269,7 @@ NTSTATUS torture_rap_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "Remote Administration Protocol tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c index 5b237d32ebf..a225efe0b5d 100644 --- a/source4/torture/raw/raw.c +++ b/source4/torture/raw/raw.c @@ -26,7 +26,7 @@ NTSTATUS torture_raw_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "raw"); + ctx, "raw"); /* RAW smb tests */ torture_suite_add_simple_test(suite, "bench-oplock", torture_bench_oplock); torture_suite_add_simple_test(suite, "ping-pong", torture_ping_pong); @@ -79,7 +79,7 @@ NTSTATUS torture_raw_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "Tests for the raw SMB interface"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 12dcced1e2a..36148cce7fd 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -484,7 +484,7 @@ _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_ex( NTSTATUS torture_rpc_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "rpc"); + struct torture_suite *suite = torture_suite_create(ctx, "rpc"); ndr_table_init(); @@ -570,7 +570,7 @@ NTSTATUS torture_rpc_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "DCE/RPC protocol and interface tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index 3c3c22a43f3..043372f8d88 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -145,7 +145,7 @@ struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite, NTSTATUS torture_smb2_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "smb2"); + struct torture_suite *suite = torture_suite_create(ctx, "smb2"); torture_suite_add_simple_test(suite, "connect", torture_smb2_connect); torture_suite_add_suite(suite, torture_smb2_scan_init()); torture_suite_add_suite(suite, torture_smb2_getinfo_init()); @@ -180,7 +180,7 @@ NTSTATUS torture_smb2_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "SMB2-specific tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/smbtorture.h b/source4/torture/smbtorture.h index 7480f241d97..5a75f06bce5 100644 --- a/source4/torture/smbtorture.h +++ b/source4/torture/smbtorture.h @@ -35,7 +35,7 @@ extern int torture_numasync; struct torture_test; int torture_init(TALLOC_CTX *); -bool torture_register_suite(struct torture_suite *suite); +bool torture_register_suite(TALLOC_CTX *, struct torture_suite *suite); void torture_shell(struct torture_context *tctx); void torture_print_testsuites(bool structured); bool torture_run_named_tests(struct torture_context *torture, const char *name, diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 3ef1f3b49ba..cc29ffad09a 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -33,13 +33,13 @@ _PUBLIC_ int torture_numasync=100; struct torture_suite *torture_root = NULL; -bool torture_register_suite(struct torture_suite *suite) +bool torture_register_suite(TALLOC_CTX *mem_ctx, struct torture_suite *suite) { if (!suite) return true; if (torture_root == NULL) - torture_root = talloc_zero(talloc_autofree_context(), struct torture_suite); + torture_root = talloc_zero(mem_ctx, struct torture_suite); return torture_suite_add_suite(torture_root, suite); } diff --git a/source4/torture/unix/unix.c b/source4/torture/unix/unix.c index 0ea1b51f9bc..8ee3d8ddf75 100644 --- a/source4/torture/unix/unix.c +++ b/source4/torture/unix/unix.c @@ -24,7 +24,7 @@ NTSTATUS torture_unix_init(TALLOC_CTX *ctx) { struct torture_suite *suite = - torture_suite_create(talloc_autofree_context(), "unix"); + torture_suite_create(ctx, "unix"); suite->description = talloc_strdup(suite, "CIFS UNIX extensions tests"); @@ -34,7 +34,7 @@ NTSTATUS torture_unix_init(TALLOC_CTX *ctx) torture_suite_add_simple_test(suite, "info2", unix_torture_unix_info2); - return (torture_register_suite(suite)) ? NT_STATUS_OK + return (torture_register_suite(ctx, suite)) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } diff --git a/source4/torture/vfs/vfs.c b/source4/torture/vfs/vfs.c index 8c1f1ff6f40..e16757643f5 100644 --- a/source4/torture/vfs/vfs.c +++ b/source4/torture/vfs/vfs.c @@ -104,7 +104,7 @@ struct torture_test *torture_suite_add_2ns_smb2_test(struct torture_suite *suite NTSTATUS torture_vfs_init(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create( - talloc_autofree_context(), "vfs"); + ctx, "vfs"); suite->description = talloc_strdup(suite, "VFS modules tests"); @@ -113,7 +113,7 @@ NTSTATUS torture_vfs_init(TALLOC_CTX *ctx) torture_suite_add_suite(suite, torture_acl_xattr()); torture_suite_add_suite(suite, torture_vfs_fruit_file_id()); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; } diff --git a/source4/torture/winbind/winbind.c b/source4/torture/winbind/winbind.c index 74de3819722..d05918ae1e6 100644 --- a/source4/torture/winbind/winbind.c +++ b/source4/torture/winbind/winbind.c @@ -292,12 +292,12 @@ static bool torture_winbind_pac_krb5(struct torture_context *tctx) NTSTATUS torture_winbind_init(TALLOC_CTX *ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "winbind"); + struct torture_suite *suite = torture_suite_create(ctx, "winbind"); struct torture_suite *pac_suite; torture_suite_add_suite(suite, torture_winbind_struct_init()); torture_suite_add_suite(suite, torture_wbclient()); - pac_suite = torture_suite_create(talloc_autofree_context(), "pac"); + pac_suite = torture_suite_create(ctx, "pac"); torture_suite_add_simple_test(pac_suite, "GSSAPI", torture_winbind_pac_gssapi); torture_suite_add_simple_test(pac_suite, @@ -311,7 +311,7 @@ NTSTATUS torture_winbind_init(TALLOC_CTX *ctx) suite->description = talloc_strdup(suite, "WINBIND tests"); - torture_register_suite(suite); + torture_register_suite(ctx, suite); return NT_STATUS_OK; }