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>2014-02-28 15:37:02 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-02-28 15:37:02 +0400
commit6cc7c925ce8614741f09dced8026b6c643554bfd (patch)
tree05d7000e02d8468fe05c689397cc9452cc04b48d /winsup/cygwin/grp.cc
parentb39fa2c88da849c7a0bd6a745357b57690501e3d (diff)
* cygheap.h (cygheap_user::sid): Return reference to cygpsid rather
than PSID. (cygheap_user::saved_sid): Ditto. (cygheap_pwdgrp::cache_t): New type. (cygheap_pwdgrp::caching): Convert to cache_t. (cygheap_pwdgrp::nss_db_caching): Change accordingly. (cygheap_pwdgrp::nss_db_full_caching): New inline method. * grp.cc (internal_getgroups): Reinvent. Take cyg_ldap pointer as third parameter and use throughout. (getgroups32): Call internal_getgroups. * pwdgrp.h (internal_getgroups): Declare. * uinfo.cc (internal_getlogin): Partial rewrite to accommodate having no connection to the DC. Give primary group from user token more weight. Generate group entries for all groups in the user token if caching is set to NSS_FULL_CACHING. (cygheap_pwdgrp::init): Initialize caching to NSS_FULL_CACHING. (cygheap_pwdgrp::nss_init_line): Handle "db_cache: full". (pwdgrp::add_account_from_windows): Fix group handling in non-caching mode. (pwdgrp::fetch_account_from_windows): Default primary group for the current user to primary group from user token. Check for primary domain first after LookupAccountSid failed.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 31bfeda2b..cd4afd4a1 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -459,21 +459,20 @@ endgrent_filtered (void *gr)
((gr_ent *) gr)->endgrent ();
}
-extern "C" int
-getgroups32 (int gidsetsize, gid_t *grouplist)
+int
+internal_getgroups (int gidsetsize, gid_t *grouplist, cyg_ldap *pldap)
{
NTSTATUS status;
HANDLE tok;
ULONG size;
int cnt = 0;
struct group *grp;
- cyg_ldap cldap;
if (cygheap->user.groups.issetgroups ())
{
for (int pg = 0; pg < cygheap->user.groups.sgsids.count (); ++pg)
if ((grp = internal_getgrsid (cygheap->user.groups.sgsids.sids[pg],
- &cldap)))
+ pldap)))
{
if (cnt < gidsetsize)
grouplist[cnt] = grp->gr_gid;
@@ -500,7 +499,7 @@ getgroups32 (int gidsetsize, gid_t *grouplist)
for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
{
cygpsid sid = groups->Groups[pg].Sid;
- if ((grp = internal_getgrsid (sid, &cldap)))
+ if ((grp = internal_getgrsid (sid, pldap)))
{
if ((groups->Groups[pg].Attributes
& (SE_GROUP_ENABLED | SE_GROUP_INTEGRITY_ENABLED))
@@ -525,6 +524,14 @@ error:
return -1;
}
+extern "C" int
+getgroups32 (int gidsetsize, gid_t *grouplist)
+{
+ cyg_ldap cldap;
+
+ return internal_getgroups (gidsetsize, grouplist, &cldap);
+}
+
#ifdef __x86_64__
EXPORT_ALIAS (getgroups32, getgroups)
#else