From 08e8ff920aec28df8176f347e6d6ce183aff1539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 19 Feb 2021 17:37:57 +0100 Subject: [PATCH] check_ssl_certificate - Generate list of supported StartTLS procols --- cmd/check_ssl_certificate/main.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/check_ssl_certificate/main.go b/cmd/check_ssl_certificate/main.go index ee54c2b..2f3292c 100644 --- a/cmd/check_ssl_certificate/main.go +++ b/cmd/check_ssl_certificate/main.go @@ -129,6 +129,18 @@ var certGetters map[string]certGetter = map[string]certGetter{ "sieve": &sieveGetter{}, } +// Get a string that represents supported StartTLS protocols +func listSupportedGetters() string { + sb := strings.Builder{} + for key, _ := range certGetters { + if sb.Len() != 0 { + sb.WriteString(", ") + } + sb.WriteString(key) + } + return sb.String() +} + //-------------------------------------------------------------------------------------------------------- // Command line flags that have been parsed. @@ -169,7 +181,10 @@ func (flags *programFlags) parseArguments() { golf.StringVarP(&names, 'a', "additional-names", "", "A comma-separated list of names that the certificate should also provide.") golf.StringVarP(&flags.startTLS, 's', "start-tls", "", - "Protocol to use before requesting a switch to TLS. Supported protocols: smtp.") + fmt.Sprintf( + "Protocol to use before requesting a switch to TLS. "+ + "Supported protocols: %s.", + listSupportedGetters())) golf.Parse() if help { golf.Usage()