Blame SOURCES/0005-proxy-Remove-jsessionid-cookie-when-its-value-is-NUL.patch

51ca4a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
51ca4a
From: Christophe Fergeau <cfergeau@redhat.com>
51ca4a
Date: Mon, 8 Feb 2016 14:50:50 +0100
51ca4a
Subject: [PATCH] proxy: Remove jsessionid cookie when its value is NULL
51ca4a
51ca4a
---
51ca4a
 govirt/ovirt-proxy-private.h | 1 +
51ca4a
 govirt/ovirt-proxy.c         | 6 ++++++
51ca4a
 2 files changed, 7 insertions(+)
51ca4a
51ca4a
diff --git a/govirt/ovirt-proxy-private.h b/govirt/ovirt-proxy-private.h
51ca4a
index 0831785..ab87142 100644
51ca4a
--- a/govirt/ovirt-proxy-private.h
51ca4a
+++ b/govirt/ovirt-proxy-private.h
51ca4a
@@ -37,6 +37,7 @@ struct _OvirtProxyPrivate {
51ca4a
     gboolean admin_mode;
51ca4a
     OvirtApi *api;
51ca4a
     char *jsessionid;
51ca4a
+    SoupCookie *jsessionid_cookie;
51ca4a
     char *sso_token;
51ca4a
 
51ca4a
     SoupCookieJar *cookie_jar;
51ca4a
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
51ca4a
index a5e9251..f289719 100644
51ca4a
--- a/govirt/ovirt-proxy.c
51ca4a
+++ b/govirt/ovirt-proxy.c
51ca4a
@@ -720,12 +720,18 @@ static void ovirt_proxy_set_session_id(OvirtProxy *proxy, const char *session_id
51ca4a
         domain = url;
51ca4a
     }
51ca4a
 
51ca4a
+    if (proxy->priv->jsessionid_cookie != NULL) {
51ca4a
+        soup_cookie_jar_delete_cookie(proxy->priv->cookie_jar,
51ca4a
+                proxy->priv->jsessionid_cookie);
51ca4a
+        proxy->priv->jsessionid_cookie = NULL;
51ca4a
+    }
51ca4a
     g_free(proxy->priv->jsessionid);
51ca4a
     proxy->priv->jsessionid = g_strdup(session_id);
51ca4a
     if (proxy->priv->jsessionid != NULL) {
51ca4a
         SoupCookie *cookie;
51ca4a
         cookie = soup_cookie_new("JSESSIONID", session_id, domain, "/ovirt-engine/api", -1);
51ca4a
         soup_cookie_jar_add_cookie(proxy->priv->cookie_jar, cookie);
51ca4a
+        proxy->priv->jsessionid_cookie = cookie;
51ca4a
     }
51ca4a
     g_free(url);
51ca4a
 }