diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-12-17 04:51:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:28 -0500 |
commit | 3b8e83a8c8f32ca658841f1fae344399a48d66a4 (patch) | |
tree | febc6b07ebea32366b3ecc8f7b4862f7294e6798 /source4/torture | |
parent | 50005129ab0a5c5f2422460e6d7c19616e5e1124 (diff) | |
download | samba-3b8e83a8c8f32ca658841f1fae344399a48d66a4.tar.gz samba-3b8e83a8c8f32ca658841f1fae344399a48d66a4.tar.bz2 samba-3b8e83a8c8f32ca658841f1fae344399a48d66a4.zip |
r4243: a sniff from kukks showed that the ea_set interface in trans2 setfileinfo allows
for multiple EAs to be set at once. This fixes all the ea code to allow for that.
(This used to be commit b26828bef5d55e5eef0e34a164e76292df45e207)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/gentest.c | 8 | ||||
-rw-r--r-- | source4/torture/raw/eas.c | 42 | ||||
-rw-r--r-- | source4/torture/torture_util.c | 19 |
3 files changed, 34 insertions, 35 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 6c2f9d37fa..01b4022d32 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1685,8 +1685,12 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) info->standard.in.access_time = gen_timet(); info->standard.in.write_time = gen_timet(); break; - case RAW_SFILEINFO_EA_SET: - info->ea_set.in.ea = gen_ea_struct(); + case RAW_SFILEINFO_EA_SET: { + static struct ea_struct ea; + info->ea_set.in.num_eas = 1; + info->ea_set.in.eas = &ea; + info->ea_set.in.eas[0] = gen_ea_struct(); + } break; case RAW_SFILEINFO_BASIC_INFO: case RAW_SFILEINFO_BASIC_INFORMATION: diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 00c2fac74a..572a551d17 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -80,30 +80,28 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ret &= check_ea(cli, fname, "EAONE", NULL); - printf("Adding first EA\n"); + printf("Adding first two EAs\n"); setfile.generic.level = RAW_SFILEINFO_EA_SET; setfile.generic.file.fnum = fnum; - setfile.ea_set.in.ea.flags = 0; - setfile.ea_set.in.ea.name.s = "EAONE"; - setfile.ea_set.in.ea.value = data_blob_string_const("VALUE1"); + setfile.ea_set.in.num_eas = 2; + setfile.ea_set.in.eas = talloc_array_p(mem_ctx, struct ea_struct, 2); + setfile.ea_set.in.eas[0].flags = 0; + setfile.ea_set.in.eas[0].name.s = "EAONE"; + setfile.ea_set.in.eas[0].value = data_blob_string_const("VALUE1"); + setfile.ea_set.in.eas[1].flags = 0; + setfile.ea_set.in.eas[1].name.s = "SECONDEA"; + setfile.ea_set.in.eas[1].value = data_blob_string_const("ValueTwo"); status = smb_raw_setfileinfo(cli->tree, &setfile); CHECK_STATUS(status, NT_STATUS_OK); ret &= check_ea(cli, fname, "EAONE", "VALUE1"); - - setfile.ea_set.in.ea.name.s = "SECONDEA"; - setfile.ea_set.in.ea.value = data_blob_string_const("ValueTwo"); - - printf("Adding second EA\n"); - status = smb_raw_setfileinfo(cli->tree, &setfile); - CHECK_STATUS(status, NT_STATUS_OK); - - ret &= check_ea(cli, fname, "EAONE", "VALUE1"); ret &= check_ea(cli, fname, "SECONDEA", "ValueTwo"); printf("Modifying 2nd EA\n"); - setfile.ea_set.in.ea.value = data_blob_string_const(" Changed Value"); + setfile.ea_set.in.num_eas = 1; + setfile.ea_set.in.eas[0].name.s = "SECONDEA"; + setfile.ea_set.in.eas[0].value = data_blob_string_const(" Changed Value"); status = smb_raw_setfileinfo(cli->tree, &setfile); CHECK_STATUS(status, NT_STATUS_OK); @@ -111,8 +109,8 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ret &= check_ea(cli, fname, "SECONDEA", " Changed Value"); printf("Setting a NULL EA\n"); - setfile.ea_set.in.ea.value = data_blob(NULL, 0); - setfile.ea_set.in.ea.name.s = "NULLEA"; + setfile.ea_set.in.eas[0].value = data_blob(NULL, 0); + setfile.ea_set.in.eas[0].name.s = "NULLEA"; status = smb_raw_setfileinfo(cli->tree, &setfile); CHECK_STATUS(status, NT_STATUS_OK); @@ -121,9 +119,9 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ret &= check_ea(cli, fname, "NULLEA", NULL); printf("Deleting first EA\n"); - setfile.ea_set.in.ea.flags = 0; - setfile.ea_set.in.ea.name.s = "EAONE"; - setfile.ea_set.in.ea.value = data_blob(NULL, 0); + setfile.ea_set.in.eas[0].flags = 0; + setfile.ea_set.in.eas[0].name.s = "EAONE"; + setfile.ea_set.in.eas[0].value = data_blob(NULL, 0); status = smb_raw_setfileinfo(cli->tree, &setfile); CHECK_STATUS(status, NT_STATUS_OK); @@ -131,9 +129,9 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ret &= check_ea(cli, fname, "SECONDEA", " Changed Value"); printf("Deleting second EA\n"); - setfile.ea_set.in.ea.flags = 0; - setfile.ea_set.in.ea.name.s = "SECONDEA"; - setfile.ea_set.in.ea.value = data_blob(NULL, 0); + setfile.ea_set.in.eas[0].flags = 0; + setfile.ea_set.in.eas[0].name.s = "SECONDEA"; + setfile.ea_set.in.eas[0].value = data_blob(NULL, 0); status = smb_raw_setfileinfo(cli->tree, &setfile); CHECK_STATUS(status, NT_STATUS_OK); diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 05b06c6d0e..d96a285b6f 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -102,17 +102,14 @@ int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const cha /* setup some EAs */ setfile.generic.level = RAW_SFILEINFO_EA_SET; setfile.generic.file.fnum = fnum; - setfile.ea_set.in.ea.flags = 0; - setfile.ea_set.in.ea.name.s = "EAONE"; - setfile.ea_set.in.ea.value = data_blob_talloc(mem_ctx, "VALUE1", 6); - - status = smb_raw_setfileinfo(cli->tree, &setfile); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to setup EAs\n"); - } - - setfile.ea_set.in.ea.name.s = "SECONDEA"; - setfile.ea_set.in.ea.value = data_blob_talloc(mem_ctx, "ValueTwo", 8); + setfile.ea_set.in.num_eas = 2; + setfile.ea_set.in.eas = talloc_array_p(mem_ctx, struct ea_struct, 2); + setfile.ea_set.in.eas[0].flags = 0; + setfile.ea_set.in.eas[0].name.s = "EAONE"; + setfile.ea_set.in.eas[0].value = data_blob_talloc(mem_ctx, "VALUE1", 6); + setfile.ea_set.in.eas[1].flags = 0; + setfile.ea_set.in.eas[1].name.s = "SECONDEA"; + setfile.ea_set.in.eas[1].value = data_blob_talloc(mem_ctx, "ValueTwo", 8); status = smb_raw_setfileinfo(cli->tree, &setfile); if (!NT_STATUS_IS_OK(status)) { printf("Failed to setup EAs\n"); |