summaryrefslogtreecommitdiffstats
path: root/source/smbd/trans2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-11-28 05:03:37 +0000
committerJeremy Allison <jra@samba.org>2001-11-28 05:03:37 +0000
commit1f3dcd99bdd36cd3ff492394e80c3e2037a9aa48 (patch)
treea229c90105a610092111ac7e56329cdfbfec32fc /source/smbd/trans2.c
parentb69127391b322d81cc648f73a601ed61e79c8a44 (diff)
downloadsamba-1f3dcd99bdd36cd3ff492394e80c3e2037a9aa48.tar.gz
samba-1f3dcd99bdd36cd3ff492394e80c3e2037a9aa48.tar.xz
samba-1f3dcd99bdd36cd3ff492394e80c3e2037a9aa48.zip
Ensure the CAN_WRITE is checked and prevents O_CREAT and O_TRUNC from
being set. Also prevent an open on a file on a readonly share from setting delete on close. Jeremy.
Diffstat (limited to 'source/smbd/trans2.c')
-rw-r--r--source/smbd/trans2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index 0e13d8d87a9..aaa5aade97f 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -1680,6 +1680,15 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
NTSTATUS set_delete_on_close_internal(files_struct *fsp, BOOL delete_on_close)
{
/*
+ * Only allow delete on close for writable shares.
+ */
+
+ if (delete_on_close && !CAN_WRITE(fsp->conn)) {
+ DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but write access denied on share.\n",
+ fsp->fsp_name ));
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ /*
* Only allow delete on close for files/directories opened with delete intent.
*/