* cygheap.h (enum cygheap_pwdgrp::cache_t): Remove.

(cygheap_pwdgrp::caching): Convert to bool.
	(cygheap_pwdgrp::pwd_cache): Add cygserver member.
	(cygheap_pwdgrp::grp_cache): Ditto.
	(cygheap_pwdgrp::nss_db_caching): Drop.
	(cygheap_pwdgrp::nss_db_full_caching): Drop.
	(cygheap_pwdgrp::nss_cygserver_caching): New method.
	(cygheap_pwdgrp::nss_disable_cygserver_caching): New method.
	* cygserver.h (client_request::request_code_t): Add
	CYGSERVER_REQUEST_PWDGRP.
	* cygserver_pwdgrp.h: New file.
	* cygtls.h (struct _local_storage): Remove pwbuf and grbuf members.
	* grp.cc (pwdgrp::prep_tls_grbuf): Drop.
	(internal_getgrsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getgrnam): Ditto.
	(internal_getgrgid): Ditto.
	(gr_ent::enumerate_caches): Handle cygserver cache.
	* passwd.cc (pwdgrp::prep_tls_pwbuf): Drop.
	(internal_getpwsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getpwnam): Ditto.
	(internal_getpwuid): Ditto.
	(pw_ent::enumerate_caches): Handle cygserver cache.
	* pwdgrp.h (pwdgrp::add_account_from_cygserver): New method declaration.
	(pwdgrp::fetch_account_from_cygserver): New method declaration.
	(pwdgrp::prep_tls_pwbuf): Drop declaration.
	(pwdgrp::prep_tls_grbuf): Drop declaration.
	(pwdgrp::add_user_from_cygserver): New inline methods.
	(pwdgrp::add_group_from_cygserver): New inline methods.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
	* uinfo.cc (internal_getlogin): Call internal_getgroups if cygserver
	caching is not available.
	(cygheap_pwdgrp::init): Initialize pwd_cache.cygserver and
	grp_cache.cygserver.  Set caching to true.
	(cygheap_pwdgrp::nss_init_line): Drop db_cache handling entirely.
	(pwdgrp::add_account_from_windows): Drop no caching handling.
	(client_request_pwdgrp::client_request_pwdgrp): New method.
	(pwdgrp::fetch_account_from_cygserver): New method.
	(pwdgrp::add_account_from_cygserver): New method.

	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix formatting.
	* include/sys/cygwin.h: Ditto.
This commit is contained in:
Corinna Vinschen
2014-03-12 17:36:56 +00:00
parent 681bb2f78a
commit 29b7313d22
13 changed files with 593 additions and 378 deletions

View File

@@ -111,12 +111,14 @@ class pwdgrp
void *add_account_from_windows (cygpsid &sid, cyg_ldap *pldap = NULL);
void *add_account_from_windows (const char *name, cyg_ldap *pldap = NULL);
void *add_account_from_windows (uint32_t id, cyg_ldap *pldap = NULL);
void *add_account_from_cygserver (cygpsid &sid);
void *add_account_from_cygserver (const char *name);
void *add_account_from_cygserver (uint32_t id);
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,
cyg_ldap *pldap = NULL);
pwdgrp *prep_tls_pwbuf ();
pwdgrp *prep_tls_grbuf ();
char *fetch_account_from_cygserver (fetch_user_arg_t &arg);
public:
ULONG cached_users () const { return curr_lines; }
@@ -127,7 +129,13 @@ public:
void init_pwd ();
bool is_passwd () const { return pwdgrp_buf_elem_size == sizeof (pg_pwd); }
pg_pwd *passwd () const { return (pg_pwd *) pwdgrp_buf; };
inline struct passwd *add_user_from_file (cygpsid &sid)
struct passwd *add_user_from_cygserver (cygpsid &sid)
{ return (struct passwd *) add_account_from_cygserver (sid); }
struct passwd *add_user_from_cygserver (const char *name)
{ return (struct passwd *) add_account_from_cygserver (name); }
struct passwd *add_user_from_cygserver (uint32_t id)
{ return (struct passwd *) add_account_from_cygserver (id); }
struct passwd *add_user_from_file (cygpsid &sid)
{ return (struct passwd *) add_account_from_file (sid); }
struct passwd *add_user_from_file (const char *name)
{ return (struct passwd *) add_account_from_file (name); }
@@ -147,6 +155,12 @@ public:
void init_grp ();
bool is_group () const { return pwdgrp_buf_elem_size == sizeof (pg_grp); }
pg_grp *group () const { return (pg_grp *) pwdgrp_buf; };
struct group *add_group_from_cygserver (cygpsid &sid)
{ return (struct group *) add_account_from_cygserver (sid); }
struct group *add_group_from_cygserver (const char *name)
{ return (struct group *) add_account_from_cygserver (name); }
struct group *add_group_from_cygserver (uint32_t id)
{ return (struct group *) add_account_from_cygserver (id); }
struct group *add_group_from_file (cygpsid &sid)
{ return (struct group *) add_account_from_file (sid); }
struct group *add_group_from_file (const char *name)