summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-09-09 21:45:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:01 -0500
commit0ac1490a89a29161d26ba7d2e404b39390469128 (patch)
tree514ccaac47bbf2ee11a3d2808233255be83cc40a /source4
parent9cd63ddb5d9f4c5191a8b4b32c99de4c72344111 (diff)
downloadsamba-0ac1490a89a29161d26ba7d2e404b39390469128.tar.gz
samba-0ac1490a89a29161d26ba7d2e404b39390469128.tar.bz2
samba-0ac1490a89a29161d26ba7d2e404b39390469128.zip
r10132: Confirm that openX with OPEN_EXEC implies read only.
Jeremy. (This used to be commit da70b2ab2df6d8239811b12b471c578cbff6dca8)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/open.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 9433232bc8..6bb27bf25c 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -265,6 +265,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
union smb_open io;
union smb_fileinfo finfo;
const char *fname = BASEDIR "\\torture_openx.txt";
+ const char *fname_exe = BASEDIR "\\torture_openx.exe";
NTSTATUS status;
int fnum = -1, fnum2;
BOOL ret = True;
@@ -444,8 +445,33 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ /* Check the mapping for open exec. */
+
+ /* First create an .exe file. */
+ smbcli_unlink(cli->tree, fname_exe);
+ fnum = create_complex_file(cli, mem_ctx, fname_exe);
+ smbcli_close(cli->tree, fnum);
+
+ io.openx.level = RAW_OPEN_OPENX;
+ io.openx.in.fname = fname_exe;
+ io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
+ io.openx.in.open_mode = OPENX_MODE_ACCESS_EXEC | OPENX_MODE_DENY_NONE;
+ io.openx.in.search_attrs = 0;
+ io.openx.in.file_attrs = 0;
+ io.openx.in.write_time = 0;
+ io.openx.in.size = 0;
+ io.openx.in.timeout = 0;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ /* Can we read and write ? */
+ CHECK_RDWR(io.openx.out.fnum, RDWR_RDONLY);
+ smbcli_close(cli->tree, io.openx.out.fnum);
+ smbcli_unlink(cli->tree, fname);
+
done:
smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname_exe);
smbcli_unlink(cli->tree, fname);
return ret;