summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-21 10:01:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-02-21 10:01:00 +0000
commit98cc373860377673c6634edcb529b21e10807618 (patch)
tree61814081400e629eb45a8b7026e659b1b3d48697
parent6480b2ae76205f9a8c278c8f0ce5ff1c5b146846 (diff)
downloadcygnal-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.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/grp.cc2
-rw-r--r--winsup/cygwin/passwd.cc6
-rw-r--r--winsup/cygwin/pwdgrp.h3
-rw-r--r--winsup/cygwin/uinfo.cc34
5 files changed, 40 insertions, 17 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e54075b01..a0cce104a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,15 @@
+2014-02-21 Corinna Vinschen <corinna@vinschen.de>
+
+ * 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.
+
2014-02-20 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index c82efc90b..e4aed4d55 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -381,7 +381,7 @@ gr_ent::enumerate_local ()
fetch_user_arg_t arg;
arg.type = SID_arg;
arg.sid = &sid;
- char *line = pg.fetch_account_from_windows (arg, true);
+ char *line = pg.fetch_account_from_windows (arg, true, false);
if (line)
return pg.add_account_post_fetch (line, false);
}
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index 70e4e256b..54a125066 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -487,7 +487,7 @@ pg_ent::enumerate_builtin ()
fetch_user_arg_t arg;
arg.type = SID_arg;
arg.sid = &sid;
- char *line = pg.fetch_account_from_windows (arg, group);
+ char *line = pg.fetch_account_from_windows (arg, group, false);
return pg.add_account_post_fetch (line, false);
}
@@ -534,7 +534,7 @@ pg_ent::enumerate_sam ()
fetch_user_arg_t arg;
arg.type = SID_arg;
arg.sid = &sid;
- char *line = pg.fetch_account_from_windows (arg, group);
+ char *line = pg.fetch_account_from_windows (arg, group, false);
if (line)
return pg.add_account_post_fetch (line, false);
}
@@ -583,7 +583,7 @@ pg_ent::enumerate_ad ()
fetch_user_arg_t arg;
arg.type = SID_arg;
arg.sid = &sid;
- char *line = pg.fetch_account_from_windows (arg, group);
+ char *line = pg.fetch_account_from_windows (arg, group, false);
if (line)
return pg.add_account_post_fetch (line, false);
}
diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h
index 23931e2bc..d3546633f 100644
--- a/winsup/cygwin/pwdgrp.h
+++ b/winsup/cygwin/pwdgrp.h
@@ -110,7 +110,8 @@ class pwdgrp
void *add_account_from_windows (uint32_t id, bool group);
char *fetch_account_from_line (fetch_user_arg_t &arg, const char *line);
char *fetch_account_from_file (fetch_user_arg_t &arg);
- char *fetch_account_from_windows (fetch_user_arg_t &arg, bool group);
+ char *fetch_account_from_windows (fetch_user_arg_t &arg, bool group,
+ bool ugid_caching = true);
pwdgrp *prep_tls_pwbuf ();
pwdgrp *prep_tls_grbuf ();
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)
{