* autoload.cc (LsaLookupSids): Import.

* cygserver_pwdgrp.h: Include userinfo.h.  Drop workaround defining
	fetch_user_arg_type_t locally.
	* grp.cc (internal_getgrsid_cachedonly): New function.
	(internal_getgrfull): Ditto.
	(internal_getgroups): Rearrange function.  Center around fetching all
	cached group info first, calling LsaLookupSids on all so far non-cached
	groups second.  Pass all available info to new internal_getgrfull call.
	* pwdgrp.h: Include userinfo.h.  Move definitions of
	fetch_user_arg_type_t and fetch_user_arg_t there.
	(pwdgrp::add_group_from_windows): Declare with getting full group info.
	Called from internal_getgrfull.
	* uinfo.cc (pwdgrp::add_group_from_windows): Define.
	(pwdgrp::fetch_account_from_line): Add default case.
	(pwdgrp::fetch_account_from_file): Ditto.
	(pwdgrp::fetch_account_from_windows): Handle FULL_grp_arg.
	(client_request_pwdgrp::client_request_pwdgrp): Add default case.
	* userinfo.h: New header.
	(enum fetch_user_arg_type_t): Add FULL_grp_arg.
	(struct fetch_full_grp_t): New datatype.
This commit is contained in:
Corinna Vinschen
2015-02-23 20:51:12 +00:00
parent 9b54770bd7
commit bef55bb5c3
7 changed files with 242 additions and 59 deletions

View File

@@ -15,6 +15,7 @@ details. */
#include "sync.h"
#include "ldap.h"
#include "miscfuncs.h"
#include "userinfo.h"
/* These functions are needed to allow searching and walking through
the passwd and group lists */
@@ -37,24 +38,6 @@ void *setgrent_filtered (int enums, PCWSTR enum_tdoms);
void *getgrent_filtered (void *gr);
void endgrent_filtered (void *gr);
enum fetch_user_arg_type_t {
SID_arg,
NAME_arg,
ID_arg
};
struct fetch_user_arg_t
{
fetch_user_arg_type_t type;
union {
cygpsid *sid;
const char *name;
uint32_t id;
};
/* Only used in fetch_account_from_file/line. */
size_t len;
};
struct pg_pwd
{
struct passwd p;
@@ -176,6 +159,8 @@ public:
{ return (struct group *) add_account_from_windows (name, pldap); }
struct group *add_group_from_windows (uint32_t id, cyg_ldap *pldap = NULL)
{ return (struct group *) add_account_from_windows (id, pldap); }
struct group *add_group_from_windows (fetch_full_grp_t &full_grp,
cyg_ldap *pldap = NULL);
struct group *find_group (cygpsid &sid);
struct group *find_group (const char *name);
struct group *find_group (gid_t gid);