[evolution-ews/evolution-ews-3-12] SOUP_STATUS_IS_SUCCESSFUL(soup_session_send_message()) sends message twice



commit 49553b8a602cfa227bc1bf5dbcaca30443c48e45
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.
    
    (cherry picked from commit aa4f35dee7b04f7f858c17e728cbd6b0fd938984)

 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 71e58a8..2198978 100644
--- a/src/server/e-ews-notification.c
+++ b/src/server/e-ews-notification.c
@@ -358,8 +358,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;
        }
@@ -443,8 +443,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;
        }
@@ -723,8 +723,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]