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