diff options
author | Ron Yorston <rmy@pobox.com> | 2023-02-13 15:26:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-02-13 15:26:39 +0000 |
commit | a6c5fd4eb35a68a7a5cb01426df3f85ef0d20975 (patch) | |
tree | 1c46c703a814842f386b1c225198b7759e740a49 | |
parent | 4e5fb4341fddc2b99e815f27ac577d85a57994c2 (diff) | |
download | busybox-w32-a6c5fd4eb35a68a7a5cb01426df3f85ef0d20975.tar.gz busybox-w32-a6c5fd4eb35a68a7a5cb01426df3f85ef0d20975.tar.bz2 busybox-w32-a6c5fd4eb35a68a7a5cb01426df3f85ef0d20975.zip |
win32: skip ACL check in stat(2) when running as rootFRP-4881-ga6c5fd4eb
Commit 88965fe20 (win32: use ACL check to clarify write permission)
added code to check if a file had write permission due to an ACL
entry.
When running with elevated privileges this check is unnecessary as
"user" permissions will be sufficient. This also prevents write
permission for "other" being set without respecting umask.
-rw-r--r-- | win32/mingw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 4d07a24e5..712728bd6 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -557,7 +557,8 @@ static uid_t file_owner(HANDLE fh, struct mingw_stat *buf) | |||
557 | uid = (uid_t)ptr[6]; | 557 | uid = (uid_t)ptr[6]; |
558 | } | 558 | } |
559 | 559 | ||
560 | if (uid != DEFAULT_UID && impersonate != INVALID_HANDLE_VALUE) { | 560 | if (uid != DEFAULT_UID && impersonate != INVALID_HANDLE_VALUE && |
561 | getuid() != 0) { | ||
561 | static GENERIC_MAPPING mapping = { | 562 | static GENERIC_MAPPING mapping = { |
562 | FILE_GENERIC_READ, FILE_GENERIC_WRITE, | 563 | FILE_GENERIC_READ, FILE_GENERIC_WRITE, |
563 | FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS | 564 | FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS |