Parcourir la source

Fix 2573 wildcard DNS records (#2574)

* Fix 2573 wildcard DNS records
Jaap Marcus il y a 3 ans
Parent
commit
ce3b486751
3 fichiers modifiés avec 21 ajouts et 16 suppressions
  1. 1 1
      func/main.sh
  2. 14 15
      test/checks.bats
  3. 6 0
      test/test.bats

+ 1 - 1
func/main.sh

@@ -890,7 +890,7 @@ is_common_format_valid() {
 }
 
 is_no_new_line_format() {
-    test=$(echo $1 | head -n1 );
+    test=$(echo "$1" | head -n1 );
     if [[ "$test" != "$1" ]]; then
       check_result "$E_INVALID" "invalid value :: $1"
     fi

+ 14 - 15
test/checks.bats

@@ -179,28 +179,27 @@ r'
 }
 
 @test "is_alias_format_valid success" {
-     run is_domain_format_valid 'hestiacp.com' "key"
+     run is_alias_format_valid 'hestiacp.com' "key"
     assert_success
 }
 
-@test "is_alias_format_valid www" {
-     run is_domain_format_valid 'www' "key"
-    assert_failure $E_INVALID
+@test "is_alias_format_valid success www.domain.com" {
+     run is_alias_format_valid 'www.hestiacp.com' "key"
+    assert_success
 }
-@test "is_alias_format_valid number" {
-     run is_domain_format_valid '12345' "key"
-    assert_failure $E_INVALID
+@test "is_alias_format_valid success hestiacp.com,www.hestiacp.com" {
+     run is_alias_format_valid 'hestiacp.com,www.hestiacp.com' "key"
+    assert_success
 }
 
-@test "is_alias_format_valid .." {
-     run is_domain_format_valid '..' "key"
-    assert_failure $E_INVALID
+@test "is_alias_format_valid success *.hestiacp.com" {
+     run is_alias_format_valid '*.hestiacp.com' "key"
+    assert_success
 }
-@test "is_alias_format_valid LF." {
-     run is_domain_format_valid 'c
-1eshutdown
-r' "key"
-    assert_failure $E_INVALID
+
+@test "is_alias_format_valid success www.hestiacp.com,*.hestiacp.com" {
+     run is_alias_format_valid 'www.hestiacp.com,*.hestiacp.com' "key"
+    assert_success
 }
 
 @test "is_extention_format_valid test" {

+ 6 - 0
test/test.bats

@@ -1175,6 +1175,12 @@ function check_ip_not_banned(){
     refute_output
 }
 
+@test "DNS: Add domain record *.domain.com" {
+    run v-add-dns-record $user $domain '*' A 198.18.0.125 '' 30
+    assert_success
+    refute_output
+}
+
 @test "DNS: Change DNS record" {
   run v-change-dns-record $user $domain 20 test A 198.18.0.125 "" "" 1500
   assert_success