Просмотр исходного кода

Merge branch 'fix/jammy-idn-extra' into main

Jaap Marcus 3 лет назад
Родитель
Сommit
c86d907c67
5 измененных файлов с 11 добавлено и 6 удалено
  1. 2 2
      bin/v-add-dns-record
  2. 1 1
      bin/v-add-web-domain-redirect
  3. 1 1
      bin/v-add-web-domain-ssl
  4. 6 1
      bin/v-change-dns-record
  5. 1 1
      test/test.bats

+ 2 - 2
bin/v-add-dns-record

@@ -55,8 +55,8 @@ if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
 fi
 
 if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
-    dvalue=$(idn -t --quiet -a "$dvalue" )
-    record=$(idn -t --quiet -a "$record" )
+    dvalue=$(idn2 --quiet  "$dvalue" )
+    record=$(idn2 --quiet  "$record" )
 fi
 
 # Cleanup quotes on dvalue

+ 1 - 1
bin/v-add-web-domain-redirect

@@ -18,7 +18,7 @@
 # Argument definition
 user=$1
 domain=$2
-redirect=$(echo $3 | idn);
+redirect=$(echo $3 | idn2);
 code=${4-301}
 restart=${5-no}
 

+ 1 - 1
bin/v-add-web-domain-ssl

@@ -34,7 +34,7 @@ if [[ "$domain" =~ .*\.$ ]]; then
 fi
 
 domain=$domain
-domain_idn=$(idn -t --quiet -a "$domain")
+domain_idn=$(idn2 --quiet "$domain")
 
 # Includes
 # shellcheck source=/etc/hestiacp/hestia.conf

+ 6 - 1
bin/v-change-dns-record

@@ -17,7 +17,7 @@ domain_idn=$2
 id=$3
 record=$4
 rtype=$5
-dvalue=$(idn -t --quiet -u "$6" )
+dvalue=$6
 priority=$7
 restart=$8
 ttl=$9
@@ -87,6 +87,11 @@ if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
     fi
 fi
 
+if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
+    dvalue=$(idn2  --quiet  "$dvalue" )
+    record=$(idn2  --quiet  "$record" )
+fi
+
 if [ "$rtype" != "CAA" ]; then
     dvalue=${dvalue//\"/}
 

+ 1 - 1
test/test.bats

@@ -70,7 +70,7 @@ function validate_web_domain() {
 
     # Test HTTP
     # Curl hates UTF domains so convert them to ascci. 
-    domain_idn=$(idn -a $domain)
+    domain_idn=$(idn2 $domain)
     run curl --location --silent --show-error --insecure --resolve "${domain_idn}:80:${domain_ip}" "http://${domain_idn}/${webpath}"
     assert_success
     assert_output --partial "$webproof"