summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-12 23:01:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:05 -0500
commit90be000cd5d02e480bba8d68a56e5b8a2f8711ab (patch)
tree236958fdf5cbee8122f35870ea90377463209697
parenta42365befc91b673c478d9a8520a49b9fd7d724b (diff)
downloadsamba-90be000cd5d02e480bba8d68a56e5b8a2f8711ab.tar.gz
samba-90be000cd5d02e480bba8d68a56e5b8a2f8711ab.tar.bz2
samba-90be000cd5d02e480bba8d68a56e5b8a2f8711ab.zip
r16173: Use memory context provided by smbtorture.
(This used to be commit 88046d59517a595cfb8e9385ad87e8460eececac)
-rw-r--r--source4/torture/raw/samba3hide.c73
1 files changed, 30 insertions, 43 deletions
diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c
index 1aeda643e3..1f4f987a43 100644
--- a/source4/torture/raw/samba3hide.c
+++ b/source4/torture/raw/samba3hide.c
@@ -169,41 +169,33 @@ static NTSTATUS second_tcon(TALLOC_CTX *mem_ctx,
BOOL torture_samba3_hide(struct torture_context *torture)
{
struct smbcli_state *cli;
- BOOL ret = False;
- TALLOC_CTX *mem_ctx;
const char *fname = "test.txt";
int fnum;
NTSTATUS status;
struct smbcli_tree *hideunread;
struct smbcli_tree *hideunwrite;
- mem_ctx = talloc_init("torture_samba3_unixinfo");
- if (mem_ctx == NULL) {
- d_printf("talloc_init failed\n");
- return False;
- }
-
if (!torture_open_connection_share(
- mem_ctx, &cli, lp_parm_string(-1, "torture", "host"),
+ torture, &cli, lp_parm_string(-1, "torture", "host"),
lp_parm_string(-1, "torture", "share"), NULL)) {
d_printf("torture_open_connection_share failed\n");
- goto done;
+ return False;
}
- status = second_tcon(mem_ctx, cli->session, "hideunread",
+ status = second_tcon(torture, cli->session, "hideunread",
&hideunread);
if (!NT_STATUS_IS_OK(status)) {
d_printf("second_tcon(hideunread) failed: %s\n",
nt_errstr(status));
- goto done;
+ return False;
}
- status = second_tcon(mem_ctx, cli->session, "hideunwrite",
+ status = second_tcon(torture, cli->session, "hideunwrite",
&hideunwrite);
if (!NT_STATUS_IS_OK(status)) {
d_printf("second_tcon(hideunwrite) failed: %s\n",
nt_errstr(status));
- goto done;
+ return False;
}
status = smbcli_unlink(cli->tree, fname);
@@ -216,14 +208,14 @@ BOOL torture_samba3_hide(struct torture_context *torture)
if (fnum == -1) {
d_printf("Failed to create %s - %s\n", fname,
smbcli_errstr(cli->tree));
- goto done;
+ return False;
}
smbcli_close(cli->tree, fnum);
if (!smbcli_file_exists(cli->tree, fname)) {
d_printf("%s does not exist\n", fname);
- goto done;
+ return False;
}
/* R/W file should be visible everywhere */
@@ -231,27 +223,27 @@ BOOL torture_samba3_hide(struct torture_context *torture)
status = smbcli_chmod(cli->tree, fname, UNIX_R_USR|UNIX_W_USR);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_chmod failed: %s\n", nt_errstr(status));
- goto done;
+ return False;
}
- if (!is_writeable(mem_ctx, cli->tree, fname)) {
+ if (!is_writeable(torture, cli->tree, fname)) {
d_printf("File not writable\n");
- goto done;
+ return False;
}
if (!is_readable(cli->tree, fname)) {
d_printf("File not readable\n");
- goto done;
+ return False;
}
if (!is_visible(cli->tree, fname)) {
d_printf("r/w file not visible via normal share\n");
- goto done;
+ return False;
}
if (!is_visible(hideunread, fname)) {
d_printf("r/w file not visible via hide unreadable\n");
- goto done;
+ return False;
}
if (!is_visible(hideunwrite, fname)) {
d_printf("r/w file not visible via hide unwriteable\n");
- goto done;
+ return False;
}
/* R/O file should not be visible via hide unwriteable files */
@@ -260,27 +252,27 @@ BOOL torture_samba3_hide(struct torture_context *torture)
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_chmod failed: %s\n", nt_errstr(status));
- goto done;
+ return False;
}
- if (is_writeable(mem_ctx, cli->tree, fname)) {
+ if (is_writeable(torture, cli->tree, fname)) {
d_printf("r/o is writable\n");
- goto done;
+ return False;
}
if (!is_readable(cli->tree, fname)) {
d_printf("r/o not readable\n");
- goto done;
+ return False;
}
if (!is_visible(cli->tree, fname)) {
d_printf("r/o file not visible via normal share\n");
- goto done;
+ return False;
}
if (!is_visible(hideunread, fname)) {
d_printf("r/o file not visible via hide unreadable\n");
- goto done;
+ return False;
}
if (is_visible(hideunwrite, fname)) {
d_printf("r/o file visible via hide unwriteable\n");
- goto done;
+ return False;
}
/* inaccessible file should be only visible on normal share */
@@ -288,34 +280,29 @@ BOOL torture_samba3_hide(struct torture_context *torture)
status = smbcli_chmod(cli->tree, fname, 0);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_chmod failed: %s\n", nt_errstr(status));
- goto done;
+ return False;
}
- if (is_writeable(mem_ctx, cli->tree, fname)) {
+ if (is_writeable(torture, cli->tree, fname)) {
d_printf("inaccessible file is writable\n");
- goto done;
+ return False;
}
if (is_readable(cli->tree, fname)) {
d_printf("inaccessible file is readable\n");
- goto done;
+ return False;
}
if (!is_visible(cli->tree, fname)) {
d_printf("inaccessible file not visible via normal share\n");
- goto done;
+ return False;
}
if (is_visible(hideunread, fname)) {
d_printf("inaccessible file visible via hide unreadable\n");
- goto done;
+ return False;
}
if (is_visible(hideunwrite, fname)) {
d_printf("inaccessible file visible via hide unwriteable\n");
- goto done;
+ return False;
}
-
- ret = True;
-
- done:
- talloc_free(mem_ctx);
- return ret;
+ return True;
}