about summary refs log tree commit diff
path: root/nss/nsswitch.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-08-21 05:31:02 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-21 05:31:19 -0700
commit1dbbb1ec7af9026bbdc6dd265525de0c3958406c (patch)
tree21aa5ee4232f9e0c8a0f45f7b8476711fce828e7 /nss/nsswitch.h
parent2585d7b839559e665d5723734862fbe62264b25d (diff)
downloadglibc-1dbbb1ec7af9026bbdc6dd265525de0c3958406c.tar.gz
glibc-1dbbb1ec7af9026bbdc6dd265525de0c3958406c.tar.xz
glibc-1dbbb1ec7af9026bbdc6dd265525de0c3958406c.zip
Mark internal nss symbols with attribute_hidden [BZ #18822]
Mark internal nss symbols with attribute_hidden to allow direct access
within libc.so and libc.a without using GOT nor PLT.

Tested on x86-64 with and without --disable-nscd.

	[BZ #18822]
	* grp/initgroups.c (__nss_group_database): Removed.
	(__nss_initgroups_database): Likewise.
	* nscd/gai.c (__nss_hosts_database): Likewise.
	* nss/XXX-lookup.c (DATABASE_NAME_SYMBOL): Likewise.
	* posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise.
	* posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise.
	* posix/tst-rfc3484.c (__nss_hosts_database): Likewise.
	* sysdeps/posix/getaddrinfo.c (__nss_hosts_database): Likewise.
	* nss/getXXent.c (INTERNAL (REENTRANT_GETNAME)): Add
	attribute_hidden.
	* nss/nsswitch.c (__nss_database_custom): Define only if
	USE_NSCD is defined.
	(__nss_configure_lookup): Use __nss_database_custom only if
	USE_NSCD is defined.
	* nss/nsswitch.h (__nss_database_custom): Declare only if
	USE_NSCD is defined.  Add attribute_hidden.
	(__nss_setent): Add attribute_hidden.
	(__nss_endent): Likewise.
	(__nss_getent_r): Likewise.
	(__nss_getent): Likewise.
	(DEFINE_DATABASE): Declare __nss_##arg##_database.
Diffstat (limited to 'nss/nsswitch.h')
-rw-r--r--nss/nsswitch.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/nss/nsswitch.h b/nss/nsswitch.h
index 2b86d63ddb..ab0a512d40 100644
--- a/nss/nsswitch.h
+++ b/nss/nsswitch.h
@@ -96,17 +96,19 @@ typedef struct name_database
 } name_database;
 
 
+#ifdef USE_NSCD
 /* Indices into DATABASES in nsswitch.c and __NSS_DATABASE_CUSTOM.  */
 enum
   {
-#define DEFINE_DATABASE(arg) NSS_DBSIDX_##arg,
-#include "databases.def"
-#undef DEFINE_DATABASE
+# define DEFINE_DATABASE(arg) NSS_DBSIDX_##arg,
+# include "databases.def"
+# undef DEFINE_DATABASE
     NSS_DBSIDX_max
   };
 
 /* Flags whether custom rules for database is set.  */
-extern bool __nss_database_custom[NSS_DBSIDX_max];
+extern bool __nss_database_custom[NSS_DBSIDX_max] attribute_hidden;
+#endif
 
 /* Warning for NSS functions, which don't require dlopen if glibc
    was built with --enable-static-nss.  */
@@ -180,11 +182,13 @@ extern void __nss_setent (const char *func_name,
 			  db_lookup_function lookup_fct,
 			  service_user **nip, service_user **startp,
 			  service_user **last_nip, int stayon,
-			  int *stayon_tmp, int res);
+			  int *stayon_tmp, int res)
+     attribute_hidden;
 extern void __nss_endent (const char *func_name,
 			  db_lookup_function lookup_fct,
 			  service_user **nip, service_user **startp,
-			  service_user **last_nip, int res);
+			  service_user **last_nip, int res)
+     attribute_hidden;
 extern int __nss_getent_r (const char *getent_func_name,
 			   const char *setent_func_name,
 			   db_lookup_function lookup_fct,
@@ -192,10 +196,12 @@ extern int __nss_getent_r (const char *getent_func_name,
 			   service_user **last_nip, int *stayon_tmp,
 			   int res,
 			   void *resbuf, char *buffer, size_t buflen,
-			   void **result, int *h_errnop);
+			   void **result, int *h_errnop)
+     attribute_hidden;
 extern void *__nss_getent (getent_r_function func,
 			   void **resbuf, char **buffer, size_t buflen,
-			   size_t *buffer_size, int *h_errnop);
+			   size_t *buffer_size, int *h_errnop)
+     attribute_hidden;
 struct resolv_context;
 struct hostent;
 extern int __nss_hostname_digits_dots_context (struct resolv_context *,
@@ -221,6 +227,7 @@ libc_hidden_proto (__nss_hostname_digits_dots)
 
 /* Prototypes for __nss_*_lookup2 functions.  */
 #define DEFINE_DATABASE(arg)				    \
+  service_user *__nss_##arg##_database attribute_hidden;    \
   int __nss_##arg##_lookup2 (service_user **, const char *, \
 			     const char *, void **);	    \
   libc_hidden_proto (__nss_##arg##_lookup2)