GNOME Bugzilla – Bug 730042
Autodiscover XML can contain multiple Protocol elements
Last modified: 2014-05-30 13:53:35 UTC
Created attachment 276423 [details] Example XML response Evolution reports "Failed to find ASUrl and OABUrl in autodiscover response" when trying to use an exchange account. This happens when the first <Protocol> node does not contain <ASUrl> in the server response.
Created attachment 276424 [details] [review] proposed patch
Nice catch, I didn't know it can return multiple Protocol nodes. Looking around the code, the autodiscover_parse_protocol() also needs fixing, in case the two Protocol elements contain the same searched element the previous is leaked. Also the xmlNodeGetContent() returns pointer which should be freed with xmlFree(), not with g_free() as is done now. Nathan, could you extend the patch, please? Or I can tell Fidencio and he'll do it for you, as the found issues are not caused by your change, but are in the code for some time already.
Review of attachment 276424 [details] [review]: I'm accepting the patch, the followup work will be merged and the change will be credited to you, Nathan.
Okay, about the followup work: 1) I'm changing the EwsUrls::*_url to xmlChar instead of gchar. 2) I'm not doing the same changes in struct _autodiscover_data::*_url because it's used elsewhere as gchar and I don't want to change it anywhere else. 3) I'm g_strdup()'ing the EwsUrls::*_url when attributing it to struct _autodiscover_data::*_url, because I do believe the memory management will be clearer 4) autodiscover_parse_protocol() returns TRUE *only* when EwsUrls::as_url and EwsUrls:oab_url are found, but as it was before, it's considering that we can have both elements in different <Protocol> nodes.
Created attachment 276771 [details] [review] Bug #730042 - Autodiscover XML can contain multiple Protocol elements
Review of attachment 276771 [details] [review]: The patch extension looks fine, thanks for it. Just add the checks below and commit both to master and stable. Thanks. ::: src/server/e-ews-connection.c @@ +2540,3 @@ if (!success) { + xmlFree (urls->as_url); + xmlFree (urls->oab_url); There is no indication they allow NULL for the argument.
Created attachment 276801 [details] [review] Bug #730042 - Autodiscover XML can contain multiple Protocol elements
Pushed! Master (3.13.2+) and Stable (3.12.3+).
(In reply to comment #2) > Nice catch, I didn't know it can return multiple Protocol nodes. For what it is worth, all our test servers return multiple Protocol nodes but they have the OABUrl and ASUrl in the first node.
(In reply to comment #9) > For what it is worth, all our test servers return multiple Protocol nodes but > they have the OABUrl and ASUrl in the first node. To add: It may have something to do with: <Type>EXPR</Type> vs <Type>EXCH</Type> and which one happens to come first, but I couldn't get enough data to determine that from work (kept getting sent to the same backend) Thanks Fabiano and Milan for the work and credit on this :)