[evolution-patches] patches for ssl enabling gw cal and addressbook backends



Hi,
Attached are small patches for ssl enabling of the groupwise
cal/contacts backends. Both backends read the use_ssl property from
e-source and uses the http or https prefixes in uri depending upon
whether ssl is there or not. When use_ssl value is  "when_possible" both
try first with https and then wiht http if that fails.

Thans,
Siva
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.173
diff -u -r1.173 ChangeLog
--- ChangeLog	3 Jul 2004 13:04:57 -0000	1.173
+++ ChangeLog	9 Jul 2004 14:46:33 -0000
@@ -1,3 +1,13 @@
+2004-07-09  Sivaiah Nallagatla <snallagatla novell com>
+	
+	* backends/groupwise/e-book-backend-groupwise.c 
+	(e_book_backend_groupwise_load_source) : read the "use_ssl"
+	property from ESource and form the uri accrodingly
+	(e_book_backend_groupwise_authenticate_user) : when "use_ssl" is 
+	"when-posible", try with https first and then http if that fails.
+	(e_book_backend_groupwise_init) (e_book_backend_groupwise_dispose) :
+	initialize and free the newly added priv member use_ssl
+
 2004-07-03  Sivaiah Nallagatla <snallagatla novell com>
 
 	* backends/groupwise/e-book-backend-groupwise.c 
Index: backends/groupwise/e-book-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/groupwise/e-book-backend-groupwise.c,v
retrieving revision 1.24
diff -u -r1.24 e-book-backend-groupwise.c
--- backends/groupwise/e-book-backend-groupwise.c	3 Jul 2004 13:04:57 -0000	1.24
+++ backends/groupwise/e-book-backend-groupwise.c	9 Jul 2004 14:46:33 -0000
@@ -45,6 +45,7 @@
 	char *summary_file_name;
 	EBookBackendSummary *summary;
 	gboolean is_summary_ready;
+	char *use_ssl;
 };
 
 #define ELEMENT_TYPE_SIMPLE 0x01
@@ -1993,16 +1994,24 @@
 	EBookBackendGroupwisePrivate *priv;
 	char *id;
 	int status;
+	char *http_uri;
 	gboolean is_writable;
+	
 
 	ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
 	priv = ebgw->priv;
   
 	priv->cnc = e_gw_connection_new (priv->uri, user, passwd);
-	if (priv->cnc == NULL) {
+	if (!E_IS_GW_CONNECTION(priv->cnc) && priv->use_ssl && g_str_equal (priv->use_ssl, "when-possible")) {
+		http_uri = g_strconcat ("http://";, priv->uri + 8, NULL);
+		priv->cnc = e_gw_connection_new (http_uri, user, passwd);
+		g_free (http_uri);
+	}
+	if (!E_IS_GW_CONNECTION(priv->cnc)) {
 		e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_AuthenticationFailed);
 		return;
 	}
+	
 	id = NULL;
 	is_writable = FALSE;
 	status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable); 
@@ -2087,6 +2096,7 @@
    	const char *port;
 	EUri *parsed_uri;
 	int i;
+	const char *use_ssl;
 
 	ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
 	priv = ebgw->priv;
@@ -2106,8 +2116,12 @@
 	port = e_source_get_property (source, "port");
 	if (port == NULL)
 		port = "7181";
-       
-	priv->uri = g_strconcat ("http://";, parsed_uri->host,":", port, "/soap", NULL );
+	use_ssl = e_source_get_property (source, "use_ssl");
+	if (use_ssl) 
+		priv->uri = g_strconcat ("https://";, parsed_uri->host,":", port, "/soap", NULL );
+	else 
+		priv->uri = g_strconcat ("http://";, parsed_uri->host,":", port, "/soap", NULL );
+	priv->use_ssl = g_strdup (use_ssl);
 	priv->only_if_exists = only_if_exists;
 	
 	
@@ -2224,6 +2238,9 @@
 			g_object_unref (bgw->priv->summary);
 			bgw->priv->summary = NULL;
 		}
+		if (bgw->priv->use_ssl) {
+			g_free (bgw->priv->use_ssl);
+		}
 		g_free (bgw->priv);
 		bgw->priv = NULL;
 	}
@@ -2274,7 +2291,8 @@
 	priv->categories_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 	priv->is_writable = TRUE;
 	priv->is_summary_ready = FALSE;
-	backend->priv = priv;
+	priv->use_ssl = NULL;
+       	backend->priv = priv;
 	
 }
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.293
diff -u -r1.293 ChangeLog
--- ChangeLog	5 Jul 2004 06:21:48 -0000	1.293
+++ ChangeLog	9 Jul 2004 14:50:06 -0000
@@ -1,3 +1,11 @@
+2004-07-09  Sivaiah Nallagatla   <snallagatla novell com>
+
+	* backends/groupwise/e-cal-backend-groupwise.c
+	(form_uri) : read "use_ssl" property from the ESource
+	and form the uri accordingly
+	(connect_to_server) : when "use_ssl" is "when-possible"
+	try with https first and then with http if that fails
+
 2004-06-28  Chenthill Palanisamy <pchenthill novell com>
 	
 	Fixes #60463
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.73
diff -u -r1.73 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	5 Jul 2004 06:21:48 -0000	1.73
+++ backends/groupwise/e-cal-backend-groupwise.c	9 Jul 2004 14:50:06 -0000
@@ -187,6 +187,8 @@
 	char *uri;
 	const char *port;
 	char *formed_uri;
+	const char *use_ssl;
+	
        	EUri *parsed_uri;
 
 	uri = e_source_get_uri (source);
@@ -200,9 +202,13 @@
        	port = e_source_get_property (source, "port");
 	if (port == NULL)
 		port = "7181";
+	use_ssl = e_source_get_property (source, "use_ssl");
 
-       	formed_uri = g_strconcat ("http://";, parsed_uri->host,":", port, "/soap", NULL );
-
+	if (use_ssl)
+		formed_uri = g_strconcat ("https://";, parsed_uri->host,":", port, "/soap", NULL );
+	else 
+		formed_uri = g_strconcat ("http://";, parsed_uri->host,":", port, "/soap", NULL );
+	
 	g_free (uri);
 	e_uri_free (parsed_uri);
 	return formed_uri;
@@ -216,14 +222,16 @@
 	ECalBackendGroupwisePrivate *priv;
 	EGwConnectionStatus cnc_status;
 	ESource *source;
-
+	const char *use_ssl;
+	char *http_uri;
 	priv = cbgw->priv;
 
 	source = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
 	real_uri = NULL;
 	if (source)
 		real_uri = form_uri (source);
-	
+	use_ssl = e_source_get_property (source, "use_ssl");
+ 
 	if (!real_uri) {
 		e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), _("Invalid server URI"));
 		return GNOME_Evolution_Calendar_NoSuchCal;
@@ -234,6 +242,11 @@
 			priv->username,
 			priv->password);
 
+		if (!E_IS_GW_CONNECTION(priv->cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) {
+			http_uri = g_strconcat ("http://";, real_uri + 8, NULL);
+			priv->cnc = e_gw_connection_new (http_uri, priv->username, priv->password);
+			g_free (http_uri);
+		}
 		g_free (real_uri);
 			
 		/* As of now we are assuming that logged in user has write rights to calender */


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