Blame SOURCES/sendmail-8.14.7-tls-use-certificate-chain-file.patch

df3b45
diff --git a/sendmail/conf.c b/sendmail/conf.c
df3b45
index 777e05e..e693ed0 100644
df3b45
--- a/sendmail/conf.c
df3b45
+++ b/sendmail/conf.c
df3b45
@@ -6504,6 +6504,14 @@ char	*FFRCompileOptions[] =
df3b45
 	/* More STARTTLS options, e.g., secondary certs. */
df3b45
 	"_FFR_TLS_1",
df3b45
 #endif /* _FFR_TLS_1 */
df3b45
+#if _FFR_TLS_USE_CERTIFICATE_CHAIN_FILE
df3b45
+	/*
df3b45
+	**  Use SSL_CTX_use_certificate_chain_file()
df3b45
+	**  instead of SSL_CTX_use_certificate_file()
df3b45
+	*/
df3b45
+
df3b45
+	"_FFR_TLS_USE_CERTIFICATE_CHAIN_FILE",
df3b45
+#endif /* _FFR_TLS_USE_CERTIFICATE_CHAIN_FILE */
df3b45
 #if _FFR_TRUSTED_QF
df3b45
 	/*
df3b45
 	**  If we don't own the file mark it as unsafe.
df3b45
diff --git a/sendmail/tls.c b/sendmail/tls.c
df3b45
index 72da987..6707a35 100644
df3b45
--- a/sendmail/tls.c
df3b45
+++ b/sendmail/tls.c
df3b45
@@ -860,17 +860,25 @@ inittls(ctx, req, options, srv, certfile, keyfile, cacertpath, cacertfile, dhpar
df3b45
 		if (bitset(TLS_I_USE_KEY, req))
df3b45
 			return false;
df3b45
 	}
df3b45
+#if _FFR_TLS_USE_CERTIFICATE_CHAIN_FILE
df3b45
+# define SSL_CTX_use_cert(ssl_ctx, certfile) \
df3b45
+	SSL_CTX_use_certificate_chain_file(ssl_ctx, certfile)
df3b45
+# define SSL_CTX_USE_CERT "SSL_CTX_use_certificate_chain_file"
df3b45
+#else
df3b45
+# define SSL_CTX_use_cert(ssl_ctx, certfile) \
df3b45
+	SSL_CTX_use_certificate_file(ssl_ctx, certfile, SSL_FILETYPE_PEM)
df3b45
+# define SSL_CTX_USE_CERT "SSL_CTX_use_certificate_file"
df3b45
+#endif
df3b45
 
df3b45
 	/* get the certificate file */
df3b45
 	if (bitset(TLS_S_CERT_OK, status) &&
df3b45
-	    SSL_CTX_use_certificate_file(*ctx, certfile,
df3b45
-					 SSL_FILETYPE_PEM) <= 0)
df3b45
+	    SSL_CTX_use_cert(*ctx, certfile) <= 0)
df3b45
 	{
df3b45
 		if (LogLevel > 7)
df3b45
 		{
df3b45
 			sm_syslog(LOG_WARNING, NOQID,
df3b45
-				  "STARTTLS=%s, error: SSL_CTX_use_certificate_file(%s) failed",
df3b45
-				  who, certfile);
df3b45
+				  "STARTTLS=%s, error: %s(%s) failed",
df3b45
+				  who, SSL_CTX_USE_CERT, certfile);
df3b45
 			if (LogLevel > 9)
df3b45
 				tlslogerr(LOG_WARNING, who);
df3b45
 		}
df3b45
@@ -914,13 +922,13 @@ inittls(ctx, req, options, srv, certfile, keyfile, cacertpath, cacertfile, dhpar
df3b45
 
df3b45
 	/* get the certificate file */
df3b45
 	if (bitset(TLS_S_CERT2_OK, status) &&
df3b45
-	    SSL_CTX_use_certificate_file(*ctx, cf2, SSL_FILETYPE_PEM) <= 0)
df3b45
+	    SSL_CTX_use_cert(*ctx, cf2) <= 0)
df3b45
 	{
df3b45
 		if (LogLevel > 7)
df3b45
 		{
df3b45
 			sm_syslog(LOG_WARNING, NOQID,
df3b45
-				  "STARTTLS=%s, error: SSL_CTX_use_certificate_file(%s) failed",
df3b45
-				  who, cf2);
df3b45
+				  "STARTTLS=%s, error: %s(%s) failed",
df3b45
+				  who, SSL_CTX_USE_CERT, cf2);
df3b45
 			if (LogLevel > 9)
df3b45
 				tlslogerr(LOG_WARNING, who);
df3b45
 		}