diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-07-11 10:00:36 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-07-11 10:00:36 +0000 |
commit | 9a51257715531da7089c0184a6b8ea0c68894825 (patch) | |
tree | d52c6a85102cea09a390450574a3b6a402ae23f1 /winsup/cygwin/sec_helper.cc | |
parent | 186a804c1515daa4b61b78a9bcbbfe4fc14b788e (diff) | |
download | cygnal-9a51257715531da7089c0184a6b8ea0c68894825.tar.gz cygnal-9a51257715531da7089c0184a6b8ea0c68894825.tar.bz2 cygnal-9a51257715531da7089c0184a6b8ea0c68894825.zip |
Change length for domain buffers from INTERNET_MAX_HOST_NAME_LENGTH to
MAX_DOMAIN_NAME_LEN throughout.
* cyglsa.h (CYG_LSA_MAGIC): New value.
(cyglsa_t): Define username and domain as WCHAR arrays.
* errno.cc (errmap): Add mapping for ERROR_NONE_MAPPED.
* sec_auth.cc: Drop 'w' prefix from WCHAR string variable names where
appropriate.
(extract_nt_dom_user): Prefer resolving by SID before resolving by
domain\name pair.
(cygwin_logon_user): Don't print cleartext password in debug output.
Change comment.
(get_user_groups): Revert calls to LookupAccountNameW to use NULL
server instead of explicit server name, according to MSDN.
(get_user_local_groups): Ditto.
(get_server_groups): Fetch domain and user name from usersid per
LookupAccountSidW instead of calling extract_nt_dom_user.
(lsaauth): Fetch domain and user name from usersid per LookupAccountSidW
instead of calling extract_nt_dom_user.
* sec_helper.cc (cygpriv): Convert to wchar_t pointer array.
(privilege_luid): Convert first parameter to PWCHAR.
(privilege_name): Return wchar_t pointer.
(set_privileges): Accommodate debug output.
* security.h (privilege_luid): Change prototype accordingly.
Diffstat (limited to 'winsup/cygwin/sec_helper.cc')
-rw-r--r-- | winsup/cygwin/sec_helper.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index aa7d8105c..6ce8e617c 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -13,6 +13,7 @@ details. */ #include "winsup.h" #include <stdlib.h> #include <sys/acl.h> +#include <wchar.h> #include "cygerrno.h" #include "security.h" #include "path.h" @@ -298,11 +299,14 @@ security_descriptor::free () sd_size = 0; } +#undef TEXT +#define TEXT(q) L##q + /* Index must match the correspoding foo_PRIVILEGE value, see security.h. */ -static const char *cygpriv[] = +static const wchar_t *cygpriv[] = { - "", - "", + L"", + L"", SE_CREATE_TOKEN_NAME, SE_ASSIGNPRIMARYTOKEN_NAME, SE_LOCK_MEMORY_NAME, @@ -340,13 +344,13 @@ static const char *cygpriv[] = }; bool -privilege_luid (const char *pname, LUID *luid) +privilege_luid (const PWCHAR pname, LUID *luid) { ULONG idx; for (idx = SE_CREATE_TOKEN_PRIVILEGE; idx <= SE_MAX_WELL_KNOWN_PRIVILEGE; ++idx) - if (!strcmp (cygpriv[idx], pname)) + if (!wcscmp (cygpriv[idx], pname)) { luid->HighPart = 0; luid->LowPart = idx; @@ -355,12 +359,12 @@ privilege_luid (const char *pname, LUID *luid) return false; } -static const char * +static const wchar_t * privilege_name (const LUID &priv_luid) { if (priv_luid.HighPart || priv_luid.LowPart < SE_CREATE_TOKEN_PRIVILEGE || priv_luid.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE) - return "<unknown privilege>"; + return L"<unknown privilege>"; return cygpriv[priv_luid.LowPart]; } @@ -393,7 +397,7 @@ set_privilege (HANDLE token, DWORD privilege, bool enable) out: if (ret < 0) - debug_printf ("%d = set_privilege ((token %x) %s, %d)\n", ret, token, + debug_printf ("%d = set_privilege ((token %x) %W, %d)\n", ret, token, privilege_name (new_priv.Privileges[0].Luid), enable); return ret; } |