Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 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 | 380dec305c28 |
| children | f35ca71c9f2e |
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):
