changeset 6082:a3221c686736

changing the sid after checking for collisions defeats the purpose
author Christof Meerwald <cmeerw@cmeerw.org>
date Thu, 06 Feb 2020 19:48:22 +0000
parents 5f275158cfa9
children f74d078cfd9a
files roundup/cgi/client.py
diffstat 1 files changed, 1 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/cgi/client.py	Thu Feb 06 19:03:00 2020 +0000
+++ b/roundup/cgi/client.py	Thu Feb 06 19:48:22 2020 +0000
@@ -185,16 +185,10 @@
     def _gen_sid(self):
         """ generate a unique session key """
         while 1:
-            s = b2s(binascii.b2a_base64(random_.token_bytes(32)).strip())
+            s = b2s(binascii.b2a_base64(random_.token_bytes(32)).strip()).rstrip('=')
             if not self.session_db.exists(s):
                 break
 
-        # clean up the base64
-        if s[-1] == '=':
-            if s[-2] == '=':
-                s = s[:-2]
-            else:
-                s = s[:-1]
         return s
 
     def clean_up(self):

Roundup Issue Tracker: http://roundup-tracker.org/