From 85b2913a380c69f14ae0254ad23b10fabfb33667 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 24 Oct 2008 23:52:05 +0000 Subject: Merge revisions 36534:36684 from trunk. svn path=/branches/kill-bonobo/; revision=36685 --- plugins/exchange-operations/ChangeLog | 25 ++++++++++++ .../exchange-operations/exchange-account-setup.c | 41 ++++++++++++-------- plugins/exchange-operations/exchange-calendar.c | 19 ++++++--- plugins/exchange-operations/exchange-contacts.c | 45 +++++++++++++--------- plugins/exchange-operations/exchange-operations.c | 27 ++++++------- plugins/exchange-operations/exchange-operations.h | 27 ++++++------- 6 files changed, 120 insertions(+), 64 deletions(-) (limited to 'plugins/exchange-operations') diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index b6661445a4..785857400a 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,28 @@ +2008-10-08 Milan Crha + + ** Fix for bug #530606 + + * exchange-contacts.c: (e_exchange_contacts_get_contacts), + (e_exchange_contacts_pcontacts_on_change), + (e_exchange_contacts_pcontacts), (e_exchange_contacts_check), + (e_exchange_contacts_commit): + * exchange-account-setup.c: (btn_chpass_clicked), (btn_dass_clicked), + (btn_fsize_clicked), (org_gnome_exchange_show_folder_size_factory): + * exchange-calendar.c: (e_exchange_calendar_get_calendars), + (e_exchange_calendar_pcalendar_on_change), + (e_exchange_calendar_pcalendar), (e_exchange_calendar_check), + (e_exchange_calendar_commit): + Check validity of returned pointer before using it. + +2008-10-03 Sankar P + +License Changes + + * exchange-account-setup.c: + * exchange-contacts.c: + * exchange-operations.c: + * exchange-operations.h: + 2008-09-24 Sankar P License Changes diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 3e9e64ea6a..275a214b90 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -1,21 +1,23 @@ -/* -*- Mf (id ode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * - * Sushma Rai - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Authors: + * Sushma Rai + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * */ #ifdef HAVE_CONFIG_H @@ -121,6 +123,8 @@ btn_chpass_clicked (GtkButton *button, gpointer data) ExchangeAccountResult result; account = exchange_operations_get_exchange_account (); + if (!account) + return; old_password = exchange_account_get_password (account); if (!old_password) { @@ -147,6 +151,8 @@ btn_dass_clicked (GtkButton *button, gpointer data) { ExchangeAccount *account; account = exchange_operations_get_exchange_account (); + if (!account) + return; exchange_delegates (account, gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW)); } @@ -157,6 +163,8 @@ btn_fsize_clicked (GtkButton *button, gpointer data) GtkListStore *model; account = exchange_operations_get_exchange_account (); + if (!account) + return; model = exchange_account_folder_size_get_model (account); if (model) @@ -1048,7 +1056,10 @@ org_gnome_exchange_show_folder_size_factory (EPlugin *epl, EConfigHookItemFactor if (g_ascii_strcasecmp (provider->protocol, "exchange")) return NULL; - account = exchange_operations_get_exchange_account (); + account = exchange_operations_get_exchange_account (); + if (!account) + return NULL; + exchange_account_is_offline (account, &mode); if (mode == OFFLINE_MODE) return NULL; diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c index c871f68d77..ef0eaaef79 100644 --- a/plugins/exchange-operations/exchange-calendar.c +++ b/plugins/exchange-operations/exchange-calendar.c @@ -81,6 +81,8 @@ e_exchange_calendar_get_calendars (ECalSourceType ftype) } account = exchange_operations_get_exchange_account (); + if (!account) + return NULL; /* FIXME: Reconsider this hardcoding */ uri_prefix = g_strconcat ("exchange://", account->account_filename, "/;", NULL); @@ -121,6 +123,8 @@ e_exchange_calendar_pcalendar_on_change (GtkTreeView *treeview, ESource *source) gchar *es_ruri, *ruri; account = exchange_operations_get_exchange_account (); + if (!account) + return; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); gtk_tree_selection_get_selected(selection, &model, &iter); @@ -249,9 +253,12 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) callist = e_exchange_calendar_get_calendars (t->source_type); - for (i=0; ilen; ++i) { - ruri = g_ptr_array_index (callist, i); - exchange_operations_cta_add_node_to_tree (ts_pcalendar, NULL, ruri); + if (callist) { + for (i = 0; i < callist->len; i++) { + ruri = g_ptr_array_index (callist, i); + exchange_operations_cta_add_node_to_tree (ts_pcalendar, NULL, ruri); + } + g_ptr_array_free (callist, TRUE); } cr_calendar = gtk_cell_renderer_text_new (); @@ -296,7 +303,6 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) g_free (sruri); } - g_ptr_array_free (callist, TRUE); g_object_unref (ts_pcalendar); return tv_pcalendar; } @@ -337,6 +343,9 @@ e_exchange_calendar_check (EPlugin *epl, EConfigHookPageCheckData *data) } account = exchange_operations_get_exchange_account (); + if (!account) + return FALSE; + uri_text = e_source_get_uri (t->source); euri = e_uri_new (uri_text); uri_string = e_uri_to_string (euri, FALSE); @@ -392,7 +401,7 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target) } account = exchange_operations_get_exchange_account (); - if (!is_exchange_personal_folder (account, uri_text)) + if (!account || !is_exchange_personal_folder (account, uri_text)) return; windows_domain = exchange_account_get_windows_domain (account); diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c index aee5a1889f..5fe233dec0 100644 --- a/plugins/exchange-operations/exchange-contacts.c +++ b/plugins/exchange-operations/exchange-contacts.c @@ -1,21 +1,22 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Praveen Kumar - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Authors: + * Praveen Kumar + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ @@ -69,6 +70,8 @@ e_exchange_contacts_get_contacts (void) gchar *uri_prefix, *ruri; account = exchange_operations_get_exchange_account (); + if (!account) + return NULL; uri_prefix = g_strconcat ("exchange://", account->account_filename, "/;", NULL); prefix_len = strlen (uri_prefix); @@ -107,6 +110,8 @@ e_exchange_contacts_pcontacts_on_change (GtkTreeView *treeview, ESource *source) gchar *ruri; account = exchange_operations_get_exchange_account (); + if (!account) + return; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); gtk_tree_selection_get_selected(selection, &model, &iter); @@ -240,9 +245,12 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) conlist = e_exchange_contacts_get_contacts (); - for (i=0; ilen; ++i) { - ruri = g_ptr_array_index (conlist, i); - exchange_operations_cta_add_node_to_tree (ts_pcontacts, NULL, ruri); + if (conlist) { + for (i = 0; i < conlist->len; i++) { + ruri = g_ptr_array_index (conlist, i); + exchange_operations_cta_add_node_to_tree (ts_pcontacts, NULL, ruri); + } + g_ptr_array_free (conlist, TRUE); } cr_contacts = gtk_cell_renderer_text_new (); @@ -292,7 +300,6 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) g_free (sruri); } - g_ptr_array_free (conlist, TRUE); g_object_unref (ts_pcontacts); return vb_pcontacts; } @@ -328,6 +335,8 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data) } account = exchange_operations_get_exchange_account (); + if (!account) + return FALSE; if (!rel_uri) { GConfClient *client; @@ -423,7 +432,7 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target) } account = exchange_operations_get_exchange_account (); - if (!is_exchange_personal_folder (account, uri_text)) + if (!account || !is_exchange_personal_folder (account, uri_text)) return; windows_domain = exchange_account_get_windows_domain (account); diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c index bbdd26a87f..94240c051a 100644 --- a/plugins/exchange-operations/exchange-operations.c +++ b/plugins/exchange-operations/exchange-operations.c @@ -1,21 +1,22 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Praveen Kumar - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Authors: + * Praveen Kumar + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ diff --git a/plugins/exchange-operations/exchange-operations.h b/plugins/exchange-operations/exchange-operations.h index 52eec141ef..156339f437 100644 --- a/plugins/exchange-operations/exchange-operations.h +++ b/plugins/exchange-operations/exchange-operations.h @@ -1,21 +1,22 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Praveen Kumar - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Authors: + * Praveen Kumar + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ -- cgit v1.2.3