[smuxi/release/0.11: 1/2] Engine-JabbR: make use of	CertificateValidator
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [smuxi/release/0.11: 1/2] Engine-JabbR: make use of	CertificateValidator
- Date: Tue, 11 Mar 2014 20:51:42 +0000 (UTC)
commit f140c368b9c14e50e56a03e8927923586403cac3
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Mar 11 21:49:16 2014 +0100
    Engine-JabbR: make use of CertificateValidator
 src/Engine-JabbR/JabbrProtocolManager.cs |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/Engine-JabbR/JabbrProtocolManager.cs b/src/Engine-JabbR/JabbrProtocolManager.cs
index a32874c..26feb73 100644
--- a/src/Engine-JabbR/JabbrProtocolManager.cs
+++ b/src/Engine-JabbR/JabbrProtocolManager.cs
@@ -244,6 +244,20 @@ namespace Smuxi.Engine
                     ToMessage();
             Session.AddMessageToChat(ProtocolChat, msg);
 
+            if (!Server.ValidateServerCertificate) {
+                var whitelist = Session.CertificateValidator.HostnameWhitelist;
+                lock (whitelist) {
+                    var hostname = Server.Hostname;
+                    if (hostname.StartsWith("http://") ||
+                        hostname.StartsWith("https://")) {
+                        hostname = new Uri(hostname).Host;
+                    }
+                    if (!whitelist.Contains(hostname)) {
+                        whitelist.Add(hostname);
+                    }
+                }
+            }
+
             var res = Client.Connect(Server.Username, Server.Password);
             res.Wait();
             // HACK: this event can only be subscribed if we have made an
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]