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
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-04-05 17:37:32 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-04-05 17:37:32 +0400
commit036fb4772c9fab16a0e725daec7a3e2ded7612f6 (patch)
tree3d3402863d13f84f0c2a458d7731b6a7612408c9 /winsup/utils/mkgroup.c
parentb475fe549740181baa5812af7534613f36e555b0 (diff)
* mkgroup.c (print_special_by_sid): Rename from print_special. Change
calls throughout. (print_special_by_name): New function. (main): Call print_special_by_name for TrustedInstaller account. * mkpasswd.c (print_special_by_sid): Rename from print_special. Change calls throughout. (print_special_by_name): New function. (enum_std_accounts): Call print_special_by_name for TrustedInstaller account.
Diffstat (limited to 'winsup/utils/mkgroup.c')
-rw-r--r--winsup/utils/mkgroup.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 393d8f8f7..f712553c4 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -1,7 +1,7 @@
/* mkgroup.c:
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
+ 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -558,9 +558,9 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
}
static void
-print_special (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
- DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
- DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
+print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
+ DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
+ DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
{
WCHAR grp[GNLEN + 1], dom[MAX_DOMAIN_NAME_LEN + 1];
DWORD glen, dlen, rid;
@@ -597,6 +597,23 @@ print_special (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
}
}
+static void
+print_special_by_name (PCWSTR name, gid_t gid)
+{
+ DWORD size = 256, dom_size = 256;
+ PSID sid = (PSID) alloca (size);
+ WCHAR dom[dom_size];
+ SID_NAME_USE use;
+
+ PWCHAR name_only = wcschr (name, L'\\');
+ if (name_only)
+ ++name_only;
+
+ if (LookupAccountNameW (NULL, name, sid, &size, dom, &dom_size, &use))
+ printf ("%ls:%s:%lu:\n",
+ name_only ?: name, put_sid (sid), (unsigned long) gid);
+}
+
static int
usage (FILE * stream)
{
@@ -730,8 +747,8 @@ main (int argc, char **argv)
if (argc == 1)
{
- print_special (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
+ print_special_by_sid (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
+ 0, 0, 0, 0, 0, 0, 0);
if (in_domain)
{
if (!enum_local_groups (TRUE, NULL, sep_char, id_offset,
@@ -857,8 +874,11 @@ skip:
/* Get 'system' group */
if (!disp_groupname && print_system && print_builtin && print_domlist)
- print_special (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
+ {
+ print_special_by_sid (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
+ 0, 0, 0, 0, 0, 0, 0);
+ print_special_by_name (L"NT SERVICE\\TrustedInstaller", -2);
+ }
off = id_offset;
for (i = 0; i < print_domlist; ++i)