From 8236cce314ca23ae258687c7c523b08ea0a98879 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 25 May 2007 16:19:02 +0000 Subject: Don't assume the relative URI is non-NULL (#427232). 2007-05-25 Matthew Barnes * addressbook/gui/component/addressbook-component.c (ensure_sources): * addressbook/gui/component/addressbook-migrate.c (ensure_sources): * calendar/gui/migration.c (create_calendar_sources), (create_task_sources), (create_memo_sources): * calendar/gui/tasks-component.c (ensure_sources): * calendar/gui/calendar-component.c (ensure_sources): * calendar/gui/memos-component.c (ensure_sources): * plugins/hula-account-setup/camel-hula-listener.c (remove_esource), (modify_esource): * plugins/groupwise-account-setup/camel-gw-listener.c (remove_esource), (modify_esource): Don't assume the relative URI is non-NULL (#427232). * plugins/exchange-operations/exchange-config-listener.c (exchange_add_autocompletion_folders): Don't assume the absolute URI is non-NULL (#427232). svn path=/trunk/; revision=33577 --- addressbook/ChangeLog | 6 +++ addressbook/gui/component/addressbook-component.c | 7 +++- addressbook/gui/component/addressbook-migrate.c | 7 +++- calendar/ChangeLog | 9 +++++ calendar/gui/calendar-component.c | 7 +++- calendar/gui/memos-component.c | 7 +++- calendar/gui/migration.c | 21 +++++++++-- calendar/gui/tasks-component.c | 7 +++- plugins/exchange-operations/ChangeLog | 5 +++ .../exchange-operations/exchange-config-listener.c | 19 ++++++---- plugins/groupwise-account-setup/ChangeLog | 5 +++ .../groupwise-account-setup/camel-gw-listener.c | 44 ++++++++++------------ plugins/hula-account-setup/ChangeLog | 5 +++ plugins/hula-account-setup/camel-hula-listener.c | 43 ++++++++++----------- 14 files changed, 129 insertions(+), 63 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index c6eaca88f4..040ac32723 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,9 @@ +2007-05-25 Matthew Barnes + + * gui/component/addressbook-component.c (ensure_sources): + * gui/component/addressbook-migrate.c (ensure_sources): + Don't assume the relative URI is non-NULL (#427232). + 2007-05-14 Srinivasa Ragavan ** Fix for bug #424055 from Øystein Gisnås diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index af65240d83..3f20c5f6d8 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -118,7 +118,12 @@ ensure_sources (AddressbookComponent *component) GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { personal_source = source; break; } diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index 70518239ed..18a58a032a 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -472,7 +472,12 @@ create_groups (MigrationContext *context, GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { *personal_source = g_object_ref (source); break; } diff --git a/calendar/ChangeLog b/calendar/ChangeLog index cc5741e111..b96ecdce71 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2007-05-25 Matthew Barnes + + * gui/migration.c (create_calendar_sources), (create_task_sources), + (create_memo_sources): + * gui/tasks-component.c (ensure_sources): + * gui/calendar-component.c (ensure_sources): + * gui/memos-component.c (ensure_sources): + Don't assume the relative URI is non-NULL (#427232). + 2007-05-24 Matthew Barnes ** Fixes part of bug #424562 diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 08ecfb09f3..2eaf22fd88 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -210,7 +210,12 @@ ensure_sources (CalendarComponent *component) GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { personal_source = source; break; } diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index aef826507c..d718f6b4be 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -174,7 +174,12 @@ ensure_sources (MemosComponent *component) GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { personal_source = source; break; } diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c index 65c759ce40..8a95bc3a6a 100644 --- a/calendar/gui/migration.c +++ b/calendar/gui/migration.c @@ -466,7 +466,12 @@ create_calendar_sources (CalendarComponent *component, GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { *personal_source = g_object_ref (source); break; } @@ -562,7 +567,12 @@ create_task_sources (TasksComponent *component, GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { *personal_source = g_object_ref (source); break; } @@ -1070,7 +1080,12 @@ create_memo_sources (MemosComponent *component, GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { *personal_source = g_object_ref (source); break; } diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 0bae3c7c48..723c19d8a7 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -170,7 +170,12 @@ ensure_sources (TasksComponent *component) GSList *s; for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); - if (!strcmp (PERSONAL_RELATIVE_URI, e_source_peek_relative_uri (source))) { + const gchar *relative_uri; + + relative_uri = e_source_peek_relative_uri (source); + if (relative_uri == NULL) + continue; + if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { personal_source = source; break; } diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 259dd47f88..1407b97101 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,8 @@ +2007-05-25 Matthew Barnes + + * exchange-config-listener.c (exchange_add_autocompletion_folders): + Don't assume the absolute URI is non-NULL (#427232). + 2007-05-11 Gilles Dartiguelongue * exchange-folder.c: (org_gnome_exchange_folder_inbox_unsubscribe): diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c index c59b738d1d..8e6c8e5d33 100644 --- a/plugins/exchange-operations/exchange-config-listener.c +++ b/plugins/exchange-operations/exchange-config-listener.c @@ -1248,26 +1248,29 @@ static void exchange_add_autocompletion_folders (GConfClient *gc_client, ExchangeAccount *account) { ESourceList *sl=NULL; - ESourceGroup *group; ESource *source; - GSList *groups, *sources; + GSList *groups; gboolean found_group=FALSE; sl = e_source_list_new_for_gconf (gc_client, CONF_KEY_CONTACTS); groups = e_source_list_peek_groups (sl); for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - group = E_SOURCE_GROUP (groups->data); + ESourceGroup *group = E_SOURCE_GROUP (groups->data); + if (strcmp (e_source_group_peek_name (group), account->account_name) == 0 && strcmp (e_source_group_peek_base_uri (group), EXCHANGE_URI_PREFIX) == 0) { - - sources = e_source_group_peek_sources (group); + GSList *sources = e_source_group_peek_sources (group); for( ; sources != NULL; sources = g_slist_next (sources)) { - source = E_SOURCE (sources->data); - if (g_str_has_prefix (e_source_peek_absolute_uri (source), - "gal://")) { + ESource *source = E_SOURCE (sources->data); + const gchar *absolute_uri; + + absolute_uri = e_source_peek_absolute_uri (source); + if (absolute_uri == NULL) + continue; + if (g_str_has_prefix (absolute_uri, "gal://")) { /* Set autocompletion on GAL alone by default */ e_source_set_property (source, "completion", "true"); break; diff --git a/plugins/groupwise-account-setup/ChangeLog b/plugins/groupwise-account-setup/ChangeLog index a0a75f3106..32b5b08a54 100644 --- a/plugins/groupwise-account-setup/ChangeLog +++ b/plugins/groupwise-account-setup/ChangeLog @@ -1,3 +1,8 @@ +2007-05-25 Matthew Barnes + + * camel-gw-listener.c (remove_esource), (modify_esource): + Don't assume the relative URI is non-NULL (#427232). + 2007-04-01 Matthew Barnes ** Fixes part of bug #373116 diff --git a/plugins/groupwise-account-setup/camel-gw-listener.c b/plugins/groupwise-account-setup/camel-gw-listener.c index 58c46b7bfe..4e5fc3490b 100644 --- a/plugins/groupwise-account-setup/camel-gw-listener.c +++ b/plugins/groupwise-account-setup/camel-gw-listener.c @@ -251,10 +251,7 @@ static void remove_esource (const char *conf_key, const char *group_name, char* source_name, const char* relative_uri) { ESourceList *list; - ESourceGroup *group; - ESource *source; GSList *groups; - GSList *sources; gboolean found_group; GConfClient* client; GSList *ids; @@ -268,19 +265,20 @@ remove_esource (const char *conf_key, const char *group_name, char* source_name, found_group = FALSE; for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); + ESourceGroup *group = E_SOURCE_GROUP (groups->data); if (strcmp (e_source_group_peek_name (group), group_name) == 0 && strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX ) == 0) { - - sources = e_source_group_peek_sources (group); + GSList *sources = e_source_group_peek_sources (group); for( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), relative_uri) == 0) { + ESource *source = E_SOURCE (sources->data); + const gchar *source_relative_uri; + + source_relative_uri = e_source_peek_relative_uri (source); + if (source_relative_uri == NULL) + continue; + if (strcmp (source_relative_uri, relative_uri) == 0) { if (!strcmp (conf_key, CALENDAR_SOURCES)) source_selection_key = SELECTED_CALENDARS; @@ -325,16 +323,12 @@ static void modify_esource (const char* conf_key, GwAccountInfo *old_account_info, const char* new_group_name, CamelURL *new_url) { ESourceList *list; - ESourceGroup *group; - ESource *source; GSList *groups; - GSList *sources; char *old_relative_uri; CamelURL *url; gboolean found_group; GConfClient* client; const char *poa_address; - char *new_relative_uri; const char *new_poa_address; url = camel_url_new (old_account_info->source_url, NULL); @@ -351,20 +345,22 @@ modify_esource (const char* conf_key, GwAccountInfo *old_account_info, const cha found_group = FALSE; for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); + ESourceGroup *group = E_SOURCE_GROUP (groups->data); if (strcmp (e_source_group_peek_name (group), old_account_info->name) == 0 && strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX) == 0) { - - sources = e_source_group_peek_sources (group); + GSList *sources = e_source_group_peek_sources (group); for ( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), old_relative_uri) == 0) { - + ESource *source = E_SOURCE (sources->data); + const gchar *source_relative_uri; + + source_relative_uri = e_source_peek_relative_uri (source); + if (source_relative_uri == NULL) + continue; + if (strcmp (source_relative_uri, old_relative_uri) == 0) { + gchar *new_relative_uri; + new_relative_uri = g_strdup_printf ("%s@%s/", new_url->user, new_poa_address); e_source_group_set_name (group, new_group_name); e_source_set_relative_uri (source, new_relative_uri); diff --git a/plugins/hula-account-setup/ChangeLog b/plugins/hula-account-setup/ChangeLog index 14f86e4aad..6a939b6335 100644 --- a/plugins/hula-account-setup/ChangeLog +++ b/plugins/hula-account-setup/ChangeLog @@ -1,3 +1,8 @@ +2007-05-25 Matthew Barnes + + * camel-hula-listener.c (remove_esource), (modify_esource): + Don't assume the relative URI is non-NULL (#427232). + 2006-09-18 Matthew Barnes * camel-hula-listener.c: (finalize) diff --git a/plugins/hula-account-setup/camel-hula-listener.c b/plugins/hula-account-setup/camel-hula-listener.c index e6e0fe6773..c481778434 100644 --- a/plugins/hula-account-setup/camel-hula-listener.c +++ b/plugins/hula-account-setup/camel-hula-listener.c @@ -241,10 +241,7 @@ static void remove_esource (const char *conf_key, const char *group_name, char* source_name, const char* relative_uri) { ESourceList *list; - ESourceGroup *group; - ESource *source; GSList *groups; - GSList *sources; gboolean found_group; GConfClient* client; GSList *ids; @@ -258,19 +255,20 @@ remove_esource (const char *conf_key, const char *group_name, char* source_name, found_group = FALSE; for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); + ESourceGroup *group = E_SOURCE_GROUP (groups->data); if (strcmp (e_source_group_peek_name (group), group_name) == 0 && strcmp (e_source_group_peek_base_uri (group), HULA_CALDAV_URI_PREFIX ) == 0) { - - sources = e_source_group_peek_sources (group); + GSList *sources = e_source_group_peek_sources (group); for( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), relative_uri) == 0) { + ESource *source = E_SOURCE (sources->data); + const gchar *source_relative_uri; + + source_relative_uri = e_source_peek_relative_uri (source); + if (source_relative_uri == NULL) + continue; + if (strcmp (source_relative_uri, relative_uri) == 0) { if (!strcmp (conf_key, CALENDAR_SOURCES)) source_selection_key = SELECTED_CALENDARS; @@ -311,15 +309,11 @@ static void modify_esource (const char* conf_key, HulaAccountInfo *old_account_info, const char* new_group_name, CamelURL *new_url) { ESourceList *list; - ESourceGroup *group; - ESource *source; GSList *groups; - GSList *sources; char *old_relative_uri; CamelURL *url; gboolean found_group; GConfClient* client; - char *new_relative_uri; url = camel_url_new (old_account_info->source_url, NULL); if (!url->host || strlen (url->host) ==0) @@ -334,19 +328,22 @@ modify_esource (const char* conf_key, HulaAccountInfo *old_account_info, const c for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - group = E_SOURCE_GROUP (groups->data); + ESourceGroup *group = E_SOURCE_GROUP (groups->data); if (strcmp (e_source_group_peek_name (group), old_account_info->name) == 0 && strcmp (e_source_group_peek_base_uri (group), HULA_CALDAV_URI_PREFIX) == 0) { - - sources = e_source_group_peek_sources (group); + GSList *sources = e_source_group_peek_sources (group); for ( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), old_relative_uri) == 0) { - + ESource *source = E_SOURCE (sources->data); + const gchar *source_relative_uri; + + source_relative_uri = e_source_peek_relative_uri (source); + if (source_relative_uri == NULL) + continue; + if (strcmp (source_relative_uri, old_relative_uri) == 0) { + gchar *new_relative_uri; + new_relative_uri = g_strdup_printf ("%s@%s:%d/dav/%s/calendar/Personal", new_url->user, new_url->host, new_url->port, new_url->user); e_source_group_set_name (group, new_group_name); e_source_set_relative_uri (source, new_relative_uri); -- cgit