* external.cc (cygwin_internal): Add cases for CW_GETNSSSEP,

CW_GETPWSID and CW_GETGRSID.
	* grp.cc (internal_getgrsid_from_db): New function.
	* passwd.cc (internal_getpwsid_from_db): New function.
	(pg_ent::setent): Add special case for call from mkpasswd/mkgroup.
	* pwdgrp.h (internal_getpwsid_from_db): Declare.
	(internal_getgrsid_from_db): Declare.
	(enum nss_enum_t): Move to include/sys/cygwin.h.
	(class pg_ent): Add comment.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Fix typo in comment.
	Change "UNIX" to "Unix" in domain name.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GETNSSSEP,
	CW_GETPWSID and CW_GETGRSID.
	(enum nss_enum_t): Define here.
This commit is contained in:
Corinna Vinschen
2014-02-22 19:38:12 +00:00
parent 98cc373860
commit b211f4c17e
7 changed files with 98 additions and 27 deletions

View File

@@ -123,6 +123,14 @@ internal_getpwsid (cygpsid &sid)
return NULL;
}
/* This function gets only called from mkpasswd via cygwin_internal. */
struct passwd *
internal_getpwsid_from_db (cygpsid &sid)
{
cygheap->pg.nss_init ();
return cygheap->pg.pwd_cache.win.add_user_from_windows (sid);
}
struct passwd *
internal_getpwnam (const char *name)
{
@@ -300,23 +308,28 @@ pg_ent::setent (bool _group, int _enums, PCWSTR _enum_tdoms)
endent (_group);
if (!_enums && !_enum_tdoms)
{
/* This is the default, when called from the usual setpwent/setgrent
functions. */
enums = cygheap->pg.nss_db_enums ();
enum_tdoms = cygheap->pg.nss_db_enum_tdoms ();
if (_group)
{
from_files = cygheap->pg.nss_grp_files ();
from_db = cygheap->pg.nss_grp_db ();
}
else
{
from_files = cygheap->pg.nss_pwd_files ();
from_db = cygheap->pg.nss_pwd_db ();
}
}
else
{
/* This case is when called from mkpasswd/mkgroup via cygwin_internal. */
enums = _enums;
enum_tdoms = _enum_tdoms;
}
if (_group)
{
from_files = cygheap->pg.nss_grp_files ();
from_db = cygheap->pg.nss_grp_db ();
}
else
{
from_files = cygheap->pg.nss_pwd_files ();
from_db = cygheap->pg.nss_pwd_db ();
from_files = false;
from_db = true;
}
state = from_cache;
}