[evolution-ews] SOUP_STATUS_IS_SUCCESSFUL(soup_session_send_message()) sends message twice
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] SOUP_STATUS_IS_SUCCESSFUL(soup_session_send_message()) sends message twice
- Date: Thu, 24 Jul 2014 13:41:37 +0000 (UTC)
commit aa4f35dee7b04f7f858c17e728cbd6b0fd938984
Author: David Woodhouse <David Woodhouse intel com>
Date: Thu Jul 24 14:33:59 2014 +0100
SOUP_STATUS_IS_SUCCESSFUL(soup_session_send_message()) sends message twice
The definition of SOUP_STATUS_IS_SUCCESSFUL(status) is
((status) >= 200 && (status) < 300)
So if we actually pass the function call as the 'status' parameter of
the macro, it's going to get called twice, and thus the message will
be submitted twice.
This is obviously suboptimal, and it actually breaks with the GSSAPI
hacks, because the second submission just keeps the same Authorization:
header that was on the message last time, and that's seen as a replay
attack by the server.
src/server/e-ews-notification.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/server/e-ews-notification.c b/src/server/e-ews-notification.c
index 6571c97..b844761 100644
--- a/src/server/e-ews-notification.c
+++ b/src/server/e-ews-notification.c
@@ -377,8 +377,8 @@ e_ews_notification_subscribe_folder_sync (EEwsNotification *notification,
return FALSE;
}
- if (!SOUP_STATUS_IS_SUCCESSFUL (
- soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg)))) {
+ soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg));
+ if (!SOUP_STATUS_IS_SUCCESSFUL (SOUP_MESSAGE (msg)->status_code)) {
g_object_unref (msg);
return FALSE;
}
@@ -462,8 +462,8 @@ e_ews_notification_unsubscribe_folder_sync (EEwsNotification *notification,
soup_message_body_set_accumulate (SOUP_MESSAGE (msg)->response_body, TRUE);
- if (!SOUP_STATUS_IS_SUCCESSFUL (
- soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg)))) {
+ soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg));
+ if (!SOUP_STATUS_IS_SUCCESSFUL (SOUP_MESSAGE (msg)->status_code)) {
g_object_unref (msg);
return FALSE;
}
@@ -742,8 +742,8 @@ e_ews_notification_get_events_sync (EEwsNotification *notification,
SOUP_MESSAGE (msg), "got-chunk",
G_CALLBACK (ews_notification_soup_got_chunk), notification);
- ret = SOUP_STATUS_IS_SUCCESSFUL (
- soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg)));
+ soup_session_send_message (notification->priv->soup_session, SOUP_MESSAGE (msg));
+ ret = SOUP_STATUS_IS_SUCCESSFUL (SOUP_MESSAGE (msg)->status_code);
g_signal_handler_disconnect (msg, handler_id);
g_object_unref (msg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]