diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-11-10 19:21:52 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-11-10 19:21:52 +0300 |
commit | df59ab7e7a12917e632a57924af39b566791297e (patch) | |
tree | b6c2ba11f32eda01d5a8c588489140e05f763eba /winsup | |
parent | fbb8f1a2c70341eaea7d90d2423a1a68c47fc16e (diff) |
* cygcheck.cc (dump_sysinfo): Handle Windows 10/Server 2014(?).
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/utils/cygcheck.cc | 7 | ||||
-rw-r--r-- | winsup/utils/mkgroup.c | 38 | ||||
-rw-r--r-- | winsup/utils/mkpasswd.c | 38 |
4 files changed, 57 insertions, 30 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 2d981ff91..09dc0bf31 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2014-11-10 Corinna Vinschen <corinna@vinschen.de> + + * cygcheck.cc (dump_sysinfo): Handle Windows 10/Server 2014(?). + 2014-11-03 Corinna Vinschen <corinna@vinschen.de> * mkgroup.c (enum_local_groups): Don't generate leading separator char diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index cc400519e..5d823e9a3 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -1480,11 +1480,14 @@ dump_sysinfo () ? "8" : "2012"); break; case 3: - default: - osversion.dwMinorVersion = 3; strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION ? "8.1" : "2012 R2"); break; + case 4: + default: + strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION + ? "10" : "2014"); + break; } DWORD prod; if (GetProductInfo (osversion.dwMajorVersion, diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index ef10a5d5a..8894b315f 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -47,7 +47,6 @@ typedef struct { char *str; BOOL domain; - BOOL with_dom; } domlist_t; static void @@ -168,8 +167,8 @@ enum_unix_groups (domlist_t *mach, const char *sep, DWORD id_offset, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type)) printf ("%s%s%ls:%s:%" PRIu32 ":\n", - mach->with_dom ? "Unix_Group" : "", - mach->with_dom ? sep : "", + "Unix_Group", + sep, p, put_sid (psid), (unsigned int) (id_offset + @@ -205,8 +204,8 @@ enum_unix_groups (domlist_t *mach, const char *sep, DWORD id_offset, &acc_type) && !iswdigit (grp[0])) printf ("%s%s%ls:%s:%" PRIu32 ":\n", - mach->with_dom ? "Unix_Group" : "", - mach->with_dom ? sep : "", + "Unix_Group", + sep, grp, put_sid (psid), (unsigned int) (id_offset + start)); @@ -341,8 +340,8 @@ enum_local_groups (domlist_t *mach, const char *sep, gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1); printf ("%ls%s%ls:%s:%" PRIu32 ":\n", - mach->with_dom && !is_builtin ? domain_name : L"", - mach->with_dom && !is_builtin ? sep : "", + !is_builtin ? domain_name : L"", + !is_builtin ? sep : "", buffer[i].lgrpi0_name, put_sid (psid), (unsigned int) (gid + (is_builtin ? 0 : id_offset))); @@ -455,8 +454,8 @@ enum_groups (domlist_t *mach, const char *sep, DWORD id_offset, got_curr_pgrp = TRUE; printf ("%ls%s%ls:%s:%" PRIu32 ":\n", - mach->with_dom ? domain_name : L"", - mach->with_dom ? sep : "", + domain_name, + sep, buffer[i].grpi2_name, put_sid (psid), (unsigned int) (id_offset + gid)); @@ -481,9 +480,8 @@ usage (FILE * stream) "\n" "Options:\n" "\n" -" -l,--local [machine] print local groups\n" +" -l,--local [machine] print local groups of \"machine\"\n" " (from local machine if no machine specified)\n" -" -L,--Local machine ditto, but generate groupname with machine prefix\n" " -d,--domain [domain] print domain groups\n" " (from current domain if no domain specified)\n" " -c,--current print current group\n" @@ -616,7 +614,7 @@ main (int argc, char **argv) program_invocation_short_name, domlist[i].domain ? "domain" : "machine", domlist[i].str); - goto skip; + break; } domlist[print_domlist].str = opt; if (opt && (p = strchr (opt, ','))) @@ -629,8 +627,20 @@ main (int argc, char **argv) } *p = '\0'; } - domlist[print_domlist++].with_dom = (c == 'L'); -skip: + if ((c == 'l' || c == 'L') && opt) + { + char cname[1024]; + DWORD csize = sizeof cname; + + /* Check if machine name is local machine. Keep it simple. */ + if (GetComputerNameExA (strchr (opt, '.') + ? ComputerNameDnsFullyQualified + : ComputerNameNetBIOS, + cname, &csize) + && strcasecmp (opt, cname) == 0) + domlist[print_domlist].str = NULL; + } + ++print_domlist; break; case 'S': sep_char = optarg; diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index 66cf9f364..5ff33d8a1 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -48,7 +48,6 @@ typedef struct { char *str; BOOL domain; - BOOL with_dom; } domlist_t; static void @@ -170,8 +169,8 @@ enum_unix_users (domlist_t *mach, const char *sep, DWORD id_offset, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type)) printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", - mach->with_dom ? "Unix_User" : "", - mach->with_dom ? sep : "", + "Unix_User", + sep, user + 10, (unsigned int) (id_offset + *GetSidSubAuthority (psid, @@ -207,8 +206,8 @@ enum_unix_users (domlist_t *mach, const char *sep, DWORD id_offset, &acc_type) && !iswdigit (user[0])) printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", - mach->with_dom ? "Unix_User" : "", - mach->with_dom ? sep : "", + "Unix_User", + sep, user, (unsigned int) (id_offset + start), put_sid (psid)); @@ -335,8 +334,8 @@ enum_users (domlist_t *mach, const char *sep, const char *passed_home_path, printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32 ":%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n", - mach->with_dom ? domain_name : L"", - mach->with_dom ? sep : "", + domain_name, + sep, buffer[i].usri3_name, (unsigned int) (id_offset + uid), (unsigned int) (id_offset + gid), @@ -370,16 +369,15 @@ usage (FILE * stream) "\n" "Options:\n" "\n" -" -l,--local [machine] print local user accounts\n" +" -l,--local [machine] print local user accounts of \"machine\"\n" " (from local machine if no machine specified)\n" -" -L,--Local machine ditto, but generate username with machine prefix\n" " -d,--domain [domain] print domain accounts\n" " (from current domain if no domain specified)\n" " -c,--current print current user\n" " -S,--separator char for -l use character char as domain\\user\n" " separator in username instead of the default '%s'\n" " -o,--id-offset offset change the default offset (0x10000) added to uids\n" -" in domain or foreign server accounts.\n" +" of foreign local machine accounts. Use with -l.\n" " -u,--username username only return information for the specified user\n" " one of -l, -d must be specified, too\n" " -b,--no-builtin don't print BUILTIN users\n" @@ -513,21 +511,33 @@ main (int argc, char **argv) program_invocation_short_name, domlist[i].domain ? "domain" : "machine", domlist[i].str); - goto skip; + break; } domlist[print_domlist].str = opt; if (opt && (p = strchr (opt, ','))) { if (p == opt) { - fprintf (stderr, "%s: Malformed domain,offset string '%s'. " + fprintf (stderr, "%s: Malformed domain string '%s'. " "Skipping...\n", program_invocation_short_name, opt); break; } *p = '\0'; } - domlist[print_domlist++].with_dom = (c == 'L'); -skip: + if ((c == 'l' || c == 'L') && opt) + { + char cname[1024]; + DWORD csize = sizeof cname; + + /* Check if machine name is local machine. Keep it simple. */ + if (GetComputerNameExA (strchr (opt, '.') + ? ComputerNameDnsFullyQualified + : ComputerNameNetBIOS, + cname, &csize) + && strcasecmp (opt, cname) == 0) + domlist[print_domlist].str = NULL; + } + ++print_domlist; break; case 'S': sep_char = optarg; |