From 856f663adc2459044f7a20c2974bcb41ed561f77 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Nov 2004 06:44:50 +0000 Subject: r3800: - fixed delete-on-close behaviour for streams - added a delete-on-close test to RAW-STREAMS - don't allow rename of streams at the moment (I need to work out if its supposed to be allowed first) (This used to be commit f4b2b1311da6e37ac0947a3419d89c77ebbd6b63) --- source4/ntvfs/posix/pvfs_open.c | 13 ++++++++++++- source4/ntvfs/posix/pvfs_setfileinfo.c | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index a772feb623..d8f3342f0d 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -225,6 +225,16 @@ static int pvfs_handle_destructor(void *p) { struct pvfs_file_handle *h = p; + if ((h->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) && + h->name->stream_name) { + NTSTATUS status; + status = pvfs_stream_delete(h->pvfs, h->name, h->fd); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to delete stream '%s' on close of '%s'\n", + h->name->stream_name, h->name->full_name)); + } + } + if (h->fd != -1) { if (close(h->fd) != 0) { DEBUG(0,("pvfs_handle_destructor: close(%d) failed for %s - %s\n", @@ -233,7 +243,8 @@ static int pvfs_handle_destructor(void *p) h->fd = -1; } - if (h->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) { + if ((h->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) && + h->name->stream_name == NULL) { if (unlink(h->name->full_name) != 0) { DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n", h->name->full_name, strerror(errno))); diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index ede07983b3..58a3372f82 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -48,6 +48,11 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs, return NT_STATUS_FILE_IS_A_DIRECTORY; } + /* don't allow stream renames for now */ + if (name->stream_name) { + return NT_STATUS_INVALID_PARAMETER; + } + /* w2k3 does not appear to allow relative rename */ if (r->root_fid != 0) { return NT_STATUS_INVALID_PARAMETER; @@ -366,7 +371,8 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs, struct utimbuf unix_times; /* resolve the cifs name to a posix name */ - status = pvfs_resolve_name(pvfs, req, info->generic.file.fname, 0, &name); + status = pvfs_resolve_name(pvfs, req, info->generic.file.fname, + PVFS_RESOLVE_STREAMS, &name); if (!NT_STATUS_IS_OK(status)) { return status; } -- cgit