|
|
147e83 |
Provide GLIBC_PRIVATE symbols no longer used by the current library
|
|
|
147e83 |
version to increase backwards compatibility during glibc updates.
|
|
|
147e83 |
This will help to avoid some of the issues that surface while a
|
|
|
147e83 |
glibc update is performed with concurrent application updates,
|
|
|
147e83 |
and it also allows old nscd to trigger cache invalidation in a
|
|
|
147e83 |
running nscd daemon.
|
|
|
147e83 |
|
|
|
147e83 |
While at this, also add interfaces for supporting old nss_dns modules.
|
|
|
147e83 |
|
|
|
147e83 |
This patch is not needed upstream because upstream does not provide
|
|
|
147e83 |
backwards compatibility for GLIBC_PRIVATE symbols.
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/inet/herrno.c b/inet/herrno.c
|
|
|
147e83 |
index 0cd84445190728b3..4d26e9b254181422 100644
|
|
|
147e83 |
--- a/inet/herrno.c
|
|
|
147e83 |
+++ b/inet/herrno.c
|
|
|
147e83 |
@@ -28,3 +28,9 @@ __thread int __h_errno;
|
|
|
147e83 |
extern __thread int __libc_h_errno __attribute__ ((alias ("__h_errno")))
|
|
|
147e83 |
attribute_hidden;
|
|
|
147e83 |
#define h_errno __libc_h_errno
|
|
|
147e83 |
+
|
|
|
147e83 |
+#ifdef SHARED
|
|
|
147e83 |
+/* Provide an alias for use by the old libpthread.so.0 during
|
|
|
147e83 |
+ updates. */
|
|
|
147e83 |
+asm (".symver __h_errno, h_errno@GLIBC_PRIVATE");
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
|
|
|
147e83 |
index 9f2d3c3bd442bb38..5ab02c79c72eb1ac 100644
|
|
|
147e83 |
--- a/resolv/res_libc.c
|
|
|
147e83 |
+++ b/resolv/res_libc.c
|
|
|
147e83 |
@@ -41,6 +41,7 @@
|
|
|
147e83 |
#include <resolv.h>
|
|
|
147e83 |
#include <libc-lock.h>
|
|
|
147e83 |
#include <resolv-internal.h>
|
|
|
147e83 |
+#include <resolv_context.h>
|
|
|
147e83 |
|
|
|
147e83 |
int
|
|
|
147e83 |
res_init (void)
|
|
|
147e83 |
@@ -80,7 +81,34 @@ res_init (void)
|
|
|
147e83 |
|
|
|
147e83 |
return __res_vinit (&_res, 1);
|
|
|
147e83 |
}
|
|
|
147e83 |
-
|
|
|
147e83 |
+
|
|
|
147e83 |
+#ifdef SHARED
|
|
|
147e83 |
+
|
|
|
147e83 |
+/* An old nscd binary may bind to __res_maybe_init during a glibc
|
|
|
147e83 |
+ update. Emulate it using the new functions. Ignore PREINIT
|
|
|
147e83 |
+ because almost all existing __res_maybe_init callers used zero
|
|
|
147e83 |
+ PREINIT, and the difference for RESP == &_res is very minor (a
|
|
|
147e83 |
+ potential override of application configuration). */
|
|
|
147e83 |
+attribute_compat_text_section
|
|
|
147e83 |
+int
|
|
|
147e83 |
+__res_maybe_init (res_state resp, int preinit)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ if (resp == &_res)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ /* This performs an implicit initialization of _res. */
|
|
|
147e83 |
+ struct resolv_context *ctx = __resolv_context_get ();
|
|
|
147e83 |
+ if (ctx == NULL)
|
|
|
147e83 |
+ return -1;
|
|
|
147e83 |
+ __resolv_context_put (ctx);
|
|
|
147e83 |
+ return 0;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ else
|
|
|
147e83 |
+ return __res_vinit (resp, 0);
|
|
|
147e83 |
+}
|
|
|
147e83 |
+asm (".symver __res_maybe_init, __res_maybe_init@GLIBC_PRIVATE");
|
|
|
147e83 |
+
|
|
|
147e83 |
+#endif /* SHARED */
|
|
|
147e83 |
+
|
|
|
147e83 |
/* This needs to be after the use of _res in res_init, above. */
|
|
|
147e83 |
#undef _res
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/resolv/res_query.c b/resolv/res_query.c
|
|
|
147e83 |
index ebbe5a6a4ed86abe..24fefb561e7f1f5e 100644
|
|
|
147e83 |
--- a/resolv/res_query.c
|
|
|
147e83 |
+++ b/resolv/res_query.c
|
|
|
147e83 |
@@ -705,6 +705,96 @@ hostalias (const char *name)
|
|
|
147e83 |
(__resolv_context_get (), name, abuf, sizeof (abuf));
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
+#ifdef SHARED
|
|
|
147e83 |
+/* Compatibiliaty functions to support old nss_dns modules. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+typedef int (*compat_query_function) (struct resolv_context *,
|
|
|
147e83 |
+ const char *name,
|
|
|
147e83 |
+ int class, int type,
|
|
|
147e83 |
+ u_char *answer,
|
|
|
147e83 |
+ int anslen,
|
|
|
147e83 |
+ u_char **answerp,
|
|
|
147e83 |
+ u_char **answerp2,
|
|
|
147e83 |
+ int *nanswerp2,
|
|
|
147e83 |
+ int *resplen2,
|
|
|
147e83 |
+ int *answerp2_malloced);
|
|
|
147e83 |
+
|
|
|
147e83 |
+attribute_compat_text_section
|
|
|
147e83 |
+static int
|
|
|
147e83 |
+wrap_compat_call (compat_query_function qf,
|
|
|
147e83 |
+ res_state statp,
|
|
|
147e83 |
+ const char *name, /* domain name */
|
|
|
147e83 |
+ int class, int type, /* class and type of query */
|
|
|
147e83 |
+ u_char *answer, /* buffer to put answer */
|
|
|
147e83 |
+ int anslen, /* size of answer buffer */
|
|
|
147e83 |
+ u_char **answerp, /* if buffer needs to be enlarged */
|
|
|
147e83 |
+ u_char **answerp2,
|
|
|
147e83 |
+ int *nanswerp2,
|
|
|
147e83 |
+ int *resplen2,
|
|
|
147e83 |
+ int *answerp2_malloced)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ if (statp == &_res)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ struct resolv_context *ctx = __resolv_context_get ();
|
|
|
147e83 |
+ if (ctx == NULL)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ __set_h_errno (NO_RECOVERY);
|
|
|
147e83 |
+ return -1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ int ret = qf (ctx, name, class, type,
|
|
|
147e83 |
+ answer, anslen, answerp, answerp2,
|
|
|
147e83 |
+ nanswerp2, resplen2, answerp2_malloced);
|
|
|
147e83 |
+ __resolv_context_put (ctx);
|
|
|
147e83 |
+ return ret;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ else
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ __set_h_errno (NO_RECOVERY);
|
|
|
147e83 |
+ __set_errno (ENOTSUP);
|
|
|
147e83 |
+ return -1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+}
|
|
|
147e83 |
+
|
|
|
147e83 |
+attribute_compat_text_section
|
|
|
147e83 |
+int
|
|
|
147e83 |
+__libc_res_nquery(res_state statp,
|
|
|
147e83 |
+ const char *name, /* domain name */
|
|
|
147e83 |
+ int class, int type, /* class and type of query */
|
|
|
147e83 |
+ u_char *answer, /* buffer to put answer */
|
|
|
147e83 |
+ int anslen, /* size of answer buffer */
|
|
|
147e83 |
+ u_char **answerp, /* if buffer needs to be enlarged */
|
|
|
147e83 |
+ u_char **answerp2,
|
|
|
147e83 |
+ int *nanswerp2,
|
|
|
147e83 |
+ int *resplen2,
|
|
|
147e83 |
+ int *answerp2_malloced)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return wrap_compat_call (__res_context_query, statp, name, class, type,
|
|
|
147e83 |
+ answer, anslen, answerp, answerp2,
|
|
|
147e83 |
+ nanswerp2, resplen2, answerp2_malloced);
|
|
|
147e83 |
+}
|
|
|
147e83 |
+asm (".symver __libc_res_nquery, __libc_res_nquery@GLIBC_PRIVATE");
|
|
|
147e83 |
+
|
|
|
147e83 |
+attribute_compat_text_section
|
|
|
147e83 |
+int
|
|
|
147e83 |
+__libc_res_nsearch(res_state statp,
|
|
|
147e83 |
+ const char *name, /* domain name */
|
|
|
147e83 |
+ int class, int type, /* class and type of query */
|
|
|
147e83 |
+ u_char *answer, /* buffer to put answer */
|
|
|
147e83 |
+ int anslen, /* size of answer */
|
|
|
147e83 |
+ u_char **answerp,
|
|
|
147e83 |
+ u_char **answerp2,
|
|
|
147e83 |
+ int *nanswerp2,
|
|
|
147e83 |
+ int *resplen2,
|
|
|
147e83 |
+ int *answerp2_malloced)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return wrap_compat_call (__res_context_search, statp, name, class, type,
|
|
|
147e83 |
+ answer, anslen, answerp, answerp2,
|
|
|
147e83 |
+ nanswerp2, resplen2, answerp2_malloced);
|
|
|
147e83 |
+}
|
|
|
147e83 |
+asm (".symver __libc_res_nsearch, __libc_res_nsearch@GLIBC_PRIVATE");
|
|
|
147e83 |
+
|
|
|
147e83 |
+#endif /* SHARED */
|
|
|
147e83 |
+
|
|
|
147e83 |
#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
|
|
|
147e83 |
# undef res_query
|
|
|
147e83 |
# undef res_querydomain
|