Rebase against 3b5107d06305972beaa9c5ff147ecbcd99949a75.

This commit is contained in:
Sebastian Lackner
2015-08-19 17:13:50 +02:00
parent f28931a026
commit 428f65dd68
21 changed files with 27 additions and 663 deletions

View File

@@ -1,4 +1,4 @@
From 79e9440272eed16300dc4aacc96765a24841a705 Mon Sep 17 00:00:00 2001
From 7571a6f9f7933133862d13e4ab25814b554d002e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 3 Apr 2015 03:58:47 +0200
Subject: server: Allow to open files without any permission bits. (try 2)
@@ -12,10 +12,10 @@ Changes in v2:
2 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 466100d..329ae09 100644
index 70aa949..799e306 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3319,17 +3319,13 @@ static void test_CreateDirectoryA(void)
@@ -3326,17 +3326,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@@ -39,7 +39,7 @@ index 466100d..329ae09 100644
CloseHandle(hTemp);
/* Test inheritance of ACLs in NtCreateFile without security descriptor */
@@ -3399,17 +3395,13 @@ static void test_CreateDirectoryA(void)
@@ -3406,17 +3402,13 @@ static void test_CreateDirectoryA(void)
error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
@@ -64,18 +64,18 @@ index 466100d..329ae09 100644
done:
diff --git a/server/fd.c b/server/fd.c
index e3b722c..3afb89a 100644
index 0bac57d..e8839c2 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1741,6 +1741,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
const char *unlink_name = "";
@@ -1745,6 +1745,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
struct fd *fd;
int root_fd = -1;
int rw_mode;
+ int do_chmod = 0;
if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) ||
((options & FILE_DIRECTORY_FILE) && (flags & O_TRUNC)))
@@ -1801,16 +1802,36 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1804,10 +1805,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT))
fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode );
}
@@ -104,14 +104,15 @@ index e3b722c..3afb89a 100644
goto error;
}
}
@@ -1815,6 +1834,8 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
closed_fd->unix_fd = fd->unix_fd;
closed_fd->unlink[0] = 0;
closed_fd->unlink = 0;
closed_fd->unix_name = fd->unix_name;
+
+ if (do_chmod) fchmod( fd->unix_fd, *mode );
+ if (do_chmod) chmod( name, *mode );
fstat( fd->unix_fd, &st );
*mode = st.st_mode;
--
2.3.3
2.5.0