summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-08-16 00:54:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:55 -0500
commit255c24eb8f6a341dbb9453d48119d8d6399bed43 (patch)
tree0efd36433423e1b5dc5e2d01af9749bd79b51624 /source4/torture/raw
parente42ff21109190a110138e2ceeef02e616399aeaa (diff)
downloadsamba-255c24eb8f6a341dbb9453d48119d8d6399bed43.tar.gz
samba-255c24eb8f6a341dbb9453d48119d8d6399bed43.tar.bz2
samba-255c24eb8f6a341dbb9453d48119d8d6399bed43.zip
r24477: Add a rename test to prove that NT_STATUS_OBJECT_NAME_COLLISION
is mapped to ERRDOS, ERRrename on a rename error, but mapped to ERRDOS, ERRfilexists on an open error. Jeremy. (This used to be commit e634c627b155b8ce9d325b7b23236861993cfd59)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/samba3misc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index b8a00ab4ed..ded230a423 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -327,8 +327,10 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
struct smbcli_state *cli_nt;
struct smbcli_state *cli_dos;
const char *fname = "test.txt";
+ const char *fname1 = "test1.txt";
const char *dirname = "testdir";
char *fpath;
+ char *fpath1;
int fnum;
NTSTATUS status;
BOOL ret = True;
@@ -406,6 +408,17 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
}
smbcli_close(cli_nt->tree, fnum);
+ if (!(fpath1 = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname1))) {
+ goto fail;
+ }
+ fnum = smbcli_open(cli_nt->tree, fpath1, O_RDWR | O_CREAT, DENY_NONE);
+ if (fnum == -1) {
+ d_printf("Could not create file %s: %s\n", fpath1,
+ smbcli_errstr(cli_nt->tree));
+ goto fail;
+ }
+ smbcli_close(cli_nt->tree, fnum);
+
/*
* Do a whole bunch of error code checks on chkpath
*/
@@ -533,6 +546,18 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
status = raw_smbcli_ntcreate(cli_dos->tree, fpath, NULL);
CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists));
+ /* Try the rename test. */
+ {
+ union smb_rename io;
+ io.rename.in.pattern1 = fpath1;
+ io.rename.in.pattern2 = fpath;
+
+ status = smb_raw_rename(cli_nt->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
+ status = smb_raw_rename(cli_dos->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRrename));
+ }
+
goto done;
fail: