]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: testdane will not check hosts which are unreachable
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 21 Oct 2015 07:13:56 +0000 (09:13 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 21 Oct 2015 07:14:22 +0000 (09:14 +0200)
tests/suite/testdane

index 12d3ce19e7d5e2023eb958cd73f4c7842c1f0835..05d9cde1cf2aede5e5ec29b4303d753d9d3a8532 100755 (executable)
@@ -38,14 +38,17 @@ echo "*** Testing good HTTPS hosts ***"
 HOSTS="good.dane.verisignlabs.com www.freebsd.org www.kumari.net torproject.org fedoraproject.org"
 HOSTS="${HOSTS} nohats.ca"
 for host in ${HOSTS}; do
-       echo -n "${host}: "
 
-       "${DANETOOL}" --check "${host}" >/dev/null 2>&1
-       if [ $? != 0 ]; then
-               echo "Error checking ${host}"
-               exit 1
+       nc "${host}" 443 </dev/null
+       if test $? = 0;then
+               echo -n "${host}: "
+               "${DANETOOL}" --check "${host}" >/dev/null 2>&1
+               if [ $? != 0 ]; then
+                       echo "Error checking ${host}"
+                       exit 1
+               fi
+               echo "ok"
        fi
-       echo "ok"
 done
 
 echo ""
@@ -53,14 +56,17 @@ echo "*** Testing good SMTP hosts ***"
 #HOSTS="dougbarton.us nlnetlabs.nl"
 HOSTS="nlnetlabs.nl"
 for host in ${HOSTS}; do
-       echo -n "${host}: "
 
-       "${DANETOOL}" --check "${host}" --port 25 >/dev/null 2>&1
-       if [ $? != 0 ]; then
-               echo "Error checking ${host}"
-               exit 1
+       nc "${host}" 25 </dev/null
+       if test $? = 0;then
+               echo -n "${host}: "
+               "${DANETOOL}" --check "${host}" --port 25 >/dev/null 2>&1
+               if [ $? != 0 ]; then
+                       echo "Error checking ${host}"
+                       exit 1
+               fi
+               echo "ok"
        fi
-       echo "ok"
 done
 
 echo ""
@@ -70,13 +76,17 @@ echo "*** Testing bad HTTPS hosts ***"
 HOSTS="bad-hash.dane.verisignlabs.com bad-params.dane.verisignlabs.com"
 HOSTS="${HOSTS} bad-sig.dane.verisignlabs.com"
 for host in ${HOSTS}; do
-       echo -n "${host}: "
-       "${DANETOOL}" --check "${host}" >/dev/null 2>&1
-       if [ $? = 0 ]; then
-               echo "Checking ${host} should have failed"
-               exit 1
+
+       nc "${host}" 443 </dev/null
+       if test $? = 0;then
+               echo -n "${host}: "
+               "${DANETOOL}" --check "${host}" >/dev/null 2>&1
+               if [ $? = 0 ]; then
+                       echo "Checking ${host} should have failed"
+                       exit 1
+               fi
+               echo "ok"
        fi
-       echo "ok"
 done