[evolution-patches] patch for #72806 (address book)



Crash is because the id of the contact retunred in
e_data_book_respond_create is NULL. Server returned a NULL id as we
tried to create a contact in read only book. Copy/Move contacts dialog
is not looking for read only nature of books :/

Siva

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.251
diff -u -p -r1.251 ChangeLog
--- ChangeLog	21 Feb 2005 23:37:03 -0000	1.251
+++ ChangeLog	22 Feb 2005 04:24:25 -0000
@@ -1,3 +1,15 @@
+2005-02-22 Sivaiah Nallagatla <snallagatla novell com>
+
+	* backends/groupwise/e-book-backend-groupwise.c 
+	(e_book_backend_groupwise_create_contact) : Return permission denied 
+	error when the book is read only. In case of read/write books
+	Make sure that server returns proper id for created contact.
+	(e_book_backend_groupwise_modify_contact) 
+	(e_book_backend_groupwise_remove_contacts) : Return 
+	permission denied in case of read only book.
+
+	Fixes #72806
+	
 2005-02-19 Sivaiah Nallagatla <snallagatla novell com>
 
 	* libebook/e-vcard.c (e_vcard_remove_attributes) :
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.47
diff -u -p -r1.47 e-book-backend-groupwise.c
--- backends/groupwise/e-book-backend-groupwise.c	17 Feb 2005 10:16:34 -0000	1.47
+++ backends/groupwise/e-book-backend-groupwise.c	22 Feb 2005 04:24:25 -0000
@@ -1126,6 +1126,10 @@ e_book_backend_groupwise_create_contact 
 			e_data_book_respond_create(book, opid, GNOME_Evolution_Addressbook_AuthenticationRequired, NULL);
 			return;
 		}
+		if (!egwb->priv->is_writable) {
+			e_data_book_respond_create(book, opid, GNOME_Evolution_Addressbook_PermissionDenied, NULL);
+			return;
+		}
 		contact = e_contact_new_from_vcard(vcard);
 		item = e_gw_item_new_empty ();
 		e_gw_item_set_item_type (item, e_contact_get (contact, E_CONTACT_IS_LIST) ? E_GW_ITEM_TYPE_GROUP :E_GW_ITEM_TYPE_CONTACT);
@@ -1158,7 +1162,9 @@ e_book_backend_groupwise_create_contact 
 		status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);  
 		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION) 
 			status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);  
-		if (status == E_GW_CONNECTION_STATUS_OK) {
+
+		/* Make sure server has returned  an id for the created contact */
+		if (status == E_GW_CONNECTION_STATUS_OK && id) {
 			e_contact_set (contact, E_CONTACT_UID, id);
 			g_free (id);
 			e_book_backend_cache_add_contact (egwb->priv->cache, contact);
@@ -1199,6 +1205,11 @@ e_book_backend_groupwise_remove_contacts
 			return;
 		}
 		
+		if (!ebgw->priv->is_writable) {
+			e_data_book_respond_remove_contacts (book, opid, GNOME_Evolution_Addressbook_PermissionDenied, NULL);
+			return;
+		}
+		
 		for ( ; id_list != NULL; id_list = g_list_next (id_list)) {
 			id = (char*) id_list->data;
 			e_gw_connection_remove_item (ebgw->priv->cnc, ebgw->priv->container_id, id);
@@ -1287,7 +1298,10 @@ e_book_backend_groupwise_modify_contact 
 			e_data_book_respond_modify (book, opid, GNOME_Evolution_Addressbook_AuthenticationRequired, NULL);
 			return;
 		}
-
+		if (!egwb->priv->is_writable) {
+			e_data_book_respond_modify (book, opid, GNOME_Evolution_Addressbook_PermissionDenied, NULL);
+			return;
+		}
 		contact = e_contact_new_from_vcard(vcard);
 		new_item = e_gw_item_new_empty ();
 


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