Blame SOURCES/gnutls-3.3.29-tests-sni-hostname.patch

519d7d
diff --git a/tests/Makefile.am b/tests/Makefile.am
519d7d
index bafb12ae0..d249d405f 100644
519d7d
--- a/tests/Makefile.am
519d7d
+++ b/tests/Makefile.am
519d7d
@@ -156,7 +156,7 @@ endif
519d7d
 endif
519d7d
 
519d7d
 check_PROGRAMS = $(ctests)
519d7d
-dist_check_SCRIPTS = rfc2253-escape-test
519d7d
+dist_check_SCRIPTS = rfc2253-escape-test sni-hostname.sh
519d7d
 
519d7d
 TESTS = $(ctests) $(dist_check_SCRIPTS)
519d7d
 
519d7d
diff --git a/tests/sni-hostname.sh b/tests/sni-hostname.sh
519d7d
new file mode 100755
519d7d
index 000000000..4fb51be68
519d7d
--- /dev/null
519d7d
+++ b/tests/sni-hostname.sh
519d7d
@@ -0,0 +1,66 @@
519d7d
+#!/bin/sh
519d7d
+
519d7d
+# Copyright (C) 2017 Nikos Mavrogiannopoulos
519d7d
+#
519d7d
+# Author: Nikos Mavrogiannopoulos
519d7d
+#
519d7d
+# This file is part of GnuTLS.
519d7d
+#
519d7d
+# GnuTLS is free software; you can redistribute it and/or modify it
519d7d
+# under the terms of the GNU General Public License as published by the
519d7d
+# Free Software Foundation; either version 3 of the License, or (at
519d7d
+# your option) any later version.
519d7d
+#
519d7d
+# GnuTLS is distributed in the hope that it will be useful, but
519d7d
+# WITHOUT ANY WARRANTY; without even the implied warranty of
519d7d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
519d7d
+# General Public License for more details.
519d7d
+#
519d7d
+# You should have received a copy of the GNU General Public License
519d7d
+# along with GnuTLS; if not, write to the Free Software Foundation,
519d7d
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
519d7d
+
519d7d
+srcdir="${srcdir:-.}"
519d7d
+SERV="${SERV:-../src/gnutls-serv${EXEEXT}}"
519d7d
+CLI="${CLI:-../src/gnutls-cli${EXEEXT}}"
519d7d
+unset RETCODE
519d7d
+
519d7d
+if ! test -x "${SERV}"; then
519d7d
+	exit 77
519d7d
+fi
519d7d
+
519d7d
+if ! test -x "${CLI}"; then
519d7d
+	exit 77
519d7d
+fi
519d7d
+
519d7d
+if test "${WINDIR}" != ""; then
519d7d
+	exit 77
519d7d
+fi
519d7d
+
519d7d
+if ! test -z "${VALGRIND}"; then
519d7d
+	VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=15"
519d7d
+fi
519d7d
+
519d7d
+
519d7d
+SERV="${SERV} -q"
519d7d
+
519d7d
+. "${srcdir}/scripts/common.sh"
519d7d
+
519d7d
+echo "Checking SNI hostname in gnutls-cli"
519d7d
+
519d7d
+eval "${GETPORT}"
519d7d
+launch_server $$ --echo --priority "NORMAL:+ANON-ECDH" --sni-hostname-fatal --sni-hostname example.com
519d7d
+PID=$!
519d7d
+wait_server ${PID}
519d7d
+
519d7d
+${VALGRIND} "${CLI}" -p "${PORT}" 127.0.0.1 --sni-hostname example.com --priority "NORMAL:+ANON-ECDH:+ANON-DH" </dev/null >/dev/null || \
519d7d
+	fail ${PID} "1. rehandshake should have succeeded!"
519d7d
+
519d7d
+${VALGRIND} "${CLI}" -p "${PORT}" 127.0.0.1 --sni-hostname noexample.com --priority "NORMAL:+ANON-ECDH:+ANON-DH" </dev/null >/dev/null && \
519d7d
+	fail ${PID} "2. rehandshake should have failed!"
519d7d
+
519d7d
+
519d7d
+kill ${PID}
519d7d
+wait
519d7d
+
519d7d
+exit 0
519d7d
-- 
519d7d
2.14.3
519d7d