00db10
commit c533244b8e00ae701583ec50aeb43377d292452d
00db10
Author: Florian Weimer <fweimer@redhat.com>
00db10
Date:   Mon Feb 4 20:07:18 2019 +0100
00db10
00db10
    nscd: Do not use __inet_aton_exact@GLIBC_PRIVATE [BZ #20018]
00db10
    
00db10
    This commit avoids referencing the __inet_aton_exact@GLIBC_PRIVATE
00db10
    symbol from nscd.  In master, the separately-compiled getaddrinfo
00db10
    implementation in nscd needs it, however such an internal ABI change
00db10
    is not desirable on a release branch if it can be avoided.
00db10
00db10
(Note: This commit was backported from the release/2.28/master branch.)
00db10
00db10
diff --git a/nscd/Makefile b/nscd/Makefile
00db10
index 2dc98d3a3347f998..62f38fa824527e0a 100644
00db10
--- a/nscd/Makefile
00db10
+++ b/nscd/Makefile
00db10
@@ -36,7 +36,7 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
00db10
 		getsrvbynm_r getsrvbypt_r servicescache \
00db10
 		dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
00db10
 		xmalloc xstrdup aicache initgrcache gai res_hconf \
00db10
-		netgroupcache
00db10
+		netgroupcache nscd-inet_addr
00db10
 
00db10
 ifeq ($(build-nscd)$(have-thread-library),yesyes)
00db10
 
00db10
diff --git a/nscd/gai.c b/nscd/gai.c
00db10
index dbe878fcf699dbc1..e7443904b4514836 100644
00db10
--- a/nscd/gai.c
00db10
+++ b/nscd/gai.c
00db10
@@ -32,6 +32,12 @@
00db10
 /* nscd uses 1MB or 2MB thread stacks.  */
00db10
 #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)
00db10
 
00db10
+/* We do not want to export __inet_aton_exact.  Get the prototype and
00db10
+   change its visibility to hidden.  */
00db10
+#include <arpa/inet.h>
00db10
+__typeof__ (__inet_aton_exact) __inet_aton_exact
00db10
+  __attribute__ ((visibility ("hidden")));
00db10
+
00db10
 /* We are nscd, so we don't want to be talking to ourselves.  */
00db10
 #undef  USE_NSCD
00db10
 
00db10
diff --git a/nscd/nscd-inet_addr.c b/nscd/nscd-inet_addr.c
00db10
new file mode 100644
00db10
index 0000000000000000..f366b9567d914f99
00db10
--- /dev/null
00db10
+++ b/nscd/nscd-inet_addr.c
00db10
@@ -0,0 +1,32 @@
00db10
+/* Legacy IPv4 text-to-address functions.  Version for nscd.
00db10
+   Copyright (C) 2019 Free Software Foundation, Inc.
00db10
+   This file is part of the GNU C Library.
00db10
+
00db10
+   The GNU C Library is free software; you can redistribute it and/or
00db10
+   modify it under the terms of the GNU Lesser General Public
00db10
+   License as published by the Free Software Foundation; either
00db10
+   version 2.1 of the License, or (at your option) any later version.
00db10
+
00db10
+   The GNU C Library is distributed in the hope that it will be useful,
00db10
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
+   Lesser General Public License for more details.
00db10
+
00db10
+   You should have received a copy of the GNU Lesser General Public
00db10
+   License along with the GNU C Library; if not, see
00db10
+   <http://www.gnu.org/licenses/>.  */
00db10
+
00db10
+#include <arpa/inet.h>
00db10
+
00db10
+/* We do not want to export __inet_aton_exact.  Get the prototype and
00db10
+   change the visibility to hidden.  */
00db10
+#include <arpa/inet.h>
00db10
+__typeof__ (__inet_aton_exact) __inet_aton_exact
00db10
+  __attribute__ ((visibility ("hidden")));
00db10
+
00db10
+/* Do not provide definitions of the public symbols exported from
00db10
+   libc.  */
00db10
+#undef weak_alias
00db10
+#define weak_alias(from, to)
00db10
+
00db10
+#include <resolv/inet_addr.c>