From f860e835006e8af58eb42add5262cf06332df950 Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Tue, 8 Jan 2019 09:47:14 +0200
Subject: [PATCH] Added debug option to ignore SSL errors
---
.../AcaciaZPushPlugin/GlobalOptions.cs | 8 +++++++
.../ZPush/Connect/ZPushConnection.cs | 23 ++++++++++++-------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs
index 081bff2..dffa13a 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs
@@ -162,6 +162,14 @@ namespace Acacia
}
private static readonly BoolOption RELEASE_ITEM_EVENT_WRAPPERS = new BoolOption("ReleaseItemEventWrappers", true);
+ [AcaciaOption("If enabled, certificate errors from Z-Push servers are ignored silently.")]
+ virtual public bool IgnoreCertificateErrors
+ {
+ get { return GetOption(null, IGNORE_CERTIFICATE_ERRORS); }
+ set { SetOption(null, IGNORE_CERTIFICATE_ERRORS, value); }
+ }
+ private static readonly BoolOption IGNORE_CERTIFICATE_ERRORS = new BoolOption("IgnoreCertificateErrors", false);
+
#region UI Options
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs
index f2e5171..710a81a 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs
@@ -63,15 +63,22 @@ namespace Acacia.ZPush.Connect
bool allow = false;
if (!_allowCertificateErrors.TryGetValue(request.Host, out allow))
{
- ThisAddIn.Instance.InvokeUI(() =>
+ if (GlobalOptions.INSTANCE.IgnoreCertificateErrors)
{
- allow = MessageBox.Show(
- string.Format(Properties.Resources.SSLFailed_Body, request.Host),
- Properties.Resources.SSLFailed_Title,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Error
- ) == DialogResult.Yes;
- });
+ allow = true;
+ }
+ else
+ {
+ ThisAddIn.Instance.InvokeUI(() =>
+ {
+ allow = MessageBox.Show(
+ string.Format(Properties.Resources.SSLFailed_Body, request.Host),
+ Properties.Resources.SSLFailed_Title,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Error
+ ) == DialogResult.Yes;
+ });
+ }
_allowCertificateErrors.Add(request.Host, allow);
}