Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2000-05-02 13:38:32 +0400
committerCorinna Vinschen <corinna@vinschen.de>2000-05-02 13:38:32 +0400
commitdd67f9db6acdf49cafac5f628fc942ceca215b04 (patch)
tree48705833704528419395f1c6bff3591563f98db3 /winsup
parent64dcb076529b3178b2114caa2e3641dfdf3b3e81 (diff)
* security.cc (read_sd): Return 1 on success because we
can't rely on the returned SD size from GetFileSecurity.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/security.cc21
2 files changed, 18 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 531b04e39..7d2196b06 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+Tue May 2 11:34:00 2000 Corinna Vinschen <corinna@vinschen.de>
+
+ * security.cc (read_sd): Return 1 on success because we
+ can't rely on the returned SD size from GetFileSecurity.
+
Tue May 2 2:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc: Add dynamic load code for `OemToCharA' from user32.dll.
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 6c9e9b01b..bfec8a1cf 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -376,13 +376,18 @@ got_it:
/* read_sd reads a security descriptor from a file.
In case of error, -1 is returned and errno is set.
- If the file doesn't have a SD, 0 is returned.
- Otherwise, the size of the SD is returned and
- the SD is copied to the buffer, pointed to by sd_buf.
- sd_size contains the size of the buffer. If
- it's too small, to contain the complete SD, 0 is
- returned and sd_size is set to the needed size
- of the buffer.
+ If sd_buf is too small, 0 is returned and sd_size
+ is set to the needed buffer size.
+ On success, 1 is returned.
+
+ GetFileSecurity() is used instead of BackupRead()
+ to avoid access denied errors if the caller has
+ not the permission to open that file for read.
+
+ Originally the function should return the size
+ of the SD on success. Unfortunately NT returns
+ 0 in `len' on success, while W2K returns the
+ correct size!
*/
LONG
@@ -415,7 +420,7 @@ read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size)
*sd_size = len;
return 0;
}
- return len;
+ return 1;
}
LONG