You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/07/24 16:53:44 UTC
[trafficcontrol] 03/04: added more stringent validation rules
around the host and the address
This is an automated email from the ASF dual-hosted git repository.
dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit ce04068823e78607929b9a7049805f4b190dc9a8
Author: Dewayne Richardson <de...@apache.org>
AuthorDate: Mon Jul 23 14:48:41 2018 -0600
added more stringent validation rules around the host and the address
---
traffic_ops/testing/api/v13/tc-fixtures.json | 2 +-
traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/traffic_ops/testing/api/v13/tc-fixtures.json b/traffic_ops/testing/api/v13/tc-fixtures.json
index 256b9bd..e1b2212 100644
--- a/traffic_ops/testing/api/v13/tc-fixtures.json
+++ b/traffic_ops/testing/api/v13/tc-fixtures.json
@@ -1024,7 +1024,7 @@
],
"staticdnsentries": [
{
- "address": "192.168.0.1",
+ "address": "this.is.a.hostname.",
"cachegroup": "cachegroup1",
"deliveryservice": "ds1",
"host": "host1",
diff --git a/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go b/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
index 7006b99..b1af93f 100644
--- a/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
+++ b/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
@@ -82,8 +82,8 @@ func (staticDNSEntry *TOStaticDNSEntry) SetKeys(keys map[string]interface{}) {
// Validate fulfills the api.Validator interface
func (staticDNSEntry TOStaticDNSEntry) Validate() error {
errs := validation.Errors{
- "host": validation.Validate(staticDNSEntry.Host, validation.Required),
- "address": validation.Validate(staticDNSEntry.Address, validation.Required, is.IP),
+ "host": validation.Validate(staticDNSEntry.Host, validation.Required, is.DNSName),
+ "address": validation.Validate(staticDNSEntry.Address, validation.Required, is.Host),
"dsname": validation.Validate(staticDNSEntry.DeliveryService, validation.Required),
"ttl": validation.Validate(staticDNSEntry.TTL, validation.Required),
"type": validation.Validate(staticDNSEntry.Type, validation.Required),