* 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.
This commit is contained in:
parent
6480b2ae76
commit
98cc373860
|
@ -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>
|
2014-02-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
|
* grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
|
||||||
|
|
|
@ -381,7 +381,7 @@ gr_ent::enumerate_local ()
|
||||||
fetch_user_arg_t arg;
|
fetch_user_arg_t arg;
|
||||||
arg.type = SID_arg;
|
arg.type = SID_arg;
|
||||||
arg.sid = &sid;
|
arg.sid = &sid;
|
||||||
char *line = pg.fetch_account_from_windows (arg, true);
|
char *line = pg.fetch_account_from_windows (arg, true, false);
|
||||||
if (line)
|
if (line)
|
||||||
return pg.add_account_post_fetch (line, false);
|
return pg.add_account_post_fetch (line, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,7 +487,7 @@ pg_ent::enumerate_builtin ()
|
||||||
fetch_user_arg_t arg;
|
fetch_user_arg_t arg;
|
||||||
arg.type = SID_arg;
|
arg.type = SID_arg;
|
||||||
arg.sid = &sid;
|
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);
|
return pg.add_account_post_fetch (line, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ pg_ent::enumerate_sam ()
|
||||||
fetch_user_arg_t arg;
|
fetch_user_arg_t arg;
|
||||||
arg.type = SID_arg;
|
arg.type = SID_arg;
|
||||||
arg.sid = &sid;
|
arg.sid = &sid;
|
||||||
char *line = pg.fetch_account_from_windows (arg, group);
|
char *line = pg.fetch_account_from_windows (arg, group, false);
|
||||||
if (line)
|
if (line)
|
||||||
return pg.add_account_post_fetch (line, false);
|
return pg.add_account_post_fetch (line, false);
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ pg_ent::enumerate_ad ()
|
||||||
fetch_user_arg_t arg;
|
fetch_user_arg_t arg;
|
||||||
arg.type = SID_arg;
|
arg.type = SID_arg;
|
||||||
arg.sid = &sid;
|
arg.sid = &sid;
|
||||||
char *line = pg.fetch_account_from_windows (arg, group);
|
char *line = pg.fetch_account_from_windows (arg, group, false);
|
||||||
if (line)
|
if (line)
|
||||||
return pg.add_account_post_fetch (line, false);
|
return pg.add_account_post_fetch (line, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,8 @@ class pwdgrp
|
||||||
void *add_account_from_windows (uint32_t id, bool group);
|
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_line (fetch_user_arg_t &arg, const char *line);
|
||||||
char *fetch_account_from_file (fetch_user_arg_t &arg);
|
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_pwbuf ();
|
||||||
pwdgrp *prep_tls_grbuf ();
|
pwdgrp *prep_tls_grbuf ();
|
||||||
|
|
||||||
|
|
|
@ -1162,7 +1162,8 @@ fetch_posix_offset (PDS_DOMAIN_TRUSTSW td, bool &ldap_open, cyg_ldap &cldap)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
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. */
|
/* Used in LookupAccount calls. */
|
||||||
WCHAR namebuf[UNLEN + 1], *name = namebuf;
|
WCHAR namebuf[UNLEN + 1], *name = namebuf;
|
||||||
|
@ -1502,18 +1503,25 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
||||||
* sizeof (WCHAR)), val);
|
* sizeof (WCHAR)), val);
|
||||||
/* Check and, if necessary, add unix<->windows
|
/* Check and, if necessary, add unix<->windows
|
||||||
id mapping on the fly. */
|
id mapping on the fly. */
|
||||||
|
if (ugid_caching)
|
||||||
|
{
|
||||||
id_val = cldap.get_unix_uid ();
|
id_val = cldap.get_unix_uid ();
|
||||||
if (id_val != ILLEGAL_UID
|
if (id_val != ILLEGAL_UID
|
||||||
&& cygheap->ugid_cache.get_uid (id_val)
|
&& cygheap->ugid_cache.get_uid (id_val)
|
||||||
== ILLEGAL_UID)
|
== ILLEGAL_UID)
|
||||||
cygheap->ugid_cache.add_uid (id_val, uid);
|
cygheap->ugid_cache.add_uid (id_val, uid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else /* SidTypeGroup */
|
else /* SidTypeGroup */
|
||||||
{
|
{
|
||||||
if ((val = cldap.get_group_name ())
|
if ((val = cldap.get_group_name ())
|
||||||
&& wcscmp (name, val))
|
&& wcscmp (name, val))
|
||||||
user = wcscpy ((PWCHAR) alloca ((wcslen (val) + 1)
|
user = wcscpy ((PWCHAR) alloca ((wcslen (val) + 1)
|
||||||
* sizeof (WCHAR)), val);
|
* sizeof (WCHAR)), val);
|
||||||
|
/* Check and, if necessary, add unix<->windows
|
||||||
|
id mapping on the fly. */
|
||||||
|
if (ugid_caching)
|
||||||
|
{
|
||||||
id_val = cldap.get_unix_gid ();
|
id_val = cldap.get_unix_gid ();
|
||||||
if (id_val != ILLEGAL_GID
|
if (id_val != ILLEGAL_GID
|
||||||
&& cygheap->ugid_cache.get_gid (id_val)
|
&& cygheap->ugid_cache.get_gid (id_val)
|
||||||
|
@ -1522,6 +1530,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Otherwise check account domain (local SAM).*/
|
/* Otherwise check account domain (local SAM).*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1624,7 +1633,8 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
||||||
|| (gr = internal_getgrnam (gname + 1)))
|
|| (gr = internal_getgrnam (gname + 1)))
|
||||||
gid = gr->gr_gid;
|
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)
|
if (acc_type == SidTypeUser)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue