forked from rpms/glibc
2118accf25
Resolves: RHEL-45522
Fedora 40 commit: 9404e14f4d
Upstream commit: 4bdcc1963bc2b5ba5f8e319e402d9eb2cb6096c1
Fedora 40 changes:
- Backport /etc/resolv.conf enhancements to thelp with RHEL-18039 testing
Related: RHEL-50663
- Support --without testsuite builds without perl installed (#2292195)
- Use release instead of baserelease for glibc32 conflict
- Add Conflicts:/Obsoletes: for glibc32 to glibc.i686
- ppc64le: Build early startup code with -mcpu=power8
Resolves: RHEL-43456
- Move ANSI_X3.110-1983 support from main package to glibc-gconv-extra.
Resolves: RHEL-41206
Upstream changes:
- manual: make setrlimit() description less ambiguous
- manual/stdio: Clarify putc and putwc
- malloc: add multi-threaded tests for aligned_alloc/calloc/malloc
- malloc: avoid global locks in tst-aligned_alloc-lib.c
- resolv: Track single-request fallback via _res._flags (bug 31476)
- resolv: Do not wait for non-existing second DNS response after error (bug 30081)
- resolv: Allow short error responses to match any query (bug 31890)
Resolves: RHEL-50663
- elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978)
- Fix usage of _STACK_GROWS_DOWN and _STACK_GROWS_UP defines [BZ 31989]
- Linux: Make __rseq_size useful for feature detection (bug 31965)
- elf: Make dl-rseq-symbols Linux only
- nptl: fix potential merge of __rseq_* relro symbols
- s390x: Fix segfault in wcsncmp [BZ #31934]
Resolves: RHEL-49488
- stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)
- math: Provide missing math symbols on libc.a (BZ 31781)
- math: Fix isnanf128 static build (BZ 31774)
- math: Fix i386 and m68k exp10 on static build (BZ 31775)
- math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
- posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)
80 lines
3.4 KiB
Diff
80 lines
3.4 KiB
Diff
commit 95f61610f3e481d191b6184432342236fd59186d
|
|
Author: Florian Weimer <fweimer@redhat.com>
|
|
Date: Wed Jul 24 12:06:47 2024 +0200
|
|
|
|
resolv: Support clearing option flags with a “-” prefix (bug 14799)
|
|
|
|
I think using a “-” prefix is less confusing than introducing
|
|
double-negation construct (“no-no-tld-query”).
|
|
|
|
Reviewed-by: DJ Delorie <dj@redhat.com>
|
|
|
|
diff --git a/resolv/res_init.c b/resolv/res_init.c
|
|
index 263263d474721545..243532b3ade338d8 100644
|
|
--- a/resolv/res_init.c
|
|
+++ b/resolv/res_init.c
|
|
@@ -682,27 +682,29 @@ res_setoptions (struct resolv_conf_parser *parser, const char *options)
|
|
{
|
|
char str[22];
|
|
uint8_t len;
|
|
- uint8_t clear;
|
|
unsigned long int flag;
|
|
} options[] = {
|
|
#define STRnLEN(str) str, sizeof (str) - 1
|
|
- { STRnLEN ("rotate"), 0, RES_ROTATE },
|
|
- { STRnLEN ("edns0"), 0, RES_USE_EDNS0 },
|
|
- { STRnLEN ("single-request-reopen"), 0, RES_SNGLKUPREOP },
|
|
- { STRnLEN ("single-request"), 0, RES_SNGLKUP },
|
|
- { STRnLEN ("no_tld_query"), 0, RES_NOTLDQUERY },
|
|
- { STRnLEN ("no-tld-query"), 0, RES_NOTLDQUERY },
|
|
- { STRnLEN ("no-reload"), 0, RES_NORELOAD },
|
|
- { STRnLEN ("use-vc"), 0, RES_USEVC },
|
|
- { STRnLEN ("trust-ad"), 0, RES_TRUSTAD },
|
|
- { STRnLEN ("no-aaaa"), 0, RES_NOAAAA },
|
|
+ { STRnLEN ("rotate"), RES_ROTATE },
|
|
+ { STRnLEN ("edns0"), RES_USE_EDNS0 },
|
|
+ { STRnLEN ("single-request-reopen"), RES_SNGLKUPREOP },
|
|
+ { STRnLEN ("single-request"), RES_SNGLKUP },
|
|
+ { STRnLEN ("no_tld_query"), RES_NOTLDQUERY },
|
|
+ { STRnLEN ("no-tld-query"), RES_NOTLDQUERY },
|
|
+ { STRnLEN ("no-reload"), RES_NORELOAD },
|
|
+ { STRnLEN ("use-vc"), RES_USEVC },
|
|
+ { STRnLEN ("trust-ad"), RES_TRUSTAD },
|
|
+ { STRnLEN ("no-aaaa"), RES_NOAAAA },
|
|
};
|
|
#define noptions (sizeof (options) / sizeof (options[0]))
|
|
+ bool negate_option = *cp == '-';
|
|
+ if (negate_option)
|
|
+ ++cp;
|
|
for (int i = 0; i < noptions; ++i)
|
|
if (strncmp (cp, options[i].str, options[i].len) == 0)
|
|
{
|
|
- if (options[i].clear)
|
|
- parser->template.options &= options[i].flag;
|
|
+ if (negate_option)
|
|
+ parser->template.options &= ~options[i].flag;
|
|
else
|
|
parser->template.options |= options[i].flag;
|
|
break;
|
|
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
|
|
index 6bef62cde2cbf8cd..d3a19eb305d41467 100644
|
|
--- a/resolv/tst-resolv-res_init-skeleton.c
|
|
+++ b/resolv/tst-resolv-res_init-skeleton.c
|
|
@@ -679,6 +679,16 @@ struct test_case test_cases[] =
|
|
"; nameserver[0]: [192.0.2.1]:53\n",
|
|
.res_options = "attempts:5 ndots:3 edns0 ",
|
|
},
|
|
+ {.name = "RES_OPTIONS can clear flags",
|
|
+ .conf = "options ndots:2 use-vc no-aaaa edns0\n"
|
|
+ "nameserver 192.0.2.1\n",
|
|
+ .expected = "options ndots:3 use-vc\n"
|
|
+ "search example.com\n"
|
|
+ "; search[0]: example.com\n"
|
|
+ "nameserver 192.0.2.1\n"
|
|
+ "; nameserver[0]: [192.0.2.1]:53\n",
|
|
+ .res_options = "ndots:3 -edns0 -no-aaaa",
|
|
+ },
|
|
{.name = "many search list entries (bug 19569)",
|
|
.conf = "nameserver 192.0.2.1\n"
|
|
"search corp.example.com support.example.com"
|