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