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

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