From 19d163a3903c91b85db8540875c5c637bdf046c5 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 22 Aug 2016 13:34:44 +0200 Subject: tests: added basic test of STARTTLS over FTP for gnutls-cli --- tests/Makefile.am | 2 +- tests/starttls-ftp.txt | 3 +++ tests/starttls.sh | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/starttls-ftp.txt 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 +if test $? != 1;then + fail ${PID} "connect should have failed with error code 1" +fi + +kill ${PID} +wait + exit 0 -- cgit v1.2.1