From 484643e114bc1699ef690dbe13c3e78edabc1ff2 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 12 Nov 2024 15:48:01 +0700 Subject: [PATCH] cmd/cli: lowercase AD domain to be consistent with network rules While at it, also add a note that the domain comparison are done in case-insensitive manner. --- cmd/cli/ad_windows.go | 3 +++ docs/config.md | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/cli/ad_windows.go b/cmd/cli/ad_windows.go index 9a64dfd..d7374d0 100644 --- a/cmd/cli/ad_windows.go +++ b/cmd/cli/ad_windows.go @@ -18,6 +18,9 @@ func addExtraSplitDnsRule(cfg *ctrld.Config) bool { mainLog.Load().Debug().Msg("no active directory domain found") return false } + // Network rules are lowercase during toml config marshaling, + // lowercase the domain here too for consistency. + domain = strings.ToLower(domain) for n, lc := range cfg.Listener { if lc.Policy == nil { lc.Policy = &ctrld.ListenerPolicyConfig{} diff --git a/docs/config.md b/docs/config.md index 136cb04..9ed9a28 100644 --- a/docs/config.md +++ b/docs/config.md @@ -564,6 +564,12 @@ And within each policy, the rules are processed from top to bottom. - Required: no - Default: [] +--- + +Note that the domain comparisons are done in case in-sensitive manner following [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034#section-3.1) + +--- + ### macs: `macs` is the list of mac rules within the policy. Mac address value is case-insensitive.