aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/exchange-operations
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2006-01-27 20:02:57 +0800
committerSushma Rai <rsushma@src.gnome.org>2006-01-27 20:02:57 +0800
commit89c42a519884edd815dff38dd8530b7403f350d1 (patch)
treeea767555b7c2caf89cc75c837a8502aef254d027 /plugins/exchange-operations
parent2901122f9bef449cbbce0befeacb6bdcf9ee9a18 (diff)
downloadgsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar.gz
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar.bz2
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar.lz
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar.xz
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.tar.zst
gsoc2013-evolution-89c42a519884edd815dff38dd8530b7403f350d1.zip
Corrected the memory corruption in forming the URIs. Fixes #328304.
svn path=/trunk/; revision=31323
Diffstat (limited to 'plugins/exchange-operations')
-rw-r--r--plugins/exchange-operations/ChangeLog10
-rw-r--r--plugins/exchange-operations/exchange-calendar.c38
-rw-r--r--plugins/exchange-operations/exchange-contacts.c32
3 files changed, 59 insertions, 21 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index f8eb7544af..ba99313d19 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,13 @@
+2006-01-27 Sushma Rai <rsushma@novell.com>
+
+ * exchange-calendar.c (e_exchange_calendar_commit): Freeing uri_text
+ in case of OFFLINE mode.
+ Instead of terminating memory allocated string tmpruri and using it,
+ forming the URI string from the EUri and appending the path.
+
+ * exchange-contacts.c (e_exchange_contacts_commit): Similar.
+ Fixes #328304.
+
2006-01-24 Sushma Rai <rsushma@novell.com>
* exchange-config-listener.c (exchange_config_listener_authenticate):
diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c
index c5a3ae9d27..7dfc767222 100644
--- a/plugins/exchange-operations/exchange-calendar.c
+++ b/plugins/exchange-operations/exchange-calendar.c
@@ -337,8 +337,10 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
}
status = exchange_is_offline (&offline_status);
- if (offline_status == OFFLINE_MODE || status != CONFIG_LISTENER_STATUS_OK)
+ if (offline_status == OFFLINE_MODE || status != CONFIG_LISTENER_STATUS_OK) {
+ g_free (uri_text);
return;
+ }
account = exchange_operations_get_exchange_account ();
username = exchange_account_get_username (account);
@@ -359,19 +361,38 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
/* FIXME: This one would ever occur? */
ftype = g_strdup ("mail");
}
+
gname = (gchar*) e_source_peek_name (source);
gruri = (gchar*) e_source_peek_relative_uri (source);
+
if (calendar_src_exists) {
- gchar *tmpruri, *tmpdelimit;
- tmpruri = g_strdup (gruri);
- tmpdelimit = g_strrstr (tmpruri, "/");
- tmpdelimit[0] = '\0';
- ruri = g_strconcat (tmpruri, "/", gname, NULL);
+ gchar *tmpruri, *uri_string;
+ EUri *euri;
+ int uri_len;
+
+ /* sample uri_string: exchange://user;auth=NTLM@host/ */
+ /* sample uri_text: exchange://user;auth=NTLM@host/;personal/Calendar */
+
+ euri = e_uri_new (uri_text);
+ uri_string = e_uri_to_string (euri, FALSE);
+ e_uri_free (euri);
+
+ /* sample gruri: user;auth=NTLM@host/;personal/Calendar */
+ /* sample ruri: user;auth=NTLM@host/personal/Calendar */
+ /* sample path: /personal/Calendar */
+
+ uri_len = strlen (uri_string) + 1;
+ tmpruri = g_strdup (uri_string + strlen ("exchange://"));
+ ruri = g_strconcat (tmpruri, uri_text + uri_len, NULL);
+ path = g_build_filename ("/", uri_text + uri_len, NULL);
+ oldpath = g_build_filename ("/", calendar_old_source_uri + prefix_len, NULL);
+ g_free (uri_string);
g_free (tmpruri);
}
else {
ruri = g_strconcat (gruri, "/", gname, NULL);
+ path = g_build_filename ("/", ruri+prefix_len, NULL);
}
e_source_set_relative_uri (source, ruri);
e_source_set_property (source, "username", username);
@@ -379,16 +400,13 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
if (authtype)
e_source_set_property (source, "auth-type", authtype);
e_source_set_property (source, "auth", "1");
-
- path = g_build_filename ("/", ruri+prefix_len, NULL);
if (!calendar_src_exists) {
/* Create the new folder */
result = exchange_account_create_folder (account, path, ftype);
}
- else if (gruri && strcmp (gruri, calendar_old_source_uri)) {
+ else if (gruri && strcmp (gruri, calendar_old_source_uri) && strcmp (path, oldpath)) {
/* Rename the folder */
- oldpath = g_build_filename ("/", calendar_old_source_uri+prefix_len, NULL);
result = exchange_account_xfer_folder (account, oldpath, path, TRUE);
exchange_operations_update_child_esources (source,
calendar_old_source_uri,
diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c
index b428b6b032..46ab1f8f7a 100644
--- a/plugins/exchange-operations/exchange-contacts.c
+++ b/plugins/exchange-operations/exchange-contacts.c
@@ -321,12 +321,13 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target)
g_free (uri_text);
return ;
}
- g_free (uri_text);
exchange_config_listener_get_offline_status (exchange_global_config_listener,
&offline_status);
- if (offline_status == OFFLINE_MODE)
+ if (offline_status == OFFLINE_MODE) {
+ g_free (uri_text);
return;
+ }
account = exchange_operations_get_exchange_account ();
username = exchange_account_get_username (account);
@@ -338,17 +339,29 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target)
gname = (gchar*) e_source_peek_name (source);
gruri = (gchar*) e_source_peek_relative_uri (source);
+
if (contacts_src_exists) {
- gchar *tmpruri, *tmpdelimit;
- tmpruri = g_strdup (gruri);
- tmpdelimit = g_strrstr (tmpruri, "/");
- tmpdelimit[0] = '\0';
- ruri = g_strconcat (tmpruri, "/", gname, NULL);
+ gchar *tmpruri, *uri_string;
+ EUri *euri;
+ int uri_len;
+
+ euri = e_uri_new (uri_text);
+ uri_string = e_uri_to_string (euri, FALSE);
+ e_uri_free (euri);
+
+ uri_len = strlen (uri_string) + 1;
+ tmpruri = g_strdup (uri_string + strlen ("exchange://"));
+ ruri = g_strconcat (tmpruri, uri_text + uri_len, NULL);
+ path = g_build_filename ("/", uri_text + uri_len, NULL);
+ oldpath = g_build_filename ("/", contacts_old_src_uri + prefix_len, NULL);
+ g_free (uri_string);
g_free (tmpruri);
}
else {
ruri = g_strconcat (gruri, "/", gname, NULL);
+ path = g_build_filename ("/", ruri+prefix_len, NULL);
}
+
e_source_set_relative_uri (source, ruri);
e_source_set_property (source, "username", username);
e_source_set_property (source, "auth-domain", "Exchange");
@@ -356,15 +369,12 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target)
e_source_set_property (source, "auth-type", authtype);
e_source_set_property (source, "auth", "plain/password");
- path = g_strdup_printf ("/%s", ruri+prefix_len);
-
if (!contacts_src_exists) {
/* Create the new folder */
result = exchange_account_create_folder (account, path, "contacts");
}
- else if (strcmp (gruri, contacts_old_src_uri)) {
+ else if (gruri && strcmp (gruri, contacts_old_src_uri) && strcmp (path, oldpath)) {
/* Rename the folder */
- oldpath = g_strdup_printf ("/%s", contacts_old_src_uri+prefix_len);
result = exchange_account_xfer_folder (account, oldpath, path, TRUE);
exchange_operations_update_child_esources (source,
contacts_old_src_uri,