diff options
author | Christopher Faylor <me@cgf.cx> | 2000-12-10 00:45:12 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-12-10 00:45:12 +0000 |
commit | ee1d77e4b71f7166d4d8ada84a062bfc73da90e6 (patch) | |
tree | bbe5746e05f5ceb77e4072468ca9a74ef22ff243 /winsup/cygwin/security.cc | |
parent | 307cb8ba8270a2eaf5bc1331006e0bd67df920ed (diff) | |
download | cygnal-ee1d77e4b71f7166d4d8ada84a062bfc73da90e6.tar.gz cygnal-ee1d77e4b71f7166d4d8ada84a062bfc73da90e6.tar.bz2 cygnal-ee1d77e4b71f7166d4d8ada84a062bfc73da90e6.zip |
* autoload.cc: Autoload CharToOemA.
* dcrt0.cc (dll_crt0_1): Translate command line to OEM if current codepage is
OEM.
* environ.cc: Add new option 'codepage' to CYGWIN environment variable.
* fhandler_clipboard.cc (fhandler_clipboard::read): Read clipboard in OEM mode
if current codepage is OEM.
* fhandler_console.cc (fhandler_console::read): Only translate console input if
current codepage is ANSI.
* fhandler_console.cc (fhandler_console::write_normal): Translate output data
if current codepage is ANSI.
* pinfo.cc (codepage_init): New function. Setup current codepage from CYGWIN
environment variable and set codepage for file APIs.
* security.cc (read_sd): Translate file name to it if current codepage is OEM.
* winsup.h: (sys_wcstombs,sys_mbstowcs): Use current codepage for translations
between multibyte and widechar string and vice versa.
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r-- | winsup/cygwin/security.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 740c2fae3..04915781d 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -22,6 +22,8 @@ details. */ #include <sys/stat.h> #include <sys/acl.h> #include <ctype.h> +#include <wingdi.h> +#include <winuser.h> #include "cygerrno.h" #include "fhandler.h" #include "path.h" @@ -513,8 +515,18 @@ read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size) debug_printf("file = %s", file); DWORD len = 0; - if (! GetFileSecurity (file, - OWNER_SECURITY_INFORMATION + const char *pfile = file; + char fbuf [PATH_MAX]; + if (current_codepage == oem_cp) + { + DWORD fname_len = min (sizeof (fbuf) - 1, strlen (file)); + bzero (fbuf, sizeof (fbuf)); + OemToCharBuff(file, fbuf, fname_len); + pfile = fbuf; + } + + if (! GetFileSecurity (pfile, + OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, sd_buf, *sd_size, &len)) |