maatma: avoid invalid character at the begining or end of domain name

This commit is contained in:
nemunaire 2019-03-26 17:54:07 +01:00
parent a9d84f8ee6
commit 1e1d8faf6e

View File

@ -159,7 +159,7 @@ func parseKnotZoneRead(args ...string) (rr []Entry, err error) {
} }
func (student Student) myAssociatedDomain() (string) { func (student Student) myAssociatedDomain() (string) {
return fmt.Sprintf("%s.%s.", strings.Replace(student.Login, "_", "-", -1), AssociatedDomainSuffix) return fmt.Sprintf("%s.%s.", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), AssociatedDomainSuffix)
} }
func (student Student) GetAssociatedDomains() (ds []string) { func (student Student) GetAssociatedDomains() (ds []string) {
@ -222,7 +222,7 @@ func (student Student) AddAssociatedDomains() (err error) {
func (student Student) MyDelegatedDomain() (string) { func (student Student) MyDelegatedDomain() (string) {
return fmt.Sprintf("%s.%s.", strings.Replace(student.Login, "_", "-", -1), DelegatedDomainSuffix) return fmt.Sprintf("%s.%s.", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), DelegatedDomainSuffix)
} }
func (student Student) getRRDelegatedDomain(dn string, rr string) (rrs []Entry, err error) { func (student Student) getRRDelegatedDomain(dn string, rr string) (rrs []Entry, err error) {