summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-03-01 23:03:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:21 -0500
commit059e4cfa03b9d1bb4aa2fcb95747fc22faea45b1 (patch)
treee3d2f9455a42699f04c47636ad426fdc3519df78 /source3/smbd
parentea3e890130cbc328ae5c405883c37ae0422e69a2 (diff)
downloadsamba-059e4cfa03b9d1bb4aa2fcb95747fc22faea45b1.tar.gz
samba-059e4cfa03b9d1bb4aa2fcb95747fc22faea45b1.tar.bz2
samba-059e4cfa03b9d1bb4aa2fcb95747fc22faea45b1.zip
r21645: Make posix_unlink work - on open files too !
Jeremy. (This used to be commit 98f4b64574ef205ec87401b4bf5eed89f2933fa1)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/trans2.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 96aa185d19..1908f56793 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -4030,6 +4030,12 @@ static NTSTATUS smb_set_file_disposition_info(connection_struct *conn,
delete_on_close = (CVAL(pdata,0) ? True : False);
dosmode = dos_mode(conn, fname, psbuf);
+ DEBUG(10,("smb_set_file_disposition_info: file %s, dosmode = %u, "
+ "delete_on_close = %u\n",
+ fsp->fsp_name,
+ (unsigned int)dosmode,
+ (unsigned int)delete_on_close ));
+
status = can_set_delete_on_close(fsp, delete_on_close, dosmode);
if (!NT_STATUS_IS_OK(status)) {
@@ -5193,17 +5199,34 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
&info,
&fsp);
} else {
+ char del = 1;
+
status = open_file_ntcreate(conn,
fname,
psbuf,
DELETE_ACCESS,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
FILE_OPEN,
- FILE_DELETE_ON_CLOSE,
+ 0,
FILE_FLAG_POSIX_SEMANTICS|0777,
INTERNAL_OPEN_ONLY,
&info,
&fsp);
+ /*
+ * For file opens we must set the delete on close
+ * after the open.
+ */
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ status = smb_set_file_disposition_info(conn,
+ &del,
+ 1,
+ fsp,
+ fname,
+ psbuf);
}
if (!NT_STATUS_IS_OK(status)) {