summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-11-27 19:55:37 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-11-27 19:55:37 +0000
commitf3939c059c4594d537bed9e9b2a5f68ddc1ae00f (patch)
tree5b28af77760d9872a8b18bc471ae3ad77e5c828f
parente7d7418270fd17998e09017f013816788b32651d (diff)
downloadcygnal-f3939c059c4594d537bed9e9b2a5f68ddc1ae00f.tar.gz
cygnal-f3939c059c4594d537bed9e9b2a5f68ddc1ae00f.tar.bz2
cygnal-f3939c059c4594d537bed9e9b2a5f68ddc1ae00f.zip
* mkgroup.c (main): Call enum_groups with offset 0x30000 for local
machine, same as from DB. * mkpasswd.c (enum_unix_users): Set pw_passwd field to '*'. (enum_users): Ditto. (main): Call enum_users with offset of 0x30000 for local machine, same as from DB.
-rw-r--r--winsup/utils/ChangeLog9
-rw-r--r--winsup/utils/mkgroup.c11
-rw-r--r--winsup/utils/mkpasswd.c16
3 files changed, 24 insertions, 12 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index cc2fa2820..0442901d1 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-27 Corinna Vinschen <corinna@vinschen.de>
+
+ * mkgroup.c (main): Call enum_groups with offset 0x30000 for local
+ machine, same as from DB.
+ * mkpasswd.c (enum_unix_users): Set pw_passwd field to '*'.
+ (enum_users): Ditto.
+ (main): Call enum_users with offset of 0x30000 for local machine,
+ same as from DB.
+
2014-11-24 Corinna Vinschen <corinna@vinschen.de>
* passwd.c (GetPW): If server is NULL, and the user is not a local
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 8308401ad..32fb6805b 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -559,8 +559,8 @@ main (int argc, char **argv)
DWORD id_offset = 0x10000, off;
int c, i;
char *disp_groupname = NULL;
- //BOOL in_domain;
int optional_args = 0;
+ uintptr_t nss_src = cygwin_internal (CW_GETNSS_GRP_SRC);
if (!isatty (1))
setmode (1, O_BINARY);
@@ -641,13 +641,13 @@ main (int argc, char **argv)
{
/* If the system uses /etc/group exclusively as account DB,
create local group names the old fashioned way. */
- if (cygwin_internal (CW_GETNSS_GRP_SRC) == NSS_SRC_FILES)
+ if (nss_src == NSS_SRC_FILES)
{
GetComputerNameExA (ComputerNameNetBIOS, cname, &csize);
domlist[print_domlist].str = cname;
}
}
- else if (cygwin_internal (CW_GETNSS_GRP_SRC) != NSS_SRC_FILES)
+ else if (nss_src != NSS_SRC_FILES)
{
/* If the system uses Windows account DBs, check if machine
name is local machine. If so, remove the domain name to
@@ -782,8 +782,9 @@ main (int argc, char **argv)
if (!enum_local_groups (domlist + i, sep_char, off, disp_groupname,
print_builtin, print_current))
{
- enum_groups (domlist + i, sep_char, off, disp_groupname,
- print_current);
+ enum_groups (domlist + i, sep_char,
+ (nss_src == NSS_SRC_FILES) ? 0x30000 : off,
+ disp_groupname, print_current);
if (!domlist[i].domain && domlist[i].str && print_unix)
enum_unix_groups (domlist + i, sep_char, 0xff000000, print_unix);
off += id_offset;
diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c
index 9cdccd187..553c993cc 100644
--- a/winsup/utils/mkpasswd.c
+++ b/winsup/utils/mkpasswd.c
@@ -169,7 +169,7 @@ enum_unix_users (domlist_t *mach, const char *sep, DWORD id_offset,
dom,
(dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
&acc_type))
- printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n",
+ printf ("%s%s%ls:*:%" PRIu32 ":99999:,%s::\n",
"Unix_User",
sep,
user + 10,
@@ -206,7 +206,7 @@ enum_unix_users (domlist_t *mach, const char *sep, DWORD id_offset,
(dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
&acc_type)
&& !iswdigit (user[0]))
- printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n",
+ printf ("%s%s%ls:*:%" PRIu32 ":99999:,%s::\n",
"Unix_User",
sep,
user,
@@ -333,7 +333,7 @@ enum_users (domlist_t *mach, const char *sep, const char *passed_home_path,
else if (EqualSid (curr_user.psid, psid))
got_curr_user = TRUE;
- printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32
+ printf ("%ls%s%ls:*:%" PRIu32 ":%" PRIu32
":%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n",
mach->with_dom ? domain_name : L"",
mach->with_dom ? sep : "",
@@ -455,6 +455,7 @@ main (int argc, char **argv)
char *disp_username = NULL;
char passed_home_path[PATH_MAX];
int optional_args = 0;
+ uintptr_t nss_src = cygwin_internal (CW_GETNSS_PWD_SRC);
passed_home_path[0] = '\0';
if (!isatty (1))
@@ -538,13 +539,13 @@ main (int argc, char **argv)
{
/* If the system uses /etc/passwd exclusively as account DB,
create local group names the old fashioned way. */
- if (cygwin_internal (CW_GETNSS_PWD_SRC) == NSS_SRC_FILES)
+ if (nss_src == NSS_SRC_FILES)
{
GetComputerNameExA (ComputerNameNetBIOS, cname, &csize);
domlist[print_domlist].str = cname;
}
}
- else if (cygwin_internal (CW_GETNSS_PWD_SRC) != NSS_SRC_FILES)
+ else if (nss_src != NSS_SRC_FILES)
{
/* If the system uses Windows account DBs, check if machine
name is local machine. If so, remove the domain name to
@@ -706,8 +707,9 @@ main (int argc, char **argv)
{
if (domlist[i].domain || !domlist[i].str)
continue;
- enum_users (domlist + i, sep_char, passed_home_path, off, disp_username,
- print_current);
+ enum_users (domlist + i, sep_char, passed_home_path,
+ (nss_src == NSS_SRC_FILES) ? 0x30000 : off,
+ disp_username, print_current);
if (!domlist[i].domain && domlist[i].str && print_unix)
enum_unix_users (domlist + i, sep_char, 0xff000000, print_unix);
off += id_offset;