[evolution-ews/evolution-ews-3-12] Bug #730042 - Autodiscover XML can contain multiple Protocol elements
- From: Fabiano Fidêncio <ffidencio src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/evolution-ews-3-12] Bug #730042 - Autodiscover XML can contain multiple Protocol elements
- Date: Mon, 19 May 2014 20:38:51 +0000 (UTC)
commit 3874c2416ca7ffd7db1e9fc703a47c51bf787725
Author: Nathan Caza <mastercactapus gmail com>
Date: Mon May 19 15:21:34 2014 +0200
Bug #730042 - Autodiscover XML can contain multiple Protocol elements
src/server/e-ews-connection.c | 49 ++++++++++++++++++++++++++++++++--------
src/server/e-ews-connection.h | 10 --------
2 files changed, 39 insertions(+), 20 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 17dddb0..eed2b8b 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -126,6 +126,7 @@ static guint notification_key = 1;
typedef struct _EwsNode EwsNode;
typedef struct _EwsAsyncData EwsAsyncData;
typedef struct _EwsEventsAsyncData EwsEventsAsyncData;
+typedef struct _EwsUrls EwsUrls;
struct _EwsAsyncData {
GSList *items_created;
@@ -156,6 +157,16 @@ struct _EwsNode {
gulong cancel_handler_id;
};
+struct _EwsUrls {
+ xmlChar *as_url;
+ xmlChar *oab_url;
+
+ /* all the below variables are for future use */
+ xmlChar *oof_url;
+ gpointer future1;
+ gpointer future2;
+};
+
/* Forward Declarations */
static void e_ews_connection_authenticator_init
(ESourceAuthenticatorInterface *iface);
@@ -426,11 +437,19 @@ autodiscover_parse_protocol (xmlNode *node,
for (node = node->children; node; node = node->next) {
if (node->type == XML_ELEMENT_NODE &&
!strcmp ((gchar *) node->name, "ASUrl")) {
- urls->as_url = (gchar *) xmlNodeGetContent (node);
+ if (urls->as_url != NULL)
+ xmlFree (urls->as_url);
+
+ urls->as_url = xmlNodeGetContent (node);
} else if (node->type == XML_ELEMENT_NODE &&
- !strcmp ((gchar *) node->name, "OABUrl"))
- urls->oab_url = (gchar *) xmlNodeGetContent (node);
+ !strcmp ((gchar *) node->name, "OABUrl")) {
+ if (urls->oab_url != NULL)
+ xmlFree (urls->oab_url);
+
+ urls->oab_url = xmlNodeGetContent (node);
+ }
+ /* Once we find both, we can stop looking for the URLs */
if (urls->as_url && urls->oab_url)
return TRUE;
}
@@ -2510,13 +2529,19 @@ autodiscover_response_cb (SoupSession *session,
if (node->type == XML_ELEMENT_NODE &&
!strcmp ((gchar *) node->name, "Protocol")) {
success = autodiscover_parse_protocol (node, urls);
- break;
+ /* Since the server may send back multiple <Protocol> nodes
+ * don't break unless we found the both URLs.
+ */
+ if (success)
+ break;
}
}
if (!success) {
- g_free (urls->as_url);
- g_free (urls->oab_url);
+ if (urls->as_url != NULL)
+ xmlFree (urls->as_url);
+ if (urls->oab_url != NULL)
+ xmlFree (urls->oab_url);
g_free (urls);
g_set_error (
&error, EWS_CONNECTION_ERROR, -1,
@@ -2533,11 +2558,15 @@ autodiscover_response_cb (SoupSession *session,
}
}
- ad->as_url = urls->as_url;
- urls->as_url = NULL;
+ if (urls->as_url != NULL) {
+ ad->as_url = g_strdup ((gchar *) urls->as_url);
+ xmlFree (urls->as_url);
+ }
- ad->oab_url = urls->oab_url;
- urls->oab_url = NULL;
+ if (urls->oab_url != NULL) {
+ ad->oab_url = g_strdup ((gchar *) urls->oab_url);
+ xmlFree (urls->oab_url);
+ }
g_free (urls);
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 300c1d4..2670e97 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -113,16 +113,6 @@ typedef enum {
} EEwsBodyType;
typedef struct {
- gchar *as_url;
- gchar *oab_url;
-
- /* all the below variables are for future use */
- gchar *oof_url;
- gpointer future1;
- gpointer future2;
-} EwsUrls;
-
-typedef struct {
gchar *id;
gchar *dn;
gchar *name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]