summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-08-06 13:56:23 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-08-06 13:56:23 -0600
commitff19bddac5ebfb68c77d9e2fb677b87d5c6a6524 (patch)
treeddc54f09a002e3cf95db83e52a2a136d07f2de7b /caddyconfig/httpcaddyfile
parent584eba94a4e06af9ce7efc91fb914f84d7a6a48c (diff)
httpcaddyfile: Avoid repeated subjects in APs (fix #3618)
When consolidating automation policies, ensure same subject names do not get appended to list.
Diffstat (limited to 'caddyconfig/httpcaddyfile')
-rw-r--r--caddyconfig/httpcaddyfile/tlsapp.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/caddyconfig/httpcaddyfile/tlsapp.go b/caddyconfig/httpcaddyfile/tlsapp.go
index aa3e5be..db6bf98 100644
--- a/caddyconfig/httpcaddyfile/tlsapp.go
+++ b/caddyconfig/httpcaddyfile/tlsapp.go
@@ -444,7 +444,12 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls
} else if len(aps[i].Subjects) > 0 && len(aps[j].Subjects) == 0 {
aps = append(aps[:i], aps[i+1:]...)
} else {
- aps[i].Subjects = append(aps[i].Subjects, aps[j].Subjects...)
+ // avoid repeated subjects
+ for _, subj := range aps[j].Subjects {
+ if !sliceContains(aps[i].Subjects, subj) {
+ aps[i].Subjects = append(aps[i].Subjects, subj)
+ }
+ }
aps = append(aps[:j], aps[j+1:]...)
}
i--