diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2011-03-29 14:46:04 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2011-03-29 14:46:04 +0400 |
commit | 91d3057085a04ea2342dc8fc4fb92a3676fd7566 (patch) | |
tree | 19ffb4bf69ee016fa9d46e8499eea7a2981c3cbc /winsup/cygwin/uinfo.cc | |
parent | 5f660ecf247e43918946a84a164269ae8082e73f (diff) |
* uinfo.cc (cygheap_user::env_domain): Use LookupAccountSidW and
convert user and domain to multibyte strings to make sure to use
correct codeset.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 60db38e76..66cab121e 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -1,7 +1,7 @@ /* uinfo.cc: user info (uid, gid, etc...) Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. This file is part of Cygwin. @@ -382,21 +382,21 @@ cygheap_user::env_domain (const char *name, size_t namelen) if (pwinname && test_uid (pdomain, name, namelen)) return pdomain; - char username[UNLEN + 1]; - DWORD ulen = sizeof (username); - char userdomain[DNLEN + 1]; - DWORD dlen = sizeof (userdomain); + DWORD ulen = UNLEN + 1; + WCHAR username[ulen]; + DWORD dlen = DNLEN + 1; + WCHAR userdomain[dlen]; SID_NAME_USE use; cfree_and_set (pwinname, almost_null); cfree_and_set (pdomain, almost_null); - if (!LookupAccountSid (NULL, sid (), username, &ulen, - userdomain, &dlen, &use)) + if (!LookupAccountSidW (NULL, sid (), username, &ulen, + userdomain, &dlen, &use)) __seterrno (); else { - pwinname = cstrdup (username); - pdomain = cstrdup (userdomain); + sys_wcstombs_alloc (&pwinname, HEAP_STR, username); + sys_wcstombs_alloc (&pdomain, HEAP_STR, userdomain); } return pdomain; } |