includes/sessions.php
changeset 292 b3cfaf0a505c
parent 289 2b60c89dc27f
child 304 e2cb5f1432c8
child 311 a007145a0ff6
--- a/includes/sessions.php	Sat Nov 24 13:16:20 2007 -0500
+++ b/includes/sessions.php	Sun Nov 25 17:53:03 2007 -0500
@@ -573,8 +573,16 @@
     // Fetch our decryption key
     
     $aes_key = $this->fetch_public_key($aes_key_id);
-    if(!$aes_key)
+    if ( !$aes_key )
+    {
+      // It could be that our key cache is full. If it seems larger than 65KB, clear it
+      if ( strlen(getConfig('login_key_cache')) > 65000 )
+      {
+        setConfig('login_key_cache', '');
+        return 'It seems that the list of encryption keys used for login information has reached its maximum length, thus preventing new keys from being inserted. The list has been automatically cleared. Please try logging in again; if you are still unable to log in, please contact the site administration.';
+      }
       return 'Couldn\'t look up public key "'.htmlspecialchars($aes_key_id).'" for decryption';
+    }
     
     // Convert the key to a binary string
     $bin_key = hexdecode($aes_key);