Blame SOURCES/libreswan-3.25-1679735-critical_flag.patch

221bf6
diff -Naur libreswan-3.25-orig/programs/pluto/nss_cert_verify.c libreswan-3.25/programs/pluto/nss_cert_verify.c
58c89e
--- libreswan-3.25-orig/programs/pluto/nss_cert_verify.c	2019-02-23 21:15:03.910589319 -0500
58c89e
+++ libreswan-3.25/programs/pluto/nss_cert_verify.c	2019-02-23 21:42:05.955565629 -0500
221bf6
@@ -121,7 +121,7 @@
221bf6
 	return FALSE;
221bf6
 }
221bf6
 
221bf6
-static int nss_err_to_revfail(CERTVerifyLogNode *node)
221bf6
+static int nss_err_to_revfail(char *prefix, CERTVerifyLogNode *node)
221bf6
 {
221bf6
 	int ret = VERIFY_RET_FAIL;
221bf6
 
221bf6
@@ -131,7 +131,7 @@
221bf6
 
221bf6
 	loglog(RC_LOG_SERIOUS, "Certificate %s failed verification",
221bf6
 		    node->cert->subjectName);
221bf6
-	loglog(RC_LOG_SERIOUS, "ERROR: %s",
221bf6
+	loglog(RC_LOG_SERIOUS, "%s: %s", prefix,
221bf6
 		    nss_err_str(node->error));
221bf6
 
221bf6
 	if (node->error == SEC_ERROR_REVOKED_CERTIFICATE) {
221bf6
@@ -298,18 +298,18 @@
221bf6
 	cvout[1].value.pointer.chain = NULL;
221bf6
 	cvout[2].type = cert_po_end;
221bf6
 
221bf6
-	int fin;
221bf6
+	int fin = VERIFY_RET_FAIL;
221bf6
 
221bf6
 #ifdef NSS_IPSEC_PROFILE
221bf6
 	SECStatus rv = CERT_PKIXVerifyCert(end_cert, certificateUsageIPsec,
221bf6
 						cvin, cvout, NULL);
221bf6
 	if (rv != SECSuccess || cur_log->count > 0) {
221bf6
 		if (cur_log->count > 0 && cur_log->head != NULL) {
221bf6
-			fin = nss_err_to_revfail(cur_log->head);
221bf6
+			fin = nss_err_to_revfail("warning", cur_log->head);
221bf6
 		} else {
221bf6
 			/*
221bf6
 			 * An rv != SECSuccess without CERTVerifyLog
221bf6
-			 * results should not * happen, but catch it anyway
221bf6
+			 * results should not happen, but catch it anyway
221bf6
 			 */
221bf6
 			loglog(RC_LOG_SERIOUS, "X509: unspecified NSS verification failure");
221bf6
 			fin = VERIFY_RET_FAIL;
221bf6
@@ -319,7 +319,11 @@
221bf6
 		*end_out = end_cert;
221bf6
 		fin = VERIFY_RET_OK;
221bf6
 	}
221bf6
-#else
221bf6
+#endif
221bf6
+
221bf6
+	if (fin != VERIFY_RET_OK)
221bf6
+	{
221bf6
+
221bf6
 	/* kludge alert!!
221bf6
 	 * verification may be performed twice: once with the
221bf6
 	 * 'client' usage and once with 'server', which is an NSS
221bf6
@@ -348,7 +352,8 @@
221bf6
 					cvout[1].value.pointer.chain = NULL;
221bf6
 					continue;
221bf6
 				} else {
221bf6
-					fin = nss_err_to_revfail(cur_log->head);
221bf6
+					fin = nss_err_to_revfail("ERROR", cur_log->head);
221bf6
+					loglog(RC_LOG_SERIOUS, "X509: verification failure using NSS TLS profile validation");
221bf6
 				}
221bf6
 			} else {
221bf6
 				/*
221bf6
@@ -365,7 +370,9 @@
221bf6
 		}
221bf6
 		break;
221bf6
 	}
221bf6
-#endif
221bf6
+
221bf6
+	}
221bf6
+
221bf6
 	pexpect(fin != 0);
221bf6
 
221bf6
 	CERT_DestroyCertList(trustcl);