summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-13 23:58:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:24 -0500
commitc9cce9e6239314e4c30f042be0cd1d593d3d03d9 (patch)
treef0df78661f9f1b23929e89a42d059dd790e53579 /source4/torture/raw
parent275df9a5c3b1ade9f2467870c3628a2a896c004c (diff)
downloadsamba-c9cce9e6239314e4c30f042be0cd1d593d3d03d9.tar.gz
samba-c9cce9e6239314e4c30f042be0cd1d593d3d03d9.tar.bz2
samba-c9cce9e6239314e4c30f042be0cd1d593d3d03d9.zip
r4183: expanded the RAW-MKDIR torture test to test creation of EA lists
(This used to be commit 0134d8e9cc5634441b1aa6841bcd332c5afcc0f3)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/mkdir.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index 539258946a..eea5b20ffa 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -20,6 +20,8 @@
#include "includes.h"
+#define BASEDIR "\\mkdirtest"
+
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
printf("(%s) Incorrect status %s - should be %s\n", \
@@ -35,13 +37,13 @@ static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_mkdir md;
struct smb_rmdir rd;
- const char *path = "\\test_mkdir.dir";
+ const char *path = BASEDIR "\\mkdir.dir";
NTSTATUS status;
BOOL ret = True;
- /* cleanup */
- smbcli_rmdir(cli->tree, path);
- smbcli_unlink(cli->tree, path);
+ if (!torture_setup_dir(cli, BASEDIR)) {
+ return False;
+ }
/*
basic mkdir
@@ -95,23 +97,43 @@ static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
md.t2mkdir.in.path = path;
md.t2mkdir.in.num_eas = 0;
status = smb_raw_mkdir(cli->tree, &md);
- CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb_raw_rmdir(cli->tree, &rd);
+ CHECK_STATUS(status, NT_STATUS_OK);
printf("testing t2mkdir with EAs\n");
/* with EAs */
- md.t2mkdir.in.num_eas = 1;
- md.t2mkdir.in.eas = talloc_p(mem_ctx, struct ea_struct);
+ md.t2mkdir.level = RAW_MKDIR_T2MKDIR;
+ md.t2mkdir.in.path = path;
+ md.t2mkdir.in.num_eas = 3;
+ md.t2mkdir.in.eas = talloc_array_p(mem_ctx, struct ea_struct, md.t2mkdir.in.num_eas);
md.t2mkdir.in.eas[0].flags = 0;
md.t2mkdir.in.eas[0].name.s = "EAONE";
- md.t2mkdir.in.eas[0].value = data_blob_talloc(mem_ctx, "1", 1);
+ md.t2mkdir.in.eas[0].value = data_blob_talloc(mem_ctx, "blah", 4);
+ md.t2mkdir.in.eas[1].flags = 0;
+ md.t2mkdir.in.eas[1].name.s = "EA TWO";
+ md.t2mkdir.in.eas[1].value = data_blob_talloc(mem_ctx, "foo bar", 7);
+ md.t2mkdir.in.eas[2].flags = 0;
+ md.t2mkdir.in.eas[2].name.s = "EATHREE";
+ md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3);
status = smb_raw_mkdir(cli->tree, &md);
- CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = torture_check_ea(cli, path, "EAONE", "blah");
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = torture_check_ea(cli, path, "EA TWO", "foo bar");
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = torture_check_ea(cli, path, "EATHREE", "xx1");
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb_raw_rmdir(cli->tree, &rd);
+ CHECK_STATUS(status, NT_STATUS_OK);
done:
- smbcli_rmdir(cli->tree, path);
- smbcli_unlink(cli->tree, path);
+ smb_raw_exit(cli->session);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}