Browse Source
httpcaddyfile: Avoid repeated subjects in APs (fix #3618)
When consolidating automation policies, ensure same subject names do not
get appended to list.
master
Matthew Holt
5 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
1 changed files with
6 additions and
1 deletions
-
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-- |
|
|
|