server-File_Permissions: Remove patch 0001.

This patch concerns the case where we successfully create a read-only directory
with FILE_DELETE_ON_CLOSE. Currently we return STATUS_CANNOT_DELETE (having
cleared O_CREAT). This patch would change that to return success.

However, tests show that this is incorrect. Actually FILE_DELETE_ON_CLOSE should
always fail on a read-only file, including when that file is created by the same
call.
This commit is contained in:
Zebediah Figura 2024-03-01 23:44:13 -06:00
parent 3d69e00892
commit 21b92f9611

View File

@ -1,42 +0,0 @@
From 6b5ac1e9eaf73aa0d6dddf8e7f53bd9802a25f5b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 16 Oct 2016 03:21:42 +0200
Subject: [PATCH] server: Improve STATUS_CANNOT_DELETE checks for directory
case.
---
server/fd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/server/fd.c b/server/fd.c
index 784a8c08867..d238c43cf1f 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1825,6 +1825,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
int root_fd = -1;
int rw_mode;
char *path;
+ int created = (flags & O_CREAT);
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
((options & FILE_DIRECTORY_FILE) && (flags & O_TRUNC)))
@@ -1863,6 +1864,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
file_set_error();
goto error;
}
+ created = 0;
}
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
}
@@ -1955,7 +1957,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
}
/* can't unlink files if we don't have permission to access */
- if ((options & FILE_DELETE_ON_CLOSE) && !(flags & O_CREAT) &&
+ if ((options & FILE_DELETE_ON_CLOSE) && !created &&
!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
{
set_error( STATUS_CANNOT_DELETE );
--
2.25.1