From c9a5b72df7bc887d74d7ee12a22c0a617f908c77 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 Aug 2021 19:40:07 +0100 Subject: [PATCH] config: Tolerate Global settings in client sections on client It is OK for these to be found in these sections on the client. This may simplify writing config files intended to be used only on the client. On the server we must reject these to avoid horrendous confusion. Signed-off-by: Ian Jackson --- docs/settings.rst | 3 ++- src/config.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 1f4282b..8a07983 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -107,7 +107,8 @@ target_requests_outstanding Ordinary settings, used by both, not client-specific ---------------------------------------------------- -These are not looked up in the client-specific config sections. +On the server these are forbidden in the client-specific config +sections. ``addrs`` Public IP (v4 or v6) address(es) of the server; space-separated. diff --git a/src/config.rs b/src/config.rs index b99d065..c45098f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -540,16 +540,17 @@ impl SectionName { impl SectionKindList { fn contains(self, s: &SectionName, end: LinkEnd) -> bool { match (self, end) { - (SKL::PerClient,_) => matches!(s, SN::Link(_) - | SN::Client(_) - | SN::Server(_) - | SN::Common), + (SKL::PerClient,_) | + (SKL::Global, LinkEnd::Client) => matches!(s, SN::Link(_) + | SN::Client(_) + | SN::Server(_) + | SN::Common), (SKL::Limits,_) => matches!(s, SN::ServerLimit(_) | SN::GlobalLimit), - (SKL::Global,_) => matches!(s, SN::Common - | SN::Server(_)), + (SKL::Global, LinkEnd::Server) => matches!(s, SN::Common + | SN::Server(_)), (SKL::Limited,_) => SKL::PerClient.contains(s, end) | SKL::Limits .contains(s, end), -- 2.30.2