diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-03-18 19:15:27 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-03-18 19:15:27 +0300 |
commit | 4a9636b1d6d3380eaff53621498445f6adcfc18e (patch) | |
tree | 1fa05c56734c5f4e600e7e71362dcd0bac39b522 /winsup/cygwin/security.h | |
parent | 1d91d469ee534fab47fdb710a037378c103fee23 (diff) |
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>
Diffstat (limited to 'winsup/cygwin/security.h')
-rw-r--r-- | winsup/cygwin/security.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 6af87e0d4..867345774 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -237,6 +237,18 @@ public: inline PSID set () { return psid = (PSID) sbuf; } + inline BOOL getfrompw_gecos (const struct passwd *pw) + { + char *sp = (pw && pw->pw_gecos) ? strrchr (pw->pw_gecos, ',') : NULL; + return (*this = sp ? sp + 1 : sp) != NO_SID; + } + inline BOOL getfromgr_passwd (const struct group *gr) + { + char *sp = (gr && gr->gr_passwd) ? gr->gr_passwd : NULL; + return (*this = sp) != NO_SID; + } + + /* Implemented in pwdgrp.h. */ BOOL getfrompw (const struct passwd *pw); BOOL getfromgr (const struct group *gr); |