From ae7caf08c1f47f3ad08856cfea2a3e6e956b48ab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Nov 2004 05:58:04 +0000 Subject: r3798: added support for alternate data streams in xattrs into pvfs. The trickiest part about this was getting the sharing and locking rules right, as alternate streams are separate locking spaces from the main file for the purposes of byte range locking, and separate for most share violation rules. I suspect there are still problems with delete on close with alternate data streams. I'll look at that next. (This used to be commit b6452c4a2068cf7e837778559da002ae191b508a) --- source4/ntvfs/posix/pvfs_unlink.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'source4/ntvfs/posix/pvfs_unlink.c') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 8dc9f60ad8..434577a862 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -24,6 +24,33 @@ #include "vfs_posix.h" +/* + unlink a stream + */ +static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, struct pvfs_filename *name, + uint16_t attrib) +{ + NTSTATUS status; + + if (!name->stream_exists) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + /* make sure its matches the given attributes */ + status = pvfs_match_attrib(pvfs, name, attrib, 0); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = pvfs_can_delete(pvfs, name); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return pvfs_stream_delete(pvfs, name, -1); +} + + /* unlink one file */ @@ -86,7 +113,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, /* resolve the cifs name to a posix name */ status = pvfs_resolve_name(pvfs, req, unl->in.pattern, - PVFS_RESOLVE_WILDCARD, &name); + PVFS_RESOLVE_WILDCARD | PVFS_RESOLVE_STREAMS, &name); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -100,6 +127,10 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, return NT_STATUS_FILE_IS_A_DIRECTORY; } + if (name->stream_name) { + return pvfs_unlink_stream(pvfs, name, unl->in.attrib); + } + /* get list of matching files */ status = pvfs_list_start(pvfs, name, req, &dir); if (!NT_STATUS_IS_OK(status)) { -- cgit