From 29adfd78bd5870268f0b930f25374f7299dd7e8d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 6 Mar 2014 18:54:08 +0000 Subject: * passwd.cc (pg_ent::enumerate_builtin): Convert pwd_builtins and grp_builtins to array of cygpsid pointers. Replace SID strings with pointers to well known SIDs. * sec_helper.cc (well_known_local_service_sid): Define. (well_known_network_service_sid): Define. (trusted_installer_sid): Define. * security.h (well_known_local_service_sid): Declare. (well_known_network_service_sid): Declare. (trusted_installer_sid): Declare. * uinfo.cc (pwdgrp::fetch_account_from_windows): Throughout set acc_type to SidTypeUnknown if LookupAccountXXX function failed. Create simplified passwd entry for non-user accounts, except for LocalSystem. Add comment. --- winsup/cygwin/passwd.cc | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'winsup/cygwin/passwd.cc') diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 70759086f..cbe0945d6 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -467,36 +467,27 @@ pg_ent::enumerate_file () void * pg_ent::enumerate_builtin () { - static const char *pwd_builtins[] = { - /* SYSTEM */ - "S-1-5-18", - /* LocalService */ - "S-1-5-19", - /* NetworkService */ - "S-1-5-20", - /* Administrators */ - "S-1-5-32-544", - /* TrustedInstaller */ - "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464", - /* The end */ + static cygpsid *pwd_builtins[] = { + &well_known_system_sid, + &well_known_local_service_sid, + &well_known_network_service_sid, + &well_known_admins_sid, + &trusted_installer_sid, NULL }; - static const char *grp_builtins[] = { - /* SYSTEM */ - "S-1-5-18", - /* TrustedInstaller */ - "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464", - /* The end */ + static cygpsid *grp_builtins[] = { + &well_known_system_sid, + &trusted_installer_sid, NULL }; - const char **builtins = group ? grp_builtins : pwd_builtins; + cygpsid **builtins = group ? grp_builtins : pwd_builtins; if (!builtins[cnt]) { cnt = max = resume = 0; return NULL; } - cygsid sid (builtins[cnt++]); + cygsid sid (*builtins[cnt++]); fetch_user_arg_t arg; arg.type = SID_arg; arg.sid = &sid; -- cgit v1.2.3