Implmenet faster getfrompw/getfromgr

* grp.cc (pwdgrp::parse_group): Call cygsid::getfromgr_passwd.
	* passwd.cc (pwdgrp::parse_passwd): Call cygsid::getfrompw_gecos.
	* pwdgrp.h (cygsid::getfrompw): Implement as inline method here,
	accessing pg_pwd's sid member directly.
	(cygsid::getfromgr): Implement as inline method here, accessing
	pg_grp's sid member directly.
	* sec_auth.cc (extract_nt_dom_user): Call cygsid::getfrompw_gecos.
	Explain why.
	* sec_helper.cc (cygsid::getfrompw): Drop implementation.
	(cygsid::getfromgr): Ditto.
	* security.h (cygsid::getfrompw_gecos): Implement former getfrompw
	inline here.
	(cygsid::getfromgr_passwd): Implement former getfromgr inline here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2015-03-18 17:15:27 +01:00
parent 1d91d469ee
commit 4a9636b1d6
7 changed files with 43 additions and 18 deletions

View File

@@ -119,7 +119,10 @@ extract_nt_dom_user (const struct passwd *pw, PWCHAR domain, PWCHAR user)
debug_printf ("pw_gecos %p (%s)", pw->pw_gecos, pw->pw_gecos);
if (psid.getfrompw (pw)
/* The incoming passwd entry is not necessarily a pointer to the
internal passwd buffers, thus we must not rely on being able to
cast it to pg_pwd. */
if (psid.getfrompw_gecos (pw)
&& LookupAccountSidW (NULL, psid, user, &ulen, domain, &dlen, &use))
return;