From 9ddb42276dcd980056f1c29dfd301dcf4a33e58c Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 12 Feb 2025 10:41:23 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Remi Gacogne --- pdns/recursordist/rec-rust-lib/rust/build.rs | 2 +- pdns/recursordist/rec-rust-lib/rust/src/web.rs | 2 +- pdns/recursordist/ws-recursor.cc | 2 +- regression-tests.api/runtests.py | 2 +- regression-tests.api/test_helper.py | 2 +- regression-tests.recursor-dnssec/test_Prometheus.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pdns/recursordist/rec-rust-lib/rust/build.rs b/pdns/recursordist/rec-rust-lib/rust/build.rs index b2e9b952eb..c9a07d3ae0 100644 --- a/pdns/recursordist/rec-rust-lib/rust/build.rs +++ b/pdns/recursordist/rec-rust-lib/rust/build.rs @@ -7,7 +7,7 @@ fn main() { .flag("-I../../..") .compile("settings"); - // lib.rs is generated and take care of by parent Makefile + // lib.rs is generated and taken care of by parent Makefile println!("cargo:rerun-if-changed=src/misc.rs"); println!("cargo:rerun-if-changed=src/web.rs"); } diff --git a/pdns/recursordist/rec-rust-lib/rust/src/web.rs b/pdns/recursordist/rec-rust-lib/rust/src/web.rs index 703698cfde..aa0a7849fa 100644 --- a/pdns/recursordist/rec-rust-lib/rust/src/web.rs +++ b/pdns/recursordist/rec-rust-lib/rust/src/web.rs @@ -198,7 +198,7 @@ fn api_wrapper( if !auth_ok { for kv in &request.vars { cxx::let_cxx_string!(s = &kv.value); - if kv.key == "x-api-key" && ctx.api_ch.as_ref().unwrap().matches(&s) { + if kv.key == "api-key" && ctx.api_ch.as_ref().unwrap().matches(&s) { auth_ok = true; break; } diff --git a/pdns/recursordist/ws-recursor.cc b/pdns/recursordist/ws-recursor.cc index d09286caa3..17a9eb5a79 100644 --- a/pdns/recursordist/ws-recursor.cc +++ b/pdns/recursordist/ws-recursor.cc @@ -1066,7 +1066,7 @@ static void rustWrapper(const std::function& request.parameters[std::string(key)] = std::string(value); } // These two log objects are not used by the Rust code, as they take the logging object from the - // context, initalized from an argument to pdns::rust::web::rec::serveweb() + // context, initialized from an argument to pdns::rust::web::rec::serveweb() request.d_slog = g_slog; response.d_slog = g_slog; try { diff --git a/regression-tests.api/runtests.py b/regression-tests.api/runtests.py index 99932570d3..b82c623752 100755 --- a/regression-tests.api/runtests.py +++ b/regression-tests.api/runtests.py @@ -284,7 +284,7 @@ for try_number in range(0, 10): if daemon == 'authoritative': res = requests.get('http://127.0.0.1:%s/' % WEBPORT) else: - res = requests.get('https://127.0.0.1:%s/' % WEBPORT, verify=False) + res = requests.get('https://127.0.0.1:%s/' % WEBPORT, verify='ca.pem') available = True break except HTTPError as http_err: diff --git a/regression-tests.api/test_helper.py b/regression-tests.api/test_helper.py index fe8272560f..62651b8a2f 100644 --- a/regression-tests.api/test_helper.py +++ b/regression-tests.api/test_helper.py @@ -40,7 +40,7 @@ class ApiTestCase(unittest.TestCase): self.session.headers = {'X-API-Key': os.environ.get('APIKEY', 'changeme-key'), 'Origin': 'http://%s:%s' % (self.server_address, self.server_port)} if is_recursor(): self.server_url = 'https://%s:%s/' % (self.server_address, self.server_port) - self.session.verify = False + self.session.verify = 'ca.pem' def url(self, relative_url): return urljoin(self.server_url, relative_url) diff --git a/regression-tests.recursor-dnssec/test_Prometheus.py b/regression-tests.recursor-dnssec/test_Prometheus.py index 065c803e6d..4573098755 100644 --- a/regression-tests.recursor-dnssec/test_Prometheus.py +++ b/regression-tests.recursor-dnssec/test_Prometheus.py @@ -109,7 +109,7 @@ webservice: def testPrometheus(self): self.waitForTCPSocket("127.0.0.1", self._wsPort) url = 'https://user:' + self._wsPassword + '@127.0.0.1:' + str(self._wsPort) + '/metrics' - r = requests.get(url, timeout=self._wsTimeout, verify=False) + r = requests.get(url, timeout=self._wsTimeout, verify='ca.pem') self.assertTrue(r) self.assertEqual(r.status_code, 200) self.checkPrometheusContentBasic(r.text) -- 2.47.2