From a1a78204162561872634d517b82e8a865c7058cc Mon Sep 17 00:00:00 2001 From: Steve Ellcey Date: Tue, 12 Sep 2017 10:21:48 -0700 Subject: Remove compat from DEFAULT_CONFIG lookup strings * grp/initgroups.c: Include config.h. (DEFAULT_CONFIG): New macro. (internal_getgrouplist): Use DEFAULT_CONFIG. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nss/nsswitch.c (__nss_disable_nscd): Likewise. (DEFAULT_DEFCONFIG): New macro. (__nss_database_lookup): Use DEFAULT_DEFCONFIG. * nss/grp-lookup.c: Include config.h (DEFAULT_CONFIG): Set definition based on LINK_OBSOLETE_NSL. * nss/pwd-lookup.c (DEFAULT_CONFIG): Likewise. * nss/spwd-lookup.c (DEFAULT_CONFIG): Likewise. * manual/nss.texi: Update default values section. --- nss/grp-lookup.c | 8 +++++++- nss/nsswitch.c | 16 ++++++++++++---- nss/pwd-lookup.c | 8 +++++++- nss/spwd-lookup.c | 8 +++++++- 4 files changed, 33 insertions(+), 7 deletions(-) (limited to 'nss') diff --git a/nss/grp-lookup.c b/nss/grp-lookup.c index 8cb00aa22f..7c019f85b2 100644 --- a/nss/grp-lookup.c +++ b/nss/grp-lookup.c @@ -16,7 +16,13 @@ License along with the GNU C Library; if not, see . */ +#include + #define DATABASE_NAME group -#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#ifdef LINK_OBSOLETE_NSL +# define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#else +# define DEFAULT_CONFIG "files" +#endif #include "XXX-lookup.c" diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 8a146b956f..89b684ef38 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -40,6 +40,15 @@ #include "nsswitch.h" #include "../nscd/nscd_proto.h" #include +#include + +#ifdef LINK_OBSOLETE_NSL +# define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +# define DEFAULT_DEFCONFIG "nis [NOTFOUND=return] files" +#else +# define DEFAULT_CONFIG "files" +# define DEFAULT_DEFCONFIG "files" +#endif /* Prototypes for the local functions. */ static name_database *nss_parse_file (const char *fname); @@ -152,8 +161,7 @@ __nss_database_lookup (const char *database, const char *alternate_name, or null to use the most common default. */ if (*ni == NULL) { - *ni = nss_parse_service_list (defconfig - ?: "nis [NOTFOUND=return] files"); + *ni = nss_parse_service_list (defconfig ?: DEFAULT_DEFCONFIG); if (*ni != NULL) { /* Record the memory we've just allocated in defconfig_entries list, @@ -847,8 +855,8 @@ __nss_disable_nscd (void (*cb) (size_t, struct traced_file *)) is_nscd = true; /* Find all the relevant modules so that the init functions are called. */ - nss_load_all_libraries ("passwd", "compat [NOTFOUND=return] files"); - nss_load_all_libraries ("group", "compat [NOTFOUND=return] files"); + nss_load_all_libraries ("passwd", DEFAULT_CONFIG); + nss_load_all_libraries ("group", DEFAULT_CONFIG); nss_load_all_libraries ("hosts", "dns [!UNAVAIL=return] files"); nss_load_all_libraries ("services", NULL); diff --git a/nss/pwd-lookup.c b/nss/pwd-lookup.c index 00040d4e30..180ac7c910 100644 --- a/nss/pwd-lookup.c +++ b/nss/pwd-lookup.c @@ -16,7 +16,13 @@ License along with the GNU C Library; if not, see . */ +#include + #define DATABASE_NAME passwd -#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#ifdef LINK_OBSOLETE_NSL +# define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#else +# define DEFAULT_CONFIG "files" +#endif #include "XXX-lookup.c" diff --git a/nss/spwd-lookup.c b/nss/spwd-lookup.c index 319a7bb062..f12156d7cd 100644 --- a/nss/spwd-lookup.c +++ b/nss/spwd-lookup.c @@ -16,8 +16,14 @@ License along with the GNU C Library; if not, see . */ +#include + #define DATABASE_NAME shadow #define ALTERNATE_NAME passwd -#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#ifdef LINK_OBSOLETE_NSL +# define DEFAULT_CONFIG "compat [NOTFOUND=return] files" +#else +# define DEFAULT_CONFIG "files" +#endif #include "XXX-lookup.c" -- cgit 1.4.1