summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-24 15:09:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:42 -0500
commit880a9be3f7448695db66b4e0c55411abd82bebca (patch)
tree68ed60b7040d283a06477a8261617e21623a72b6 /source4/torture
parentd9a1d365e3fa0695eac6d4371e4c29ae2f669e85 (diff)
downloadsamba-880a9be3f7448695db66b4e0c55411abd82bebca.tar.gz
samba-880a9be3f7448695db66b4e0c55411abd82bebca.tar.bz2
samba-880a9be3f7448695db66b4e0c55411abd82bebca.zip
r20341: Make sure we do not regress on r20338 in Samba3
(This used to be commit 64ee399c964c2935c1386123e2e636c266c8c6a8)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/base.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 2a7ba85b3d..39002391c6 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -1569,6 +1569,67 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx)
}
}
+ {
+ /*
+ * Samba 3.0.23 has a bug that an existing file can be opened
+ * as a directory using ntcreate&x. Test this.
+ */
+
+ const char *fname = "\\test_dir.txt";
+
+ fnum = smbcli_open(cli_nt->tree, fname, O_RDWR|O_CREAT,
+ DENY_NONE);
+ if (fnum == -1) {
+ d_printf("(%s) smbcli_open failed: %s\n", __location__,
+ smbcli_errstr(cli_nt->tree));
+ }
+ smbcli_close(cli_nt->tree, fnum);
+
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
+ io.ntcreatex.in.alloc_size = 0;
+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE|
+ NTCREATEX_SHARE_ACCESS_DELETE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+ io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.ntcreatex.in.impersonation =
+ NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = fname;
+ io.ntcreatex.in.flags = 0;
+
+ status = smb_raw_open(cli_nt->tree, mem_ctx, &io);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_A_DIRECTORY)) {
+ torture_comment(tctx, "ntcreate as dir gave %s, "
+ "expected NT_STATUS_NOT_A_DIRECTORY\n",
+ nt_errstr(status));
+ result = False;
+ }
+
+ if (NT_STATUS_IS_OK(status)) {
+ smbcli_close(cli_nt->tree, io.ntcreatex.out.file.fnum);
+ }
+
+ status = smb_raw_open(cli_dos->tree, mem_ctx, &io);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_DOS(ERRDOS,
+ ERRbaddirectory))) {
+ torture_comment(tctx, "ntcreate as dir gave %s, "
+ "expected NT_STATUS_NOT_A_DIRECTORY\n",
+ nt_errstr(status));
+ result = False;
+ }
+
+ if (NT_STATUS_IS_OK(status)) {
+ smbcli_close(cli_dos->tree,
+ io.ntcreatex.out.file.fnum);
+ }
+
+ smbcli_unlink(cli_nt->tree, fname);
+ }
+
if (!torture_setting_bool(tctx, "samba3", False)) {
goto done;
}