summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_qfileinfo.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-05 11:31:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:31 -0500
commit12f4a44cf549b4ccd729494c242a5ec186d2d670 (patch)
tree28045ce9c687afe92430fd0caa71243136c39e14 /source4/ntvfs/posix/pvfs_qfileinfo.c
parent2b4e716f7aec49469b2b523c86762c8d4bacb4d1 (diff)
downloadsamba-12f4a44cf549b4ccd729494c242a5ec186d2d670.tar.gz
samba-12f4a44cf549b4ccd729494c242a5ec186d2d670.tar.bz2
samba-12f4a44cf549b4ccd729494c242a5ec186d2d670.zip
r3549: added support for DOS extended attribute lists (name/value pairs)
stored in posix xattrs (This used to be commit bad6a88371264cffce2bf5d6ce904b7b357081de)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_qfileinfo.c')
-rw-r--r--source4/ntvfs/posix/pvfs_qfileinfo.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 4c699d63ce..51aadc07a5 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -22,13 +22,42 @@
#include "includes.h"
#include "vfs_posix.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+/*
+ reply to a RAW_FILEINFO_ALL_EAS call
+*/
+static NTSTATUS pvfs_query_all_eas(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
+ struct pvfs_filename *name, int fd, struct smb_all_eas *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->num_eas = ealist->num_eas;
+ eas->eas = talloc_array_p(mem_ctx, struct ea_struct, eas->num_eas);
+ if (eas->eas == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ for (i=0;i<eas->num_eas;i++) {
+ eas->eas[i].flags = 0;
+ eas->eas[i].name.s = ealist->eas[i].name;
+ eas->eas[i].value = ealist->eas[i].value;
+ }
+ return NT_STATUS_OK;
+}
/*
approximately map a struct pvfs_filename to a generic fileinfo struct
*/
static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
- struct pvfs_filename *name, union smb_fileinfo *info)
+ struct pvfs_filename *name, union smb_fileinfo *info,
+ int fd)
{
switch (info->generic.level) {
case RAW_FILEINFO_GENERIC:
@@ -61,9 +90,7 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
case RAW_FILEINFO_ALL_EAS:
- info->all_eas.out.num_eas = 0;
- info->all_eas.out.eas = NULL;
- return NT_STATUS_OK;
+ return pvfs_query_all_eas(pvfs, mem_ctx, name, fd, &info->all_eas.out);
case RAW_FILEINFO_IS_NAME_VALID:
return NT_STATUS_OK;
@@ -202,7 +229,7 @@ NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- status = pvfs_map_fileinfo(pvfs, req, name, info);
+ status = pvfs_map_fileinfo(pvfs, req, name, info, -1);
return status;
}
@@ -228,7 +255,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
return status;
}
- status = pvfs_map_fileinfo(pvfs, req, f->name, info);
+ status = pvfs_map_fileinfo(pvfs, req, f->name, info, f->fd);
/* a qfileinfo can fill in a bit more info than a qpathinfo -
now modify the levels that need to be fixed up */