* cygheap.h (cygheap_pwdgrp): Remove constants NSS_FILES and NSS_DB.

Use NSS_SRC_FILES and NSS_SRC_DB throughout instead.
	(cygheap_pwdgrp::nss_pwd_src): New inline method.
	(cygheap_pwdgrp::nss_grp_src): Ditto.
	* external.cc (cygwin_internal): Add CW_GETNSS_PWD_SRC and
	CW_GETNSS_GRP_SRC cases.
	* uinfo.cc: Use NSS_SRC_FILES and NSS_SRC_DB throughout.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GETNSS_PWD_SRC
	and CW_GETNSS_GRP_SRC.
	(NSS_SRC_FILES): Define.
	(NSS_SRC_DB): Define.
This commit is contained in:
Corinna Vinschen 2014-11-12 11:19:08 +00:00
parent 3dce84ad07
commit 54f79f8650
6 changed files with 48 additions and 13 deletions

View File

@ -1,3 +1,18 @@
2014-11-12 Corinna Vinschen <corinna@vinschen.de>
* cygheap.h (cygheap_pwdgrp): Remove constants NSS_FILES and NSS_DB.
Use NSS_SRC_FILES and NSS_SRC_DB throughout instead.
(cygheap_pwdgrp::nss_pwd_src): New inline method.
(cygheap_pwdgrp::nss_grp_src): Ditto.
* external.cc (cygwin_internal): Add CW_GETNSS_PWD_SRC and
CW_GETNSS_GRP_SRC cases.
* uinfo.cc: Use NSS_SRC_FILES and NSS_SRC_DB throughout.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GETNSS_PWD_SRC
and CW_GETNSS_GRP_SRC.
(NSS_SRC_FILES): Define.
(NSS_SRC_DB): Define.
2014-11-07 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (cygwin__cxa_atexit): Fetch correct DSO handle value

View File

@ -400,8 +400,6 @@ public:
class cygheap_pwdgrp
{
static const int NSS_FILES = 1;
static const int NSS_DB = 2;
enum pfx_t {
NSS_AUTO = 0,
NSS_PRIMARY,
@ -434,10 +432,12 @@ public:
void init ();
inline void nss_init () { if (!nss_inited) _nss_init (); }
inline bool nss_pwd_files () const { return !!(pwd_src & NSS_FILES); }
inline bool nss_pwd_db () const { return !!(pwd_src & NSS_DB); }
inline bool nss_grp_files () const { return !!(grp_src & NSS_FILES); }
inline bool nss_grp_db () const { return !!(grp_src & NSS_DB); }
inline bool nss_pwd_files () const { return !!(pwd_src & NSS_SRC_FILES); }
inline bool nss_pwd_db () const { return !!(pwd_src & NSS_SRC_DB); }
inline int nss_pwd_src () const { return pwd_src; } /* CW_GETNSS_PWD_SRC */
inline bool nss_grp_files () const { return !!(grp_src & NSS_SRC_FILES); }
inline bool nss_grp_db () const { return !!(grp_src & NSS_SRC_DB); }
inline int nss_grp_src () const { return grp_src; } /* CW_GETNSS_GRP_SRC */
inline bool nss_prefix_auto () const { return prefix == NSS_AUTO; }
inline bool nss_prefix_primary () const { return prefix == NSS_PRIMARY; }
inline bool nss_prefix_always () const { return prefix == NSS_ALWAYS; }

View File

@ -601,6 +601,14 @@ cygwin_internal (cygwin_getinfo_types t, ...)
res = (uintptr_t) cygheap->pg.nss_separator ();
break;
case CW_GETNSS_PWD_SRC:
res = (uintptr_t) cygheap->pg.nss_pwd_src ();
break;
case CW_GETNSS_GRP_SRC:
res = (uintptr_t) cygheap->pg.nss_grp_src ();
break;
case CW_GETPWSID:
{
int db_only = va_arg (arg, int);

View File

@ -456,12 +456,13 @@ details. */
278: Add quotactl.
279: Export stime.
280: Static atexit in libcygwin.a, CW_FIXED_ATEXIT.
281: Add CW_GETNSS_PWD_SRC, CW_GETNSS_GRP_SRC.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 280
#define CYGWIN_VERSION_API_MINOR 281
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -151,7 +151,9 @@ typedef enum
CW_GETPWSID,
CW_GETGRSID,
CW_CYGNAME_FROM_WINNAME,
CW_FIXED_ATEXIT
CW_FIXED_ATEXIT,
CW_GETNSS_PWD_SRC,
CW_GETNSS_GRP_SRC
} cygwin_getinfo_types;
#define CW_LOCK_PINFO CW_LOCK_PINFO
@ -210,6 +212,8 @@ typedef enum
#define CW_GETGRSID CW_GETGRSID
#define CW_CYGNAME_FROM_WINNAME CW_CYGNAME_FROM_WINNAME
#define CW_FIXED_ATEXIT CW_FIXED_ATEXIT
#define CW_GETNSS_PWD_SRC CW_GETNSS_PWD_SRC
#define CW_GETNSS_GRP_SRC CW_GETNSS_GRP_SRC
/* Token type for CW_SET_EXTERNAL_TOKEN */
enum
@ -218,6 +222,13 @@ enum
CW_TOKEN_RESTRICTED = 1
};
/* Source type for CW_GETNSS_PWD_SRC and CW_GETNSS_GRP_SRC. */
enum
{
NSS_SRC_FILES = 1,
NSS_SRC_DB = 2
};
/* Enumeration source constants for CW_SETENT called from mkpasswd/mkgroup. */
enum nss_enum_t
{

View File

@ -586,8 +586,8 @@ cygheap_pwdgrp::init ()
db_separator: + DISABLED
db_enum: cache builtin
*/
pwd_src = (NSS_FILES | NSS_DB);
grp_src = (NSS_FILES | NSS_DB);
pwd_src = (NSS_SRC_FILES | NSS_SRC_DB);
grp_src = (NSS_SRC_FILES | NSS_SRC_DB);
prefix = NSS_AUTO;
separator[0] = L'+';
enums = (ENUM_CACHE | ENUM_BUILTIN);
@ -628,12 +628,12 @@ cygheap_pwdgrp::nss_init_line (const char *line)
break;
if (!strncmp (c, "files", 5) && strchr (" \t", c[5]))
{
*src |= NSS_FILES;
*src |= NSS_SRC_FILES;
c += 5;
}
else if (!strncmp (c, "db", 2) && strchr (" \t", c[2]))
{
*src |= NSS_DB;
*src |= NSS_SRC_DB;
c += 2;
}
else
@ -643,7 +643,7 @@ cygheap_pwdgrp::nss_init_line (const char *line)
}
}
if (*src == 0)
*src = (NSS_FILES | NSS_DB);
*src = (NSS_SRC_FILES | NSS_SRC_DB);
}
}
break;