diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-28 05:44:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:25 -0500 |
commit | b2f1a29e4348a5bc34a87d72d526e23e421ed9d5 (patch) | |
tree | c69987090647da615193f1361e03986588ac164d /source4/torture | |
parent | a675b09e8d45b9298df8f8c82bbaa7b91a793eb5 (diff) | |
download | samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.gz samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.bz2 samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.zip |
r2710: continue with the new style of providing a parent context whenever
possible to a structure creation routine. This makes for much easier
global cleanup.
(This used to be commit e14ee428ec357fab76a960387a9820a673786e27)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/gentest.c | 2 | ||||
-rw-r--r-- | source4/torture/locktest.c | 2 | ||||
-rw-r--r-- | source4/torture/locktest2.c | 7 | ||||
-rw-r--r-- | source4/torture/masktest.c | 2 | ||||
-rw-r--r-- | source4/torture/raw/context.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 40 | ||||
-rw-r--r-- | source4/torture/torture.c | 8 |
7 files changed, 47 insertions, 18 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 71e5a8d8f9..22cbb79769 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -171,7 +171,7 @@ static BOOL connect_servers(void) printf("Connecting to \\\\%s\\%s as %s - instance %d\n", servers[i].server_name, servers[i].share_name, servers[i].username, j); - status = smbcli_full_connection(&servers[i].cli[j], + status = smbcli_full_connection(NULL, &servers[i].cli[j], "gentest", servers[i].server_name, NULL, servers[i].share_name, "?????", diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 494688dfb5..6d5558c6fd 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -119,7 +119,7 @@ static struct smbcli_state *connect_one(char *share, int snum) slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum); do { - status = smbcli_full_connection(&c, myname, + status = smbcli_full_connection(NULL, &c, myname, server, NULL, share, "?????", servers[snum].username, lp_workgroup(), diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c index 63f71f2004..f474b3efa9 100644 --- a/source4/torture/locktest2.c +++ b/source4/torture/locktest2.c @@ -173,9 +173,10 @@ static struct smbcli_state *connect_one(char *share) slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); - nt_status = smbcli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", - username, lp_workgroup(), password, 0, - NULL); + nt_status = smbcli_full_connection(NULL, + &c, myname, server_n, NULL, 0, share, "?????", + username, lp_workgroup(), password, 0, + NULL); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status))); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index ee7e25ebbd..74c640d30b 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -169,7 +169,7 @@ static struct smbcli_state *connect_one(char *share) *share = 0; share++; - status = smbcli_full_connection(&c, "masktest", + status = smbcli_full_connection(NULL, &c, "masktest", server, NULL, share, "?????", username, lp_workgroup(), diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index b5f439b5e9..ad8245faaf 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -173,7 +173,6 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("logoff the new vuid\n"); status = smb_raw_ulogoff(session); CHECK_STATUS(status, NT_STATUS_OK); - talloc_free(session); printf("the new vuid should not now be accessible\n"); status = smb_raw_write(tree, &wr); @@ -186,9 +185,8 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_raw_close(cli->tree, &cl); CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE); - /* close down the new tree, which will also close the session - as the reference count will be 0 */ talloc_free(tree); + talloc_free(session); done: return ret; diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 5bc5b3bf49..ac09a346f6 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -2887,30 +2887,40 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_Connect4 r4; struct samr_Connect5 r5; union samr_ConnectInfo info; - BOOL ret = True; + struct policy_handle h; + BOOL ret = True, got_handle = False; printf("testing samr_Connect\n"); r.in.system_name = 0; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.connect_handle = handle; + r.out.connect_handle = &h; status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); ret = False; + } else { + got_handle = True; + *handle = h; } printf("testing samr_Connect2\n"); r2.in.system_name = NULL; r2.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r2.out.connect_handle = handle; + r2.out.connect_handle = &h; status = dcerpc_samr_Connect2(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("Connect2 failed - %s\n", nt_errstr(status)); ret = False; + } else { + if (got_handle) { + test_Close(p, mem_ctx, handle); + } + got_handle = True; + *handle = h; } printf("testing samr_Connect3\n"); @@ -2918,12 +2928,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r3.in.system_name = NULL; r3.in.unknown = 0; r3.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r3.out.connect_handle = handle; + r3.out.connect_handle = &h; status = dcerpc_samr_Connect3(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("Connect3 failed - %s\n", nt_errstr(status)); ret = False; + } else { + if (got_handle) { + test_Close(p, mem_ctx, handle); + } + got_handle = True; + *handle = h; } printf("testing samr_Connect4\n"); @@ -2931,12 +2947,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r4.in.system_name = ""; r4.in.unknown = 0; r4.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r4.out.connect_handle = handle; + r4.out.connect_handle = &h; status = dcerpc_samr_Connect4(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { printf("Connect4 failed - %s\n", nt_errstr(status)); ret = False; + } else { + if (got_handle) { + test_Close(p, mem_ctx, handle); + } + got_handle = True; + *handle = h; } printf("testing samr_Connect5\n"); @@ -2949,12 +2971,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r5.in.level = 1; r5.in.info = &info; r5.out.info = &info; - r5.out.connect_handle = handle; + r5.out.connect_handle = &h; status = dcerpc_samr_Connect5(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); ret = False; + } else { + if (got_handle) { + test_Close(p, mem_ctx, handle); + } + got_handle = True; + *handle = h; } return ret; diff --git a/source4/torture/torture.c b/source4/torture/torture.c index c6af807357..15be6e528b 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -43,7 +43,7 @@ static struct smbcli_state *open_nbt_connection(void) make_nmb_name(&calling, lp_netbios_name(), 0x0); choose_called_name(&called, host, 0x20); - cli = smbcli_state_init(); + cli = smbcli_state_init(NULL); if (!cli) { printf("Failed initialize smbcli_struct to connect with %s\n", host); return NULL; @@ -93,7 +93,8 @@ BOOL torture_open_connection_share(struct smbcli_state **c, if (use_kerberos) flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS; - status = smbcli_full_connection(c, lp_netbios_name(), + status = smbcli_full_connection(NULL, + c, lp_netbios_name(), hostname, NULL, sharename, "?????", username, username[0]?userdomain:"", @@ -857,7 +858,8 @@ static BOOL run_tcon_devtype_test(int dummy) const char *userdomain = lp_parm_string(-1, "torture", "userdomain"); const char *password = lp_parm_string(-1, "torture", "password"); - status = smbcli_full_connection(&cli1, lp_netbios_name(), + status = smbcli_full_connection(NULL, + &cli1, lp_netbios_name(), host, NULL, share, "?????", username, userdomain, |