chiark / gitweb /
config: Tolerate Global settings in client sections on client
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 18:40:07 +0000 (19:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 18:46:01 +0000 (19:46 +0100)
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 <ijackson@chiark.greenend.org.uk>
docs/settings.rst
src/config.rs

index 1f4282bfe9084dafc8726b773c2ac80bec825924..8a07983cb28a94508087cf445fd2f1fc2acaafe6 100644 (file)
@@ -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.
index b99d065671c7009474f479e8be5e91f52e3f4dae..c45098f1914e3fb3e05af69ce28b840a20bd0ff1 100644 (file)
@@ -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),