diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-02-22 19:38:12 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-02-22 19:38:12 +0000 |
commit | b211f4c17e1939f2bd00c07af2d30a8f1fec67df (patch) | |
tree | 3975b6ccdeeb0a623059395d88c26c5d827d38a7 /winsup/cygwin/passwd.cc | |
parent | 98cc373860377673c6634edcb529b21e10807618 (diff) | |
download | cygnal-b211f4c17e1939f2bd00c07af2d30a8f1fec67df.tar.gz cygnal-b211f4c17e1939f2bd00c07af2d30a8f1fec67df.tar.bz2 cygnal-b211f4c17e1939f2bd00c07af2d30a8f1fec67df.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/passwd.cc')
-rw-r--r-- | winsup/cygwin/passwd.cc | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 54a125066..1a5564904 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -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; } |