* security.cc (read_sd): Return 1 on success because we

can't rely on the returned SD size from GetFileSecurity.
This commit is contained in:
Corinna Vinschen 2000-05-02 09:38:32 +00:00
parent 64dcb07652
commit dd67f9db6a
2 changed files with 18 additions and 8 deletions

View File

@ -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> Tue May 2 2:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc: Add dynamic load code for `OemToCharA' from user32.dll. * dcrt0.cc: Add dynamic load code for `OemToCharA' from user32.dll.

View File

@ -376,13 +376,18 @@ got_it:
/* read_sd reads a security descriptor from a file. /* read_sd reads a security descriptor from a file.
In case of error, -1 is returned and errno is set. In case of error, -1 is returned and errno is set.
If the file doesn't have a SD, 0 is returned. If sd_buf is too small, 0 is returned and sd_size
Otherwise, the size of the SD is returned and is set to the needed buffer size.
the SD is copied to the buffer, pointed to by sd_buf. On success, 1 is returned.
sd_size contains the size of the buffer. If
it's too small, to contain the complete SD, 0 is GetFileSecurity() is used instead of BackupRead()
returned and sd_size is set to the needed size to avoid access denied errors if the caller has
of the buffer. 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 LONG
@ -415,7 +420,7 @@ read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size)
*sd_size = len; *sd_size = len;
return 0; return 0;
} }
return len; return 1;
} }
LONG LONG