diff options
author | Egor Duda <deo@logos-m.ru> | 2001-04-11 09:38:55 +0000 |
---|---|---|
committer | Egor Duda <deo@logos-m.ru> | 2001-04-11 09:38:55 +0000 |
commit | dd9752e88e985b1ec7ec4a2cb4f3b276f5d35abb (patch) | |
tree | f11d8c837c2832056bda20509d8a044ab6ea29f9 /winsup | |
parent | 619f7fa0324c0eecdb7d32c5721c46b7d9a7f80b (diff) | |
download | newlib-dd9752e88e985b1ec7ec4a2cb4f3b276f5d35abb.zip newlib-dd9752e88e985b1ec7ec4a2cb4f3b276f5d35abb.tar.gz newlib-dd9752e88e985b1ec7ec4a2cb4f3b276f5d35abb.tar.bz2 |
* mkgroup.c (uni2ansi): Use native method to convert from Unicode
to multi-byte strings.
* mkpasswd.c (uni2ansi): Ditto.
(enum_users): Pass buffer size when converting string.
(enum_local_groups): Ditto.
* mkgroup.c (enum_groups): Ditto.
(enum_local_groups): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 10 | ||||
-rw-r--r-- | winsup/utils/mkgroup.c | 11 | ||||
-rw-r--r-- | winsup/utils/mkpasswd.c | 15 |
3 files changed, 22 insertions, 14 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index fdc626e..4d71998 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,13 @@ +2001-04-11 Egor Duda <deo@logos-m.ru> + + * mkgroup.c (uni2ansi): Use native method to convert from Unicode + to multi-byte strings. + * mkpasswd.c (uni2ansi): Ditto. + (enum_users): Pass buffer size when converting string. + (enum_local_groups): Ditto. + * mkgroup.c (enum_groups): Ditto. + (enum_local_groups): Ditto. + Mon Apr 2 22:41:33 2001 Christopher Faylor <cgf@cygnus.com> * mount.cc (main): Use getopt_long for parsing arguments. diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index e813375..331788f 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -92,11 +92,10 @@ psx_dir (char *in, char *out) } void -uni2ansi (LPWSTR wcs, char *mbs) +uni2ansi (LPWSTR wcs, char *mbs, int size) { if (wcs) - wcstombs (mbs, wcs, (wcslen (wcs) + 1) * sizeof (WCHAR)); - + WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL); else *mbs = '\0'; } @@ -141,7 +140,7 @@ enum_local_groups (int print_sids) DWORD sid_length = 1024; DWORD gid; SID_NAME_USE acc_type; - uni2ansi (buffer[i].lgrpi0_name, localgroup_name); + uni2ansi (buffer[i].lgrpi0_name, localgroup_name, sizeof (localgroup_name)); if (!LookupAccountName (NULL, localgroup_name, psid, &sid_length, domain_name, &domname_len, @@ -198,7 +197,7 @@ enum_groups (LPWSTR servername, int print_sids) char ansi_srvname[256]; if (servername) - uni2ansi (servername, ansi_srvname); + uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname)); do { @@ -232,7 +231,7 @@ enum_groups (LPWSTR servername, int print_sids) SID_NAME_USE acc_type; int gid = buffer[i].grpi2_group_id; - uni2ansi (buffer[i].grpi2_name, groupname); + uni2ansi (buffer[i].grpi2_name, groupname, sizeof (groupname)); if (print_sids) { if (!LookupAccountName (servername ? ansi_srvname : NULL, diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index 47d3440..1309cac 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -92,11 +92,10 @@ psx_dir (char *in, char *out) } void -uni2ansi (LPWSTR wcs, char *mbs) +uni2ansi (LPWSTR wcs, char *mbs, int size) { if (wcs) - wcstombs (mbs, wcs, (wcslen (wcs) + 1) * sizeof (WCHAR)); - + WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL); else *mbs = '\0'; } @@ -113,7 +112,7 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath, char ansi_srvname[256]; if (servername) - uni2ansi (servername, ansi_srvname); + uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname)); do { @@ -152,10 +151,10 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath, int uid = buffer[i].usri3_user_id; int gid = buffer[i].usri3_primary_group_id; - uni2ansi (buffer[i].usri3_name, username); - uni2ansi (buffer[i].usri3_full_name, fullname); + uni2ansi (buffer[i].usri3_name, username, sizeof (username)); + uni2ansi (buffer[i].usri3_full_name, fullname, sizeof (fullname)); homedir_w32[0] = homedir_psx[0] = '\0'; - uni2ansi (buffer[i].usri3_home_dir, homedir_w32); + uni2ansi (buffer[i].usri3_home_dir, homedir_w32, sizeof (homedir_w32)); if (print_cygpath) cygwin_conv_to_posix_path (homedir_w32, homedir_psx); else @@ -264,7 +263,7 @@ enum_local_groups (int print_sids) DWORD sid_length = 1024; DWORD gid; SID_NAME_USE acc_type; - uni2ansi (buffer[i].lgrpi0_name, localgroup_name); + uni2ansi (buffer[i].lgrpi0_name, localgroup_name, sizeof (localgroup_name)); if (!LookupAccountName (NULL, localgroup_name, psid, &sid_length, domain_name, &domname_len, |