|
| 1 | +commit 78a90c2f74a2012dd3eff302189e47ff6779a757 |
| 2 | +Author: Andreas Schwab < [email protected]> |
| 3 | +Date: Fri Mar 2 23:07:14 2018 +0100 |
| 4 | + |
| 5 | + Fix multiple definitions of __nss_*_database (bug 22918) |
| 6 | + |
| 7 | + (cherry picked from commit eaf6753f8aac33a36deb98c1031d1bad7b593d2d) |
| 8 | + |
| 9 | +diff --git a/nscd/gai.c b/nscd/gai.c |
| 10 | +index d081747797..576fd0045b 100644 |
| 11 | +--- a/nscd/gai.c |
| 12 | ++++ b/nscd/gai.c |
| 13 | +@@ -45,3 +45,6 @@ |
| 14 | + #ifdef HAVE_LIBIDN |
| 15 | + # include <libidn/idn-stub.c> |
| 16 | + #endif |
| 17 | ++ |
| 18 | ++/* Some variables normally defined in libc. */ |
| 19 | ++service_user *__nss_hosts_database attribute_hidden; |
| 20 | +diff --git a/nss/nsswitch.c b/nss/nsswitch.c |
| 21 | +index d5e655974f..b0f0c11a3e 100644 |
| 22 | +--- a/nss/nsswitch.c |
| 23 | ++++ b/nss/nsswitch.c |
| 24 | +@@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database, |
| 25 | + |
| 26 | + /* Declare external database variables. */ |
| 27 | + #define DEFINE_DATABASE(name) \ |
| 28 | +- extern service_user *__nss_##name##_database attribute_hidden; \ |
| 29 | ++ service_user *__nss_##name##_database attribute_hidden; \ |
| 30 | + weak_extern (__nss_##name##_database) |
| 31 | + #include "databases.def" |
| 32 | + #undef DEFINE_DATABASE |
| 33 | +diff --git a/nss/nsswitch.h b/nss/nsswitch.h |
| 34 | +index eccb535ef5..63573b9ebc 100644 |
| 35 | +--- a/nss/nsswitch.h |
| 36 | ++++ b/nss/nsswitch.h |
| 37 | +@@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots) |
| 38 | + #define MAX_NR_ADDRS 48 |
| 39 | + |
| 40 | + /* Prototypes for __nss_*_lookup2 functions. */ |
| 41 | +-#define DEFINE_DATABASE(arg) \ |
| 42 | +- service_user *__nss_##arg##_database attribute_hidden; \ |
| 43 | +- int __nss_##arg##_lookup2 (service_user **, const char *, \ |
| 44 | +- const char *, void **); \ |
| 45 | ++#define DEFINE_DATABASE(arg) \ |
| 46 | ++ extern service_user *__nss_##arg##_database attribute_hidden; \ |
| 47 | ++ int __nss_##arg##_lookup2 (service_user **, const char *, \ |
| 48 | ++ const char *, void **); \ |
| 49 | + libc_hidden_proto (__nss_##arg##_lookup2) |
| 50 | + #include "databases.def" |
| 51 | + #undef DEFINE_DATABASE |
| 52 | +diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c |
| 53 | +index f509534ca9..8c64ac59ff 100644 |
| 54 | +--- a/posix/tst-rfc3484-2.c |
| 55 | ++++ b/posix/tst-rfc3484-2.c |
| 56 | +@@ -58,6 +58,7 @@ _res_hconf_init (void) |
| 57 | + #undef USE_NSCD |
| 58 | + #include "../sysdeps/posix/getaddrinfo.c" |
| 59 | + |
| 60 | ++service_user *__nss_hosts_database attribute_hidden; |
| 61 | + |
| 62 | + /* This is the beginning of the real test code. The above defines |
| 63 | + (among other things) the function rfc3484_sort. */ |
| 64 | +diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c |
| 65 | +index ae44087a10..1c61aaf844 100644 |
| 66 | +--- a/posix/tst-rfc3484-3.c |
| 67 | ++++ b/posix/tst-rfc3484-3.c |
| 68 | +@@ -58,6 +58,7 @@ _res_hconf_init (void) |
| 69 | + #undef USE_NSCD |
| 70 | + #include "../sysdeps/posix/getaddrinfo.c" |
| 71 | + |
| 72 | ++service_user *__nss_hosts_database attribute_hidden; |
| 73 | + |
| 74 | + /* This is the beginning of the real test code. The above defines |
| 75 | + (among other things) the function rfc3484_sort. */ |
| 76 | +diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c |
| 77 | +index 7f191abbbc..8f45848e44 100644 |
| 78 | +--- a/posix/tst-rfc3484.c |
| 79 | ++++ b/posix/tst-rfc3484.c |
| 80 | +@@ -58,6 +58,7 @@ _res_hconf_init (void) |
| 81 | + #undef USE_NSCD |
| 82 | + #include "../sysdeps/posix/getaddrinfo.c" |
| 83 | + |
| 84 | ++service_user *__nss_hosts_database attribute_hidden; |
| 85 | + |
| 86 | + /* This is the beginning of the real test code. The above defines |
| 87 | + (among other things) the function rfc3484_sort. */ |
0 commit comments