ac7d03
From 5c84f945e0fe5e41d706fd7f700392214178b6aa Mon Sep 17 00:00:00 2001
ac7d03
From: Simo Sorce <simo@redhat.com>
ac7d03
Date: Wed, 22 Mar 2017 18:25:38 -0400
ac7d03
Subject: [PATCH] Avoid growing FILE ccaches unnecessarily
ac7d03
ac7d03
Related https://pagure.io/freeipa/issue/6775
ac7d03
ac7d03
Signed-off-by: Simo Sorce <simo@redhat.com>
ac7d03
Reviewed-By: Christian Heimes <cheimes@redhat.com>
ac7d03
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
ac7d03
---
ac7d03
 ipapython/session_storage.py | 6 ++++++
ac7d03
 1 file changed, 6 insertions(+)
ac7d03
ac7d03
diff --git a/ipapython/session_storage.py b/ipapython/session_storage.py
ac7d03
index 7fe17fb235614e687a88c090336d3c59a7a24aac..a88f9f7a75c73d4dc753183a100350d197d02199 100644
ac7d03
--- a/ipapython/session_storage.py
ac7d03
+++ b/ipapython/session_storage.py
ac7d03
@@ -104,6 +104,12 @@ def store_data(princ_name, key, value):
ac7d03
     """
ac7d03
     Stores the session cookie in a hidden ccache entry.
ac7d03
     """
ac7d03
+    # FILE ccaches grow every time an entry is stored, so we need
ac7d03
+    # to avoid storing the same entry multiple times.
ac7d03
+    oldvalue = get_data(princ_name, key)
ac7d03
+    if oldvalue == value:
ac7d03
+        return
ac7d03
+
ac7d03
     context = krb5_context()
ac7d03
     principal = krb5_principal()
ac7d03
     ccache = krb5_ccache()
ac7d03
-- 
ac7d03
2.12.1
ac7d03