From b706555b3a4ed3c8d459ae86b4c332fa41041f57 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Dec 2004 22:47:49 +0000 Subject: 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) --- source4/ntvfs/posix/pvfs_qfileinfo.c | 58 ++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-) (limited to 'source4/ntvfs/posix/pvfs_qfileinfo.c') diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index fe53b0a415..ae55ad5e98 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -24,6 +24,45 @@ #include "vfs_posix.h" #include "librpc/gen_ndr/ndr_xattr.h" +/* + reply to a RAW_FILEINFO_EA_LIST call +*/ +static NTSTATUS pvfs_query_ea_list(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, + struct pvfs_filename *name, int fd, + uint_t num_names, + struct ea_name *names, + struct smb_ea_list *eas) +{ + NTSTATUS status; + int i; + struct xattr_DosEAs *ealist = talloc_p(mem_ctx, struct xattr_DosEAs); + + ZERO_STRUCTP(eas); + status = pvfs_doseas_load(pvfs, name, fd, ealist); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + eas->eas = talloc_array_p(mem_ctx, struct ea_struct, num_names); + if (eas->eas == NULL) { + return NT_STATUS_NO_MEMORY; + } + eas->num_eas = num_names; + for (i=0;ieas[i].flags = 0; + eas->eas[i].name.s = names[i].name.s; + eas->eas[i].value = data_blob(NULL, 0); + for (j=0;jnum_eas;j++) { + if (StrCaseCmp(eas->eas[i].name.s, + ealist->eas[j].name) == 0) { + eas->eas[i].value = ealist->eas[j].value; + break; + } + } + } + return NT_STATUS_OK; +} + /* reply to a RAW_FILEINFO_ALL_EAS call */ @@ -40,15 +79,16 @@ static NTSTATUS pvfs_query_all_eas(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { return status; } - eas->num_eas = ealist->num_eas; - eas->eas = talloc_array_p(mem_ctx, struct ea_struct, eas->num_eas); + eas->eas = talloc_array_p(mem_ctx, struct ea_struct, ealist->num_eas); if (eas->eas == NULL) { return NT_STATUS_NO_MEMORY; } - for (i=0;inum_eas;i++) { - eas->eas[i].flags = 0; - eas->eas[i].name.s = ealist->eas[i].name; - eas->eas[i].value = ealist->eas[i].value; + eas->num_eas = 0; + for (i=0;inum_eas;i++) { + eas->eas[eas->num_eas].flags = 0; + eas->eas[eas->num_eas].name.s = ealist->eas[i].name; + eas->eas[eas->num_eas].value = ealist->eas[i].value; + eas->num_eas++; } return NT_STATUS_OK; } @@ -91,6 +131,12 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, info->ea_size.out.ea_size = name->dos.ea_size; return NT_STATUS_OK; + case RAW_FILEINFO_EA_LIST: + return pvfs_query_ea_list(pvfs, req, name, fd, + info->ea_list.in.num_names, + info->ea_list.in.ea_names, + &info->ea_list.out); + case RAW_FILEINFO_ALL_EAS: return pvfs_query_all_eas(pvfs, req, name, fd, &info->all_eas.out); -- cgit