|
|
923a60 |
From 624fcda36dd376707e3af088b592fe3764b99acf Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Jan Synacek <jsynacek@redhat.com>
|
|
|
923a60 |
Date: Tue, 2 May 2017 14:34:17 +0200
|
|
|
923a60 |
Subject: [PATCH] myhostname: don't return any ipv6 entries when ipv6 is
|
|
|
923a60 |
disabled
|
|
|
923a60 |
|
|
|
923a60 |
This commit amends the rhel-only 6e5117b83af5998359916f276a9b32f755c0e6f4.
|
|
|
923a60 |
|
|
|
923a60 |
Resolves: #1444824
|
|
|
923a60 |
---
|
|
|
923a60 |
src/nss-myhostname/nss-myhostname.c | 10 ++++------
|
|
|
923a60 |
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
|
|
|
923a60 |
index e197cc752d..144c831719 100644
|
|
|
923a60 |
--- a/src/nss-myhostname/nss-myhostname.c
|
|
|
923a60 |
+++ b/src/nss-myhostname/nss-myhostname.c
|
|
|
923a60 |
@@ -351,6 +351,8 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
|
|
|
923a60 |
*h_errnop = NO_DATA;
|
|
|
923a60 |
return NSS_STATUS_UNAVAIL;
|
|
|
923a60 |
}
|
|
|
923a60 |
+ if (af == AF_INET6 && !socket_ipv6_is_supported())
|
|
|
923a60 |
+ return NSS_STATUS_UNAVAIL;
|
|
|
923a60 |
|
|
|
923a60 |
if (is_localhost(name)) {
|
|
|
923a60 |
canonical = "localhost";
|
|
|
923a60 |
@@ -381,13 +383,9 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
|
|
|
923a60 |
return NSS_STATUS_NOTFOUND;
|
|
|
923a60 |
}
|
|
|
923a60 |
|
|
|
923a60 |
- if (af == AF_INET6 && !socket_ipv6_is_supported()) {
|
|
|
923a60 |
+ n_addresses = local_addresses(NULL, 0, af, &addresses);
|
|
|
923a60 |
+ if (n_addresses < 0)
|
|
|
923a60 |
n_addresses = 0;
|
|
|
923a60 |
- } else {
|
|
|
923a60 |
- n_addresses = local_addresses(NULL, 0, af, &addresses);
|
|
|
923a60 |
- if (n_addresses < 0)
|
|
|
923a60 |
- n_addresses = 0;
|
|
|
923a60 |
- }
|
|
|
923a60 |
|
|
|
923a60 |
canonical = hn;
|
|
|
923a60 |
additional = n_addresses <= 0 && af == AF_INET6 ? "localhost" : NULL;
|