diff options
author | Milan Crha <mcrha@redhat.com> | 2015-07-28 07:27:38 +0200 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-07-28 07:27:38 +0200 |
commit | 771f1e3f1fc29bb9168534624ff352384ac37d5e (patch) | |
tree | 9c3ae31d172b03bef071224ebd394448191a0ec9 /addressbook | |
parent | bf9b280e4881ace8bef5a9fc0a7b262644a08cbf (diff) | |
download | evolution-data-server-771f1e3f1fc29bb9168534624ff352384ac37d5e.tar.gz |
Bug 722270 - Crash under WebDAV's send_propfind()
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/backends/webdav/e-book-backend-webdav.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c index f5ceb06ef..b84cc6d17 100644 --- a/addressbook/backends/webdav/e-book-backend-webdav.c +++ b/addressbook/backends/webdav/e-book-backend-webdav.c @@ -574,7 +574,8 @@ parse_propfind_response (xmlTextReaderPtr reader) static SoupMessage * send_propfind (EBookBackendWebdav *webdav, - GCancellable *cancellable) + GCancellable *cancellable, + GError **error) { SoupMessage *message; EBookBackendWebdavPrivate *priv = webdav->priv; @@ -583,6 +584,11 @@ send_propfind (EBookBackendWebdav *webdav, "<propfind xmlns=\"DAV:\"><prop><getetag/></prop></propfind>"; message = soup_message_new (SOUP_METHOD_PROPFIND, priv->uri); + if (!message) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Malformed URI: %s"), priv->uri); + return NULL; + } + soup_message_headers_append (message->request_headers, "User-Agent", USERAGENT); soup_message_headers_append (message->request_headers, "Connection", "close"); soup_message_headers_append (message->request_headers, "Depth", "1"); @@ -830,7 +836,15 @@ download_contacts (EBookBackendWebdav *webdav, _("Loading Addressbook summary...")); } - message = send_propfind (webdav, cancellable); + message = send_propfind (webdav, cancellable, error); + if (!message) { + g_free (new_ctag); + if (book_view) + e_data_book_view_notify_progress (book_view, -1, NULL); + g_mutex_unlock (&priv->update_lock); + return FALSE; + } + status = message->status_code; if (status == SOUP_STATUS_UNAUTHORIZED || @@ -1223,7 +1237,9 @@ book_backend_webdav_test_can_connect (EBookBackendWebdav *webdav, g_return_val_if_fail (E_IS_BOOK_BACKEND_WEBDAV (webdav), FALSE); /* Send a PROPFIND to test whether user/password is correct. */ - message = send_propfind (webdav, cancellable); + message = send_propfind (webdav, cancellable, error); + if (!message) + return FALSE; switch (message->status_code) { case SOUP_STATUS_OK: |