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>2011-03-29 14:46:04 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-03-29 14:46:04 +0400
commit91d3057085a04ea2342dc8fc4fb92a3676fd7566 (patch)
tree19ffb4bf69ee016fa9d46e8499eea7a2981c3cbc /winsup
parent5f660ecf247e43918946a84a164269ae8082e73f (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')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/uinfo.cc18
2 files changed, 15 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 8518b9906..459b6bb2f 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
+ * uinfo.cc (cygheap_user::env_domain): Use LookupAccountSidW and
+ convert user and domain to multibyte strings to make sure to use
+ correct codeset.
+
+2011-03-29 Corinna Vinschen <corinna@vinschen.de>
+
* autoload.cc (UuidCreate): Remove.
(UuidCreateSequential): Remove.
* passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
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;
}