* 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.
This commit is contained in:
parent
619f7fa032
commit
dd9752e88e
|
@ -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>
|
Mon Apr 2 22:41:33 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* mount.cc (main): Use getopt_long for parsing arguments.
|
* mount.cc (main): Use getopt_long for parsing arguments.
|
||||||
|
|
|
@ -92,11 +92,10 @@ psx_dir (char *in, char *out)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uni2ansi (LPWSTR wcs, char *mbs)
|
uni2ansi (LPWSTR wcs, char *mbs, int size)
|
||||||
{
|
{
|
||||||
if (wcs)
|
if (wcs)
|
||||||
wcstombs (mbs, wcs, (wcslen (wcs) + 1) * sizeof (WCHAR));
|
WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL);
|
||||||
|
|
||||||
else
|
else
|
||||||
*mbs = '\0';
|
*mbs = '\0';
|
||||||
}
|
}
|
||||||
|
@ -141,7 +140,7 @@ enum_local_groups (int print_sids)
|
||||||
DWORD sid_length = 1024;
|
DWORD sid_length = 1024;
|
||||||
DWORD gid;
|
DWORD gid;
|
||||||
SID_NAME_USE acc_type;
|
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,
|
if (!LookupAccountName (NULL, localgroup_name, psid,
|
||||||
&sid_length, domain_name, &domname_len,
|
&sid_length, domain_name, &domname_len,
|
||||||
|
@ -198,7 +197,7 @@ enum_groups (LPWSTR servername, int print_sids)
|
||||||
char ansi_srvname[256];
|
char ansi_srvname[256];
|
||||||
|
|
||||||
if (servername)
|
if (servername)
|
||||||
uni2ansi (servername, ansi_srvname);
|
uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname));
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -232,7 +231,7 @@ enum_groups (LPWSTR servername, int print_sids)
|
||||||
SID_NAME_USE acc_type;
|
SID_NAME_USE acc_type;
|
||||||
|
|
||||||
int gid = buffer[i].grpi2_group_id;
|
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 (print_sids)
|
||||||
{
|
{
|
||||||
if (!LookupAccountName (servername ? ansi_srvname : NULL,
|
if (!LookupAccountName (servername ? ansi_srvname : NULL,
|
||||||
|
|
|
@ -92,11 +92,10 @@ psx_dir (char *in, char *out)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uni2ansi (LPWSTR wcs, char *mbs)
|
uni2ansi (LPWSTR wcs, char *mbs, int size)
|
||||||
{
|
{
|
||||||
if (wcs)
|
if (wcs)
|
||||||
wcstombs (mbs, wcs, (wcslen (wcs) + 1) * sizeof (WCHAR));
|
WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL);
|
||||||
|
|
||||||
else
|
else
|
||||||
*mbs = '\0';
|
*mbs = '\0';
|
||||||
}
|
}
|
||||||
|
@ -113,7 +112,7 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath,
|
||||||
char ansi_srvname[256];
|
char ansi_srvname[256];
|
||||||
|
|
||||||
if (servername)
|
if (servername)
|
||||||
uni2ansi (servername, ansi_srvname);
|
uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname));
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -152,10 +151,10 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath,
|
||||||
|
|
||||||
int uid = buffer[i].usri3_user_id;
|
int uid = buffer[i].usri3_user_id;
|
||||||
int gid = buffer[i].usri3_primary_group_id;
|
int gid = buffer[i].usri3_primary_group_id;
|
||||||
uni2ansi (buffer[i].usri3_name, username);
|
uni2ansi (buffer[i].usri3_name, username, sizeof (username));
|
||||||
uni2ansi (buffer[i].usri3_full_name, fullname);
|
uni2ansi (buffer[i].usri3_full_name, fullname, sizeof (fullname));
|
||||||
homedir_w32[0] = homedir_psx[0] = '\0';
|
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)
|
if (print_cygpath)
|
||||||
cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
|
cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
|
||||||
else
|
else
|
||||||
|
@ -264,7 +263,7 @@ enum_local_groups (int print_sids)
|
||||||
DWORD sid_length = 1024;
|
DWORD sid_length = 1024;
|
||||||
DWORD gid;
|
DWORD gid;
|
||||||
SID_NAME_USE acc_type;
|
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,
|
if (!LookupAccountName (NULL, localgroup_name, psid,
|
||||||
&sid_length, domain_name, &domname_len,
|
&sid_length, domain_name, &domname_len,
|
||||||
|
|
Loading…
Reference in New Issue