Disallow using the same domaine for association and delegation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0e7b829b46
commit
db9254174a
2 changed files with 23 additions and 5 deletions
|
@ -47,6 +47,12 @@ func init() {
|
|||
return true, nil
|
||||
} else if ue.CNAME != "" {
|
||||
cname := dns.Fqdn(ue.CNAME)
|
||||
|
||||
// Ensure delegation and association differs
|
||||
if student.DelegatedDomain != nil && *student.DelegatedDomain == cname {
|
||||
return nil, fmt.Errorf("Le domaine pour l'association CNAME doit être différent du domaine délégué.")
|
||||
}
|
||||
|
||||
student.AssociatedDomain = &cname
|
||||
|
||||
if _, err := student.Update(); err != nil {
|
||||
|
@ -90,6 +96,11 @@ func init() {
|
|||
} else {
|
||||
ns := dns.Fqdn(ue.NS)
|
||||
|
||||
// Ensure delegation and association differs
|
||||
if student.AssociatedDomain != nil && *student.AssociatedDomain == ns {
|
||||
return nil, fmt.Errorf("Le domaine pour la délégation doit être différent du CNAME associé précédemment.")
|
||||
}
|
||||
|
||||
// Ensure ns doesn't belong to one of our domain
|
||||
for _, ddomain := range adlin.DelegatedDomainSuffixes {
|
||||
if strings.HasSuffix(ns, ddomain) {
|
||||
|
|
Reference in a new issue