From: Ian Jackson Date: Sat, 7 Aug 2021 18:40:07 +0000 (+0100) Subject: config: Tolerate Global settings in client sections on client X-Git-Tag: hippotat/1.0.0~270 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c9a5b72df7bc887d74d7ee12a22c0a617f908c77;p=hippotat.git 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 --- 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),