diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-12-13 10:48:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:22 -0500 |
commit | fbd8c61ff7a7c41d16c400ddb87ad290f4af167d (patch) | |
tree | f8755bbce13d03e39e58c86ba6a541d1ff1cd8c3 /source4/torture/torture_util.c | |
parent | e08e2645de81a89902adcd84e405bfc5baf1fab6 (diff) | |
download | samba-fbd8c61ff7a7c41d16c400ddb87ad290f4af167d.tar.gz samba-fbd8c61ff7a7c41d16c400ddb87ad290f4af167d.tar.bz2 samba-fbd8c61ff7a7c41d16c400ddb87ad290f4af167d.zip |
r4173: - new t2open code, that can cope with "create with EAs". Many thanks
to kukks on #samba-technical for the sniffs that allowed me to work
this out
- much simpler ntvfs open generic mapping code
- added t2open create with EA torture test to RAW-OPEN test
(This used to be commit a56d95ad89b4f32a05974c4fe9a816d67aa369e3)
Diffstat (limited to 'source4/torture/torture_util.c')
-rw-r--r-- | source4/torture/torture_util.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 6370086838..05b06c6d0e 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -356,3 +356,59 @@ NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum) return status; } + +/* + check that an EA has the right value +*/ +NTSTATUS torture_check_ea(struct smbcli_state *cli, + const char *fname, const char *eaname, const char *value) +{ + union smb_fileinfo info; + NTSTATUS status; + int i; + TALLOC_CTX *mem_ctx = talloc(cli, 0); + + info.all_eas.level = RAW_FILEINFO_ALL_EAS; + info.all_eas.in.fname = fname; + + status = smb_raw_pathinfo(cli->tree, mem_ctx, &info); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(mem_ctx); + 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; + } + } + } + + talloc_free(mem_ctx); + + if (value != NULL) { + printf("attr '%s' not found\n", eaname); + return NT_STATUS_NONEXISTENT_EA_ENTRY; + } + + return NT_STATUS_OK; +} + |