forked from rpms/glibc
1708d98eba
* Mon Nov 14 2022 Arjun Shankar <arjun@redhat.com> - 2.34-49 - Sync with upstream branch release/2.34/master, commit: 75b0edb7ef338084e53925139ae81fb0dfc07dd4: - Update NEWS file in the right place - Linux: Support __IPC_64 in sysvctl *ctl command arguments (bug 29771) - io: Fix use-after-free in ftw [BZ #26779] - io: Fix ftw internal realloc buffer (BZ #28126) - regex: fix buffer read overrun in search [BZ#28470] - regex: copy back from Gnulib - Allow #pragma GCC in headers in conformtest - Fix memmove call in vfprintf-internal.c:group_number - mktime: improve heuristic for ca-1986 Indiana DST - Makerules: fix MAKEFLAGS assignment for upcoming make-4.4 [BZ# 29564] - linux: Fix generic struct_stat for 64 bit time (BZ# 29657) - elf: Do not completely clear reused namespace in dlmopen (bug 29600) - nss: Use shared prefix in IPv4 address in tst-reload1 - nss: Fix tst-nss-files-hosts-long on single-stack hosts (bug 24816) - nss: Implement --no-addrconfig option for getent Resolves: #2141728 Resolves: #2110357 Resolves: #2141685
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
commit c95ef423d78d9a2ec0a8e4141c78165434685c6f
|
|
Author: Florian Weimer <fweimer@redhat.com>
|
|
Date: Tue Sep 13 16:10:20 2022 +0200
|
|
|
|
nss: Implement --no-addrconfig option for getent
|
|
|
|
The ahosts, ahostsv4, ahostsv6 commands unconditionally pass
|
|
AI_ADDRCONFIG to getaddrinfo, which is not always desired.
|
|
|
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
(cherry picked from commit a623f13adfac47c8634a7288e08f821a846bc650)
|
|
|
|
diff --git a/nss/getent.c b/nss/getent.c
|
|
index ec48ba4bf1f5f788..0f4d549b05da73ac 100644
|
|
--- a/nss/getent.c
|
|
+++ b/nss/getent.c
|
|
@@ -59,6 +59,8 @@ static const struct argp_option args_options[] =
|
|
{
|
|
{ "service", 's', N_("CONFIG"), 0, N_("Service configuration to be used") },
|
|
{ "no-idn", 'i', NULL, 0, N_("disable IDN encoding") },
|
|
+ { "no-addrconfig", 'A', NULL, 0,
|
|
+ N_("do not filter out unsupported IPv4/IPv6 addresses (with ahosts*)") },
|
|
{ NULL, 0, NULL, 0, NULL },
|
|
};
|
|
|
|
@@ -80,6 +82,9 @@ static struct argp argp =
|
|
/* Additional getaddrinfo flags for IDN encoding. */
|
|
static int idn_flags = AI_IDN | AI_CANONIDN;
|
|
|
|
+/* Set to 0 by --no-addrconfig. */
|
|
+static int addrconfig_flags = AI_ADDRCONFIG;
|
|
+
|
|
/* Print the version information. */
|
|
static void
|
|
print_version (FILE *stream, struct argp_state *state)
|
|
@@ -347,7 +352,7 @@ ahosts_keys_int (int af, int xflags, int number, char *key[])
|
|
|
|
struct addrinfo hint;
|
|
memset (&hint, '\0', sizeof (hint));
|
|
- hint.ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME
|
|
+ hint.ai_flags = (AI_V4MAPPED | addrconfig_flags | AI_CANONNAME
|
|
| idn_flags | xflags);
|
|
hint.ai_family = af;
|
|
|
|
@@ -906,6 +911,10 @@ parse_option (int key, char *arg, struct argp_state *state)
|
|
idn_flags = 0;
|
|
break;
|
|
|
|
+ case 'A':
|
|
+ addrconfig_flags = 0;
|
|
+ break;
|
|
+
|
|
default:
|
|
return ARGP_ERR_UNKNOWN;
|
|
}
|