Skip to content

Commit ce3b486

Browse files
authored
Fix 2573 wildcard DNS records (hestiacp#2574)
* Fix 2573 wildcard DNS records
1 parent 58ba3a0 commit ce3b486

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ is_common_format_valid() {
890890
}
891891

892892
is_no_new_line_format() {
893-
test=$(echo $1 | head -n1 );
893+
test=$(echo "$1" | head -n1 );
894894
if [[ "$test" != "$1" ]]; then
895895
check_result "$E_INVALID" "invalid value :: $1"
896896
fi

test/checks.bats

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,28 +179,27 @@ r'
179179
}
180180

181181
@test "is_alias_format_valid success" {
182-
run is_domain_format_valid 'hestiacp.com' "key"
182+
run is_alias_format_valid 'hestiacp.com' "key"
183183
assert_success
184184
}
185185

186-
@test "is_alias_format_valid www" {
187-
run is_domain_format_valid 'www' "key"
188-
assert_failure $E_INVALID
186+
@test "is_alias_format_valid success www.domain.com" {
187+
run is_alias_format_valid 'www.hestiacp.com' "key"
188+
assert_success
189189
}
190-
@test "is_alias_format_valid number" {
191-
run is_domain_format_valid '12345' "key"
192-
assert_failure $E_INVALID
190+
@test "is_alias_format_valid success hestiacp.com,www.hestiacp.com" {
191+
run is_alias_format_valid 'hestiacp.com,www.hestiacp.com' "key"
192+
assert_success
193193
}
194194

195-
@test "is_alias_format_valid .." {
196-
run is_domain_format_valid '..' "key"
197-
assert_failure $E_INVALID
195+
@test "is_alias_format_valid success *.hestiacp.com" {
196+
run is_alias_format_valid '*.hestiacp.com' "key"
197+
assert_success
198198
}
199-
@test "is_alias_format_valid LF." {
200-
run is_domain_format_valid 'c
201-
1eshutdown
202-
r' "key"
203-
assert_failure $E_INVALID
199+
200+
@test "is_alias_format_valid success www.hestiacp.com,*.hestiacp.com" {
201+
run is_alias_format_valid 'www.hestiacp.com,*.hestiacp.com' "key"
202+
assert_success
204203
}
205204

206205
@test "is_extention_format_valid test" {

test/test.bats

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,12 @@ function check_ip_not_banned(){
11751175
refute_output
11761176
}
11771177

1178+
@test "DNS: Add domain record *.domain.com" {
1179+
run v-add-dns-record $user $domain '*' A 198.18.0.125 '' 30
1180+
assert_success
1181+
refute_output
1182+
}
1183+
11781184
@test "DNS: Change DNS record" {
11791185
run v-change-dns-record $user $domain 20 test A 198.18.0.125 "" "" 1500
11801186
assert_success

0 commit comments

Comments
 (0)