From 100ff6f238ceb40929c48e1b63acf0d4048acda4 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 11 Apr 2014 16:42:29 +0000 Subject: [PATCH] Let sslcert do STARTTLS based on service, not just port number --- nselib/sslcert.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nselib/sslcert.lua b/nselib/sslcert.lua index aed2cc9d2..d727736c7 100644 --- a/nselib/sslcert.lua +++ b/nselib/sslcert.lua @@ -218,27 +218,35 @@ StartTLS = { -- A table mapping port numbers to specialized SSL negotiation functions. local SPECIALIZED_PREPARE_TLS = { + ftp = StartTLS.ftp_prepare_tls, [21] = StartTLS.ftp_prepare_tls, + smtp = StartTLS.smtp_prepare_tls, [25] = StartTLS.smtp_prepare_tls, [587] = StartTLS.smtp_prepare_tls, + xmpp = StartTLS.xmpp_prepare_tls, [5222] = StartTLS.xmpp_prepare_tls, [5269] = StartTLS.xmpp_prepare_tls } local SPECIALIZED_PREPARE_TLS_WITHOUT_RECONNECT = { + ftp = StartTLS.ftp_prepare_tls_without_reconnect, [21] = StartTLS.ftp_prepare_tls_without_reconnect, + smtp = StartTLS.smtp_prepare_tls_without_reconnect, [25] = StartTLS.smtp_prepare_tls_without_reconnect, [587] = StartTLS.smtp_prepare_tls_without_reconnect, + xmpp = StartTLS.xmpp_prepare_tls_without_reconnect, [5222] = StartTLS.xmpp_prepare_tls_without_reconnect, [5269] = StartTLS.xmpp_prepare_tls_without_reconnect } function getPrepareTLSWithoutReconnect(port) - return SPECIALIZED_PREPARE_TLS_WITHOUT_RECONNECT[port.number] + return (SPECIALIZED_PREPARE_TLS_WITHOUT_RECONNECT[port.number] or + SPECIALIZED_PREPARE_TLS_WITHOUT_RECONNECT[port.service]) end function isPortSupported(port) - return SPECIALIZED_PREPARE_TLS[port.number] + return (SPECIALIZED_PREPARE_TLS[port.number] or + SPECIALIZED_PREPARE_TLS[port.service]) end --- Gets a certificate for the given host and port