[evolution-data-server] Bug #671537 - Option to validate SLL certificates with libsoup



commit 969ea449d30be94f92feaa9ae5a18f83e68b2035
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 23 12:09:36 2012 +0200

    Bug #671537 - Option to validate SLL certificates with libsoup

 .../backends/webdav/e-book-backend-webdav.c        |    5 ++++-
 calendar/backends/caldav/e-cal-backend-caldav.c    |    9 +++++++++
 calendar/backends/http/e-cal-backend-http.c        |   12 +++++++++++-
 configure.ac                                       |    2 +-
 4 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index f4efe3c..1e9bc06 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -1369,7 +1369,10 @@ e_book_backend_webdav_open (EBookBackend *backend,
 	priv->cache = e_book_backend_cache_new (filename);
 	g_free (filename);
 
-	session = soup_session_sync_new ();
+	session = soup_session_sync_new_with_options (
+		SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
+		g_strcmp0 (e_source_get_property (source, "ignore-invalid-cert"), "1") != 0,
+		NULL);
 	g_signal_connect (
 		session, "authenticate",
 		G_CALLBACK (soup_authenticate), webdav);
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 57ee693..04e597d 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -2627,6 +2627,15 @@ open_calendar (ECalBackendCalDAV *cbdav,
 
 	g_return_val_if_fail (cbdav != NULL, FALSE);
 
+	if (cbdav->priv->session) {
+		ESource *source = e_backend_get_source (E_BACKEND (cbdav));
+
+		g_object_set (G_OBJECT (cbdav->priv->session),
+			SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
+			g_strcmp0 (e_source_get_property (source, "ignore-invalid-cert"), "1") != 0,
+			NULL);
+	}
+
 	/* set forward proxy */
 	proxy_settings_changed (cbdav->priv->proxy, cbdav->priv);
 
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 46e4ca5..c9e8f08 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -601,8 +601,12 @@ begin_retrieval_cb (ECalBackendHttp *cbhttp)
 	if (!priv->soup_session) {
 		EProxy *proxy;
 		SoupURI *proxy_uri = NULL;
+		ESource *source = e_backend_get_source (E_BACKEND (cbhttp));
 
-		priv->soup_session = soup_session_async_new ();
+		priv->soup_session = soup_session_async_new_with_options (
+			SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
+			g_strcmp0 (e_source_get_property (source, "ignore-invalid-cert"), "1") != 0,
+			NULL);
 
 		g_signal_connect (priv->soup_session, "authenticate",
 				  G_CALLBACK (soup_authenticate), cbhttp);
@@ -790,6 +794,12 @@ e_cal_backend_http_open (ECalBackendSync *backend,
 	e_cal_backend_notify_online (E_CAL_BACKEND (backend), online);
 
 	if (online) {
+		if (priv->soup_session)
+			g_object_set (G_OBJECT (priv->soup_session),
+				SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
+				g_strcmp0 (e_source_get_property (source, "ignore-invalid-cert"), "1") != 0,
+				NULL);
+
 		if (e_source_get_property (source, "auth")) {
 			e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbhttp), TRUE, priv->credentials);
 		} else if (priv->requires_auth && perror && !*perror) {
diff --git a/configure.ac b/configure.ac
index b545a80..10d4ae1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ m4_define([gconf_minimum_version], [2.0.0])		dnl XXX Just a Guess
 m4_define([gnome_keyring_minimum_version], [2.20.1])
 m4_define([goa_minimum_version], [3.1.1])
 m4_define([libxml_minimum_version], [2.0.0])		dnl XXX Just a Guess
-m4_define([libsoup_minimum_version], [2.31.2])
+m4_define([libsoup_minimum_version], [2.37.91])
 m4_define([libgdata_minimum_version], [0.10])
 m4_define([oauth_minimum_version], [0.9.4])
 m4_define([sqlite_minimum_version], [3.5])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]