summaryrefslogtreecommitdiff
path: root/source4/torture/torture.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-18 00:02:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:23 -0500
commitee57c76a687c72ac7e8dc7c135ab53baa7a42776 (patch)
tree7374b0dd40265004c6dbf35131a8fa12bcb8364f /source4/torture/torture.c
parent82dfe0b29b4d090a20e0bc07a22ee47a5f38330a (diff)
downloadsamba-ee57c76a687c72ac7e8dc7c135ab53baa7a42776.tar.gz
samba-ee57c76a687c72ac7e8dc7c135ab53baa7a42776.tar.bz2
samba-ee57c76a687c72ac7e8dc7c135ab53baa7a42776.zip
r7704: - fixed open_nbt_connection() to return NULL when the connection failed
- got rid of smbcli_shutdown() and use talloc_free() instead. (This used to be commit 1011b1bf51d420d6702ef448c894ea8ebeafa284)
Diffstat (limited to 'source4/torture/torture.c')
-rw-r--r--source4/torture/torture.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 5036822aa4..1ca4046a49 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -56,21 +56,24 @@ static struct smbcli_state *open_nbt_connection(void)
cli = smbcli_state_init(NULL);
if (!cli) {
printf("Failed initialize smbcli_struct to connect with %s\n", host);
- return NULL;
+ goto failed;
}
if (!smbcli_socket_connect(cli, host)) {
printf("Failed to connect with %s\n", host);
- return cli;
+ goto failed;
}
if (!smbcli_transport_establish(cli, &calling, &called)) {
printf("%s rejected the session\n",host);
- smbcli_shutdown(cli);
- return NULL;
+ goto failed;
}
return cli;
+
+failed:
+ talloc_free(cli);
+ return NULL;
}
BOOL torture_open_connection_share(struct smbcli_state **c,
@@ -112,7 +115,7 @@ BOOL torture_close_connection(struct smbcli_state *c)
printf("tdis failed (%s)\n", smbcli_errstr(c->tree));
ret = False;
}
- smbcli_shutdown(c);
+ talloc_free(c);
return ret;
}
@@ -489,7 +492,7 @@ static BOOL run_tcon_test(void)
if (NT_STATUS_IS_ERR(smbcli_tconX(cli, share, "?????", password))) {
printf("%s refused 2nd tree connect (%s)\n", host,
smbcli_errstr(cli->tree));
- smbcli_shutdown(cli);
+ talloc_free(cli);
return False;
}
@@ -649,7 +652,7 @@ static BOOL run_tcon_devtype_test(void)
if (!tcon_devtest(cli1, share, "FOOBA", NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
- smbcli_shutdown(cli1);
+ talloc_free(cli1);
if (ret)
printf("Passed tcondevtest\n");