This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.26-258-g65329bd
- From: fw at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 1 Sep 2017 07:14:07 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.26-258-g65329bd
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 65329bd233db9d1b8b94e90734a564705b619260 (commit)
via a2881ef01450295782b065f2f850f340d5c12c14 (commit)
via ad816a5e00ce891a2cea8187638fa0e00f83aaf6 (commit)
via 53250a21b81474ef4e78090a4a9a63d8471e1091 (commit)
via 924b121c5978689001ae28cf1c8497371dad4f71 (commit)
from d9ff799a5b2884d2abc0a1689fb6b2c71084424c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=65329bd233db9d1b8b94e90734a564705b619260
commit 65329bd233db9d1b8b94e90734a564705b619260
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:58:07 2017 +0200
support_chroot_create: Add support for /etc/hosts, /etc/host.conf
diff --git a/ChangeLog b/ChangeLog
index f86a435..a04985f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
+ * support/namespace.h (struct support_chroot_configuration): Add
+ hosts, host_conf.
+ (struct support_chroot): Add path_hosts, path_host_conf.
+ * support/support_chroot.c (write_file): New function.
+ (support_chroot_create): Call it to process /etc/resolv.conf,
+ /etc/hosts, /etc/host.conf.
+ (support_chroot_free): Update.
+
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if
status indicates it is set.
diff --git a/support/namespace.h b/support/namespace.h
index 859c2fd..9eddb1a 100644
--- a/support/namespace.h
+++ b/support/namespace.h
@@ -66,7 +66,9 @@ struct support_chroot_configuration
{
/* File contents. The files are not created if the field is
NULL. */
- const char *resolv_conf;
+ const char *resolv_conf; /* /etc/resolv.conf. */
+ const char *hosts; /* /etc/hosts. */
+ const char *host_conf; /* /etc/host.conf. */
};
/* The result of the creation of a chroot. */
@@ -78,8 +80,11 @@ struct support_chroot
/* Path to the chroot directory. */
char *path_chroot;
- /* Path to the /etc/resolv.conf file. */
- char *path_resolv_conf;
+ /* Paths to files in the chroot. These are absolute and outside of
+ the chroot. */
+ char *path_resolv_conf; /* /etc/resolv.conf. */
+ char *path_hosts; /* /etc/hosts. */
+ char *path_host_conf; /* /etc/host.conf. */
};
/* Create a chroot environment. The returned data should be freed
diff --git a/support/support_chroot.c b/support/support_chroot.c
index c0807b3..f3ef551 100644
--- a/support/support_chroot.c
+++ b/support/support_chroot.c
@@ -24,6 +24,23 @@
#include <support/test-driver.h>
#include <support/xunistd.h>
+/* If CONTENTS is not NULL, write it to the file at DIRECTORY/RELPATH,
+ and store the name in *ABSPATH. If CONTENTS is NULL, store NULL in
+ *ABSPATH. */
+static void
+write_file (const char *directory, const char *relpath, const char *contents,
+ char **abspath)
+{
+ if (contents != NULL)
+ {
+ *abspath = xasprintf ("%s/%s", directory, relpath);
+ add_temp_file (*abspath);
+ support_write_file_string (*abspath, contents);
+ }
+ else
+ *abspath = NULL;
+}
+
struct support_chroot *
support_chroot_create (struct support_chroot_configuration conf)
{
@@ -39,15 +56,10 @@ support_chroot_create (struct support_chroot_configuration conf)
xmkdir (path_etc, 0777);
add_temp_file (path_etc);
- if (conf.resolv_conf != NULL)
- {
- /* Create an empty resolv.conf file. */
- chroot->path_resolv_conf = xasprintf ("%s/resolv.conf", path_etc);
- add_temp_file (chroot->path_resolv_conf);
- support_write_file_string (chroot->path_resolv_conf, conf.resolv_conf);
- }
- else
- chroot->path_resolv_conf = NULL;
+ write_file (path_etc, "resolv.conf", conf.resolv_conf,
+ &chroot->path_resolv_conf);
+ write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
+ write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
free (path_etc);
@@ -67,5 +79,7 @@ support_chroot_free (struct support_chroot *chroot)
{
free (chroot->path_chroot);
free (chroot->path_resolv_conf);
+ free (chroot->path_hosts);
+ free (chroot->path_host_conf);
free (chroot);
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a2881ef01450295782b065f2f850f340d5c12c14
commit a2881ef01450295782b065f2f850f340d5c12c14
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:57:52 2017 +0200
getaddrinfo: In gaih_inet, use h_errno for certain status values only
h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.
diff --git a/ChangeLog b/ChangeLog
index 4229a83..f86a435 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if
+ status indicates it is set.
+
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS
function lookup failures more reliable.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 95b5148..acb5d9e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -948,7 +948,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
__resolv_context_enable_inet6 (res_ctx, res_enable_inet6);
__resolv_context_put (res_ctx);
- if (h_errno == NETDB_INTERNAL)
+ /* If we have a failure which sets errno, report it using
+ EAI_SYSTEM. */
+ if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL)
+ && h_errno == NETDB_INTERNAL)
{
result = -EAI_SYSTEM;
goto free_and_return;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ad816a5e00ce891a2cea8187638fa0e00f83aaf6
commit ad816a5e00ce891a2cea8187638fa0e00f83aaf6
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:57:28 2017 +0200
getaddrinfo: Properly set errno for NSS function lookup failure
diff --git a/ChangeLog b/ChangeLog
index 4d8c6f6..4229a83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS
+ function lookup failures more reliable.
+
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly.
(getcanonname): Likewise.
(gaih_inet): Likewise.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 4edd5e2..95b5148 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -922,13 +922,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
else
{
+ /* Could not locate any of the lookup functions.
+ The NSS lookup code does not consistently set
+ errno, so we need to supply our own error
+ code here. The root cause could either be a
+ resource allocation failure, or a missing
+ service function in the DSO (so it should not
+ be listed in /etc/nsswitch.conf). Assume the
+ former, and return EBUSY. */
status = NSS_STATUS_UNAVAIL;
- /* Could not load any of the lookup functions. Indicate
- an internal error if the failure was due to a system
- error other than the file not being found. We use the
- errno from the last failed callback. */
- if (errno != 0 && errno != ENOENT)
- __set_h_errno (NETDB_INTERNAL);
+ __set_h_errno (NETDB_INTERNAL);
+ __set_errno (EBUSY);
}
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=53250a21b81474ef4e78090a4a9a63d8471e1091
commit 53250a21b81474ef4e78090a4a9a63d8471e1091
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:57:07 2017 +0200
getaddrinfo: Use &h_errno has the h_errno pointer
This simplifies the code because it is not necessary to propagate the
temporary h_errno value to the thread-local variable. It also increases
compatibility with NSS modules which update only one of the two places.
diff --git a/ChangeLog b/ChangeLog
index 28076c6..4d8c6f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
+ * sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly.
+ (getcanonname): Likewise.
+ (gaih_inet): Likewise.
+
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/posix/getaddrinfo.c (gethosts): Use errno directly.
(getcanonname): Likewise.
(gaih_inet): Likewise.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 0e79ac2..4edd5e2 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -241,7 +241,6 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
#define gethosts(_family, _type) \
{ \
- int herrno; \
struct hostent th; \
struct hostent *h; \
char *localcanon = NULL; \
@@ -249,8 +248,8 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
while (1) { \
status = DL_CALL_FCT (fct, (name, _family, &th, \
tmpbuf->data, tmpbuf->length, \
- &errno, &herrno, NULL, &localcanon)); \
- if (errno != ERANGE || herrno != NETDB_INTERNAL) \
+ &errno, &h_errno, NULL, &localcanon)); \
+ if (errno != ERANGE || h_errno != NETDB_INTERNAL) \
break; \
if (!scratch_buffer_grow (tmpbuf)) \
{ \
@@ -266,18 +265,17 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
h = NULL; \
if (errno != 0) \
{ \
- if (herrno == NETDB_INTERNAL) \
+ if (h_errno == NETDB_INTERNAL) \
{ \
- __set_h_errno (herrno); \
__resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \
__resolv_context_put (res_ctx); \
result = -EAI_SYSTEM; \
goto free_and_return; \
} \
- if (herrno == TRY_AGAIN) \
+ if (h_errno == TRY_AGAIN) \
no_data = EAI_AGAIN; \
else \
- no_data = herrno == NO_DATA; \
+ no_data = h_errno == NO_DATA; \
} \
else if (h != NULL) \
{ \
@@ -332,9 +330,8 @@ getcanonname (service_user *nip, struct gaih_addrtuple *at, const char *name)
if (cfct != NULL)
{
char buf[256];
- int herrno;
if (DL_CALL_FCT (cfct, (at->name ?: name, buf, sizeof (buf),
- &s, &errno, &herrno)) != NSS_STATUS_SUCCESS)
+ &s, &errno, &h_errno)) != NSS_STATUS_SUCCESS)
/* If the canonical name cannot be determined, use the passed
string. */
s = (char *) name;
@@ -593,14 +590,13 @@ gaih_inet (const char *name, const struct gaih_service *service,
int rc;
struct hostent th;
struct hostent *h;
- int herrno;
while (1)
{
rc = __gethostbyname2_r (name, AF_INET, &th,
tmpbuf->data, tmpbuf->length,
- &h, &herrno);
- if (rc != ERANGE || herrno != NETDB_INTERNAL)
+ &h, &h_errno);
+ if (rc != ERANGE || h_errno != NETDB_INTERNAL)
break;
if (!scratch_buffer_grow (tmpbuf))
{
@@ -625,12 +621,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
else
{
- if (herrno == NETDB_INTERNAL)
- {
- __set_h_errno (herrno);
- result = -EAI_SYSTEM;
- }
- else if (herrno == TRY_AGAIN)
+ if (h_errno == NETDB_INTERNAL)
+ result = -EAI_SYSTEM;
+ else if (h_errno == TRY_AGAIN)
result = -EAI_AGAIN;
else
/* We made requests but they turned out no data.
@@ -653,8 +646,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
{
/* Try to use nscd. */
struct nscd_ai_result *air = NULL;
- int herrno;
- int err = __nscd_getai (name, &air, &herrno);
+ int err = __nscd_getai (name, &air, &h_errno);
if (air != NULL)
{
/* Transform into gaih_addrtuple list. */
@@ -745,9 +737,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
goto free_and_return;
else if (__nss_not_use_nscd_hosts == 0)
{
- if (herrno == NETDB_INTERNAL && errno == ENOMEM)
+ if (h_errno == NETDB_INTERNAL && errno == ENOMEM)
result = -EAI_MEMORY;
- else if (herrno == TRY_AGAIN)
+ else if (h_errno == TRY_AGAIN)
result = -EAI_AGAIN;
else
result = -EAI_SYSTEM;
@@ -786,23 +778,21 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (fct4 != NULL)
{
- int herrno;
-
while (1)
{
status = DL_CALL_FCT (fct4, (name, pat,
tmpbuf->data, tmpbuf->length,
- &errno, &herrno,
+ &errno, &h_errno,
NULL));
if (status == NSS_STATUS_SUCCESS)
break;
if (status != NSS_STATUS_TRYAGAIN
- || errno != ERANGE || herrno != NETDB_INTERNAL)
+ || errno != ERANGE || h_errno != NETDB_INTERNAL)
{
- if (herrno == TRY_AGAIN)
+ if (h_errno == TRY_AGAIN)
no_data = EAI_AGAIN;
else
- no_data = herrno == NO_DATA;
+ no_data = h_errno == NO_DATA;
break;
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=924b121c5978689001ae28cf1c8497371dad4f71
commit 924b121c5978689001ae28cf1c8497371dad4f71
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:56:46 2017 +0200
getaddrinfo: Use &errno has the errno pointer
Similar code in nss/getXXbyYY_r.c is already using &errno as the
argument.
diff --git a/ChangeLog b/ChangeLog
index 4841dca..28076c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
+ * sysdeps/posix/getaddrinfo.c (gethosts): Use errno directly.
+ (getcanonname): Likewise.
+ (gaih_inet): Likewise.
+
2017-08-31 Steve Ellcey <sellcey@cavium.com>
Richard Henderson <rth@twiddle.net>
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index fcc5d79..0e79ac2 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -247,11 +247,10 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
char *localcanon = NULL; \
no_data = 0; \
while (1) { \
- rc = 0; \
status = DL_CALL_FCT (fct, (name, _family, &th, \
tmpbuf->data, tmpbuf->length, \
- &rc, &herrno, NULL, &localcanon)); \
- if (rc != ERANGE || herrno != NETDB_INTERNAL) \
+ &errno, &herrno, NULL, &localcanon)); \
+ if (errno != ERANGE || herrno != NETDB_INTERNAL) \
break; \
if (!scratch_buffer_grow (tmpbuf)) \
{ \
@@ -261,11 +260,11 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
goto free_and_return; \
} \
} \
- if (status == NSS_STATUS_SUCCESS && rc == 0) \
+ if (status == NSS_STATUS_SUCCESS && errno == 0) \
h = &th; \
else \
h = NULL; \
- if (rc != 0) \
+ if (errno != 0) \
{ \
if (herrno == NETDB_INTERNAL) \
{ \
@@ -334,9 +333,8 @@ getcanonname (service_user *nip, struct gaih_addrtuple *at, const char *name)
{
char buf[256];
int herrno;
- int rc;
if (DL_CALL_FCT (cfct, (at->name ?: name, buf, sizeof (buf),
- &s, &rc, &herrno)) != NSS_STATUS_SUCCESS)
+ &s, &errno, &herrno)) != NSS_STATUS_SUCCESS)
/* If the canonical name cannot be determined, use the passed
string. */
s = (char *) name;
@@ -352,7 +350,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
const struct gaih_typeproto *tp = gaih_inet_typeproto;
struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
struct gaih_addrtuple *at = NULL;
- int rc;
bool got_ipv6 = false;
const char *canon = NULL;
const char *orig_name = name;
@@ -394,7 +391,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
st = (struct gaih_servtuple *)
alloca_account (sizeof (struct gaih_servtuple), alloca_used);
- if ((rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf)))
+ int rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf);
+ if (__glibc_unlikely (rc != 0))
return rc;
}
else
@@ -494,7 +492,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
idn_flags |= IDNA_USE_STD3_ASCII_RULES;
char *p = NULL;
- rc = __idna_to_ascii_lz (name, &p, idn_flags);
+ int rc = __idna_to_ascii_lz (name, &p, idn_flags);
if (rc != IDNA_SUCCESS)
{
/* No need to jump to free_and_return here. */
@@ -792,15 +790,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
while (1)
{
- rc = 0;
status = DL_CALL_FCT (fct4, (name, pat,
tmpbuf->data, tmpbuf->length,
- &rc, &herrno,
+ &errno, &herrno,
NULL));
if (status == NSS_STATUS_SUCCESS)
break;
if (status != NSS_STATUS_TRYAGAIN
- || rc != ERANGE || herrno != NETDB_INTERNAL)
+ || errno != ERANGE || herrno != NETDB_INTERNAL)
{
if (herrno == TRY_AGAIN)
no_data = EAI_AGAIN;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 32 +++++++++++++++++
support/namespace.h | 11 ++++--
support/support_chroot.c | 32 ++++++++++++-----
sysdeps/posix/getaddrinfo.c | 80 ++++++++++++++++++++-----------------------
4 files changed, 100 insertions(+), 55 deletions(-)
hooks/post-receive
--
GNU C Library master sources