Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
httpcaddyfile: Avoid repeated subjects in APs (fix #3618)
When consolidating automation policies, ensure same subject names do not get appended to list.
Matthew Holt committed
Aug 6, 2020 at 13:56 UTC
ff19bddac5ebfb68c77d9e2fb677b87d5c6a6524
1 file changed
+6
-1
caddyconfig/httpcaddyfile/tlsapp.go
+6
-1
@@ -444,7 +444,12 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls
444
} else if len(aps[i].Subjects) > 0 && len(aps[j].Subjects) == 0 {
445
aps = append(aps[:i], aps[i+1:]...)
446
} else {
447
- aps[i].Subjects = append(aps[i].Subjects, aps[j].Subjects...)
447
+ // avoid repeated subjects
448
+ for _, subj := range aps[j].Subjects {
449
+ if !sliceContains(aps[i].Subjects, subj) {
450
+ aps[i].Subjects = append(aps[i].Subjects, subj)
451
+ }
452
+ }
453
aps = append(aps[:j], aps[j+1:]...)
454
}
455
i--