summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-17 22:47:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:29 -0500
commitb706555b3a4ed3c8d459ae86b4c332fa41041f57 (patch)
tree4c02c9c93a3033fa1a7f7d3ea6a2cd9a80093536 /source4/torture
parentdaae3bbb290ce0f4467c806acaefe3b1d6f4ae4d (diff)
downloadsamba-b706555b3a4ed3c8d459ae86b4c332fa41041f57.tar.gz
samba-b706555b3a4ed3c8d459ae86b4c332fa41041f57.tar.bz2
samba-b706555b3a4ed3c8d459ae86b4c332fa41041f57.zip
r4261: added the RAW_FILEINFO_EA_LIST trans2 qfileinfo and qpathinfo
level. Interestingly, this level did now show up on our trans2 scanner previously as we didn't have the FLAGS2_EXTENDED_ATTRIBUTES bit set in the client code. Now that we set that bit, new levels appear in windows servers. (This used to be commit 0b76d405a73e924dc2706f28bbf1084a59c9b393)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/torture_util.c73
1 files changed, 42 insertions, 31 deletions
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index d96a285b6f..de93d6731f 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -362,11 +362,15 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli,
{
union smb_fileinfo info;
NTSTATUS status;
- int i;
+ struct ea_name ea;
TALLOC_CTX *mem_ctx = talloc(cli, 0);
- info.all_eas.level = RAW_FILEINFO_ALL_EAS;
- info.all_eas.in.fname = fname;
+ info.ea_list.level = RAW_FILEINFO_EA_LIST;
+ info.ea_list.file.fname = fname;
+ info.ea_list.in.num_names = 1;
+ info.ea_list.in.ea_names = &ea;
+
+ ea.name.s = eaname;
status = smb_raw_pathinfo(cli->tree, mem_ctx, &info);
if (!NT_STATUS_IS_OK(status)) {
@@ -374,38 +378,45 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli,
return status;
}
- for (i=0;i<info.all_eas.out.num_eas;i++) {
- if (StrCaseCmp(eaname, info.all_eas.out.eas[i].name.s) == 0) {
- if (value == NULL) {
- printf("attr '%s' should not be present\n", eaname);
- talloc_free(mem_ctx);
- return NT_STATUS_EA_CORRUPT_ERROR;
- }
- if (strlen(value) == info.all_eas.out.eas[i].value.length &&
- memcmp(value,
- info.all_eas.out.eas[i].value.data,
- info.all_eas.out.eas[i].value.length) == 0) {
- talloc_free(mem_ctx);
- return NT_STATUS_OK;
- } else {
- printf("attr '%s' has wrong value '%*.*s'\n",
- eaname,
- info.all_eas.out.eas[i].value.length,
- info.all_eas.out.eas[i].value.length,
- info.all_eas.out.eas[i].value.data);
- talloc_free(mem_ctx);
- return NT_STATUS_EA_CORRUPT_ERROR;
- }
- }
+ if (info.ea_list.out.num_eas != 1) {
+ printf("Expected 1 ea in ea_list\n");
+ talloc_free(mem_ctx);
+ return NT_STATUS_EA_CORRUPT_ERROR;
}
- talloc_free(mem_ctx);
+ if (StrCaseCmp(eaname, info.ea_list.out.eas[0].name.s) != 0) {
+ printf("Expected ea '%s' not '%s' in ea_list\n",
+ eaname, info.ea_list.out.eas[0].name.s);
+ talloc_free(mem_ctx);
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+
+ if (value == NULL) {
+ if (info.ea_list.out.eas[0].value.length != 0) {
+ printf("Expected zero length ea for %s\n", eaname);
+ talloc_free(mem_ctx);
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+ talloc_free(mem_ctx);
+ return NT_STATUS_OK;
+ }
- if (value != NULL) {
- printf("attr '%s' not found\n", eaname);
- return NT_STATUS_NONEXISTENT_EA_ENTRY;
+ if (strlen(value) == info.ea_list.out.eas[0].value.length &&
+ memcmp(value, info.ea_list.out.eas[0].value.data,
+ info.ea_list.out.eas[0].value.length) == 0) {
+ talloc_free(mem_ctx);
+ return NT_STATUS_OK;
}
- return NT_STATUS_OK;
+ printf("Expected value '%s' not '%*.*s' for ea %s\n",
+ value,
+ info.ea_list.out.eas[0].value.length,
+ info.ea_list.out.eas[0].value.length,
+ info.ea_list.out.eas[0].value.data,
+ eaname);
+
+ talloc_free(mem_ctx);
+
+ return NT_STATUS_EA_CORRUPT_ERROR;
}