diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-02-21 10:01:00 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-02-21 10:01:00 +0000 |
commit | 98cc373860377673c6634edcb529b21e10807618 (patch) | |
tree | 61814081400e629eb45a8b7026e659b1b3d48697 /winsup/cygwin/uinfo.cc | |
parent | 6480b2ae76205f9a8c278c8f0ce5ff1c5b146846 (diff) | |
download | cygnal-98cc373860377673c6634edcb529b21e10807618.tar.gz cygnal-98cc373860377673c6634edcb529b21e10807618.tar.bz2 cygnal-98cc373860377673c6634edcb529b21e10807618.zip |
* pwdgrp.h (pwdgrp::fetch_account_from_windows): Add bool parameter
to declaration, set to true by default.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Add bool parameter
"ugid_caching". Only add account to ugid_cache if set to true.
* grp.cc (gr_ent::enumerate_local): Call fetch_account_from_windows
with ugid_caching parameter set to false.
* passwd.cc (pg_ent::enumerate_builtin): Ditto.
(pg_ent::enumerate_sam): Ditto.
(pg_ent::enumerate_ad): Ditto.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index be7bd34f2..46e311eb6 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -1162,7 +1162,8 @@ fetch_posix_offset (PDS_DOMAIN_TRUSTSW td, bool &ldap_open, cyg_ldap &cldap) } char * -pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group) +pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group, + bool ugid_caching) { /* Used in LookupAccount calls. */ WCHAR namebuf[UNLEN + 1], *name = namebuf; @@ -1502,11 +1503,14 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group) * sizeof (WCHAR)), val); /* Check and, if necessary, add unix<->windows id mapping on the fly. */ - id_val = cldap.get_unix_uid (); - if (id_val != ILLEGAL_UID - && cygheap->ugid_cache.get_uid (id_val) - == ILLEGAL_UID) - cygheap->ugid_cache.add_uid (id_val, uid); + if (ugid_caching) + { + id_val = cldap.get_unix_uid (); + if (id_val != ILLEGAL_UID + && cygheap->ugid_cache.get_uid (id_val) + == ILLEGAL_UID) + cygheap->ugid_cache.add_uid (id_val, uid); + } } else /* SidTypeGroup */ { @@ -1514,11 +1518,16 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group) && wcscmp (name, val)) user = wcscpy ((PWCHAR) alloca ((wcslen (val) + 1) * sizeof (WCHAR)), val); - id_val = cldap.get_unix_gid (); - if (id_val != ILLEGAL_GID - && cygheap->ugid_cache.get_gid (id_val) - == ILLEGAL_GID) - cygheap->ugid_cache.add_gid (id_val, uid); + /* Check and, if necessary, add unix<->windows + id mapping on the fly. */ + if (ugid_caching) + { + id_val = cldap.get_unix_gid (); + if (id_val != ILLEGAL_GID + && cygheap->ugid_cache.get_gid (id_val) + == ILLEGAL_GID) + cygheap->ugid_cache.add_gid (id_val, uid); + } } } } @@ -1624,7 +1633,8 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group) || (gr = internal_getgrnam (gname + 1))) gid = gr->gr_gid; } - if (uxid && ((id_val = wcstoul (uxid, &e, 10)), !*e)) + if (ugid_caching && uxid + && ((id_val = wcstoul (uxid, &e, 10)), !*e)) { if (acc_type == SidTypeUser) { |