From b337e8e9f4f74fda310afe90513b2bdca8a7d59c Mon Sep 17 00:00:00 2001
From: triatic <42704418+triatic@users.noreply.github.com>
Date: Fri, 6 Sep 2019 00:52:39 +0100
Subject: [PATCH] Allow tls verify servercert in imapssl mode

---
 dmarcts-report-parser.pl | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/dmarcts-report-parser.pl
+++ b/dmarcts-report-parser.pl
@@ -295,8 +295,13 @@
 		}
 	# The whole point of setting this socket arg is so that we don't get the nasty warning
 	} else {
-		print "using ssl without verify servercert.\n" if $debug;
-		$socketargs = [ SSL_verify_mode => SSL_VERIFY_NONE ];
+		if ( $tlsverify == 0 ) {
+			print "use tls without verify servercert.\n" if $debug;
+			$socketargs = [ SSL_verify_mode => SSL_VERIFY_NONE ];
+		} else {
+			print "use tls with verify servercert.\n" if $debug;
+			$socketargs = [ SSL_verify_mode => SSL_VERIFY_PEER ];
+		}
 	}
   
 	print "connection to $imapserver with Ssl => $imapssl, User => $imapuser, Ignoresizeerrors => $imapignoreerror\n" if $debug;
