summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-22 13:34:44 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-22 17:08:38 +0200
commit19d163a3903c91b85db8540875c5c637bdf046c5 (patch)
treea89e35fa09148ea390175adbdc0415c466bf689e
parent1c7e7b92d86b94b8dbdbaa7a0c9540a0022e2665 (diff)
downloadgnutls-19d163a3903c91b85db8540875c5c637bdf046c5.tar.gz
tests: added basic test of STARTTLS over FTP for gnutls-cli
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/starttls-ftp.txt3
-rwxr-xr-xtests/starttls.sh15
3 files changed, 19 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b604906080..02e416eb21 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,7 +33,7 @@ EXTRA_DIST = suppressions.valgrind eagain-common.h cert-common.h test-chains.h \
system.prio pkcs11/softhsm.h pkcs11/pkcs11-pubkey-import.c gnutls-asan.supp \
rsa-md5-collision/MD5CollisionCA.cer rsa-md5-collision/TargetCollidingCertificate1.cer \
rsa-md5-collision/TargetCollidingCertificate2.cer rsa-md5-collision/README \
- safe-renegotiation/README starttls-smtp.txt
+ safe-renegotiation/README starttls-smtp.txt starttls-ftp.txt
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = \
diff --git a/tests/starttls-ftp.txt b/tests/starttls-ftp.txt
new file mode 100644
index 0000000000..d32c3d9634
--- /dev/null
+++ b/tests/starttls-ftp.txt
@@ -0,0 +1,3 @@
+TIMEOUT 120
+FEAT '211-Extended features supported:\r\n LANG EN*\r\n AUTH TLS;TLS-C;SSL;TLS-P;\r\n211 END\r\n'
+AUTH '234 AUTH command ok. Expecting TLS Negotiation.\r\n'
diff --git a/tests/starttls.sh b/tests/starttls.sh
index 0f4dde5ed8..cc55cf7a26 100755
--- a/tests/starttls.sh
+++ b/tests/starttls.sh
@@ -68,4 +68,19 @@ fi
kill ${PID}
wait
+echo "Checking STARTTLS over FTP"
+
+eval "${GETPORT}"
+socat TCP-LISTEN:${PORT} EXEC:"chat -e -S -v -f ${srcdir}/starttls-ftp.txt",pty &
+PID=$!
+wait_server ${PID}
+
+${VALGRIND} "${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:+ANON-ECDH --insecure --starttls-proto ftp --verbose </dev/null >/dev/null
+if test $? != 1;then
+ fail ${PID} "connect should have failed with error code 1"
+fi
+
+kill ${PID}
+wait
+
exit 0