* autoload.cc (NetLocalGroupGetInfo): Replace NetGroupGetInfo.
* cygheap.h (class cygheap_ugid_cache): Move ugid_cache_t type here and rename. (struct init_cygheap): Add cygheap_ugid_cache member "ugid_cache". * pwdgrp.h (class ugid_cache_t): Remove here. * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Accommodate move of ugid_cache to cygheap. * sec_helper.cc (get_sids_info): Ditto. * uinfo.cc (ugid_cache): Remove. (pwdgrp::fetch_account_from_windows): Define id_val globally. Move SidTypeAlias handling into SidTypeUser/SidTypeGroup branch since aliases are handled like groups in SAM. Accommodate move of ugid_cache to cygheap. Consolidate code reading SAM comments into a single branch for both, SidTypeUser and SidTypeAlias. For SidTypeAlias, fix thinko and call NetLocalGroupGetInfo rather than NetGroupGetInfo. Simplify code setting Cygwin primary group for SAM accounts. Add code to handle UNIX uid/gid from SAM comment.
This commit is contained in:
@@ -141,42 +141,3 @@ public:
|
||||
struct group *find_group (const char *name);
|
||||
struct group *find_group (gid_t gid);
|
||||
};
|
||||
|
||||
class ugid_cache_t
|
||||
{
|
||||
struct idmap {
|
||||
uint32_t nfs_id;
|
||||
uint32_t cyg_id;
|
||||
};
|
||||
class idmaps {
|
||||
uint32_t _cnt;
|
||||
uint32_t _max;
|
||||
idmap *_map;
|
||||
public:
|
||||
idmaps () : _cnt (0), _max (0), _map (NULL) {}
|
||||
uint32_t get (uint32_t id) const
|
||||
{
|
||||
for (uint32_t i = 0; i < _cnt; ++i)
|
||||
if (_map[i].nfs_id == id)
|
||||
return _map[i].cyg_id;
|
||||
return (uint32_t) -1;
|
||||
}
|
||||
void add (uint32_t nfs_id, uint32_t cyg_id)
|
||||
{
|
||||
if (_cnt >= _max)
|
||||
_map = (idmap *) realloc (_map, (_max += 10) * sizeof (*_map));
|
||||
_map[_cnt].nfs_id = nfs_id;
|
||||
_map[_cnt].cyg_id = cyg_id;
|
||||
++_cnt;
|
||||
}
|
||||
};
|
||||
idmaps uids;
|
||||
idmaps gids;
|
||||
|
||||
public:
|
||||
uid_t get_uid (uid_t uid) const { return uids.get (uid); }
|
||||
gid_t get_gid (gid_t gid) const { return gids.get (gid); }
|
||||
void add_uid (uid_t nfs_uid, uid_t cyg_uid) { uids.add (nfs_uid, cyg_uid); }
|
||||
void add_gid (gid_t nfs_gid, gid_t cyg_gid) { gids.add (nfs_gid, cyg_gid); }
|
||||
};
|
||||
extern ugid_cache_t ugid_cache;
|
||||
|
Reference in New Issue
Block a user