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