summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-13 13:51:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:07 -0500
commit4c499cb45fa2452756642ab7017c1a9f321b73f6 (patch)
treee0f16974e3d3fe317d44225454b27787d18c54e2
parentad521ee793cae006c674dd3a4bf17ca67aa4ade3 (diff)
downloadsamba-4c499cb45fa2452756642ab7017c1a9f321b73f6.tar.gz
samba-4c499cb45fa2452756642ab7017c1a9f321b73f6.tar.bz2
samba-4c499cb45fa2452756642ab7017c1a9f321b73f6.zip
r17008: on SMB2 Create the delete_on_close flag isn't ignored for
existing opened files as it is for SMB. metze (This used to be commit bcf09a769e241de36abed17f22aa0534d87cf4ff)
-rw-r--r--source4/ntvfs/posix/pvfs_open.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 5482bb3562..b0d0348240 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -992,6 +992,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
uint32_t create_options;
uint32_t share_access;
uint32_t access_mask;
+ BOOL del_on_close;
BOOL stream_existed, stream_truncate=False;
uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
@@ -1169,6 +1170,17 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
talloc_set_destructor(f, pvfs_fnum_destructor);
talloc_set_destructor(f->handle, pvfs_handle_destructor);
+ /*
+ * Only SMB2 takes care of the delete_on_close,
+ * on existing files
+ */
+ if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE &&
+ req->ctx->protocol == PROTOCOL_SMB2) {
+ del_on_close = True;
+ } else {
+ del_on_close = False;
+ }
+
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
oplock_level = OPLOCK_NONE;
} else if (io->ntcreatex.in.flags & NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK) {
@@ -1179,8 +1191,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* see if we are allowed to open at the same time as existing opens */
status = odb_open_file(lck, f->handle, f->handle->name->stream_id,
- share_access, access_mask, False, name->full_name,
- oplock_level, &oplock_granted);
+ share_access, access_mask, del_on_close,
+ name->full_name, oplock_level, &oplock_granted);
/* on a sharing violation we need to retry when the file is closed by
the other user, or after 1 second */