svn commit: samba r3800 - in branches/SAMBA_4_0/source: ntvfs/posix
torture/raw
tridge at samba.org
tridge at samba.org
Wed Nov 17 06:44:51 GMT 2004
Author: tridge
Date: 2004-11-17 06:44:50 +0000 (Wed, 17 Nov 2004)
New Revision: 3800
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3800
Log:
- 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)
Modified:
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c
branches/SAMBA_4_0/source/torture/raw/streams.c
Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-11-17 06:30:06 UTC (rev 3799)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c 2004-11-17 06:44:50 UTC (rev 3800)
@@ -225,6 +225,16 @@
{
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 @@
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)));
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c 2004-11-17 06:30:06 UTC (rev 3799)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c 2004-11-17 06:44:50 UTC (rev 3800)
@@ -48,6 +48,11 @@
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 @@
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;
}
Modified: branches/SAMBA_4_0/source/torture/raw/streams.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/streams.c 2004-11-17 06:30:06 UTC (rev 3799)
+++ branches/SAMBA_4_0/source/torture/raw/streams.c 2004-11-17 06:44:50 UTC (rev 3800)
@@ -183,6 +183,21 @@
status = smbcli_unlink(cli->tree, sname1);
CHECK_STATUS(status, NT_STATUS_OK);
+ printf("delete a stream via delete-on-close\n");
+ io.ntcreatex.in.fname = sname2;
+ io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_DELETE;
+ io.ntcreatex.in.access_mask = GENERIC_RIGHTS_FILE_ALL_ACCESS;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.fnum;
+
+ smbcli_close(cli->tree, fnum);
+ status = smbcli_unlink(cli->tree, sname2);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+
printf("deleting file\n");
status = smbcli_unlink(cli->tree, fname);
CHECK_STATUS(status, NT_STATUS_OK);
More information about the samba-cvs
mailing list