Changeset - 08af13a090e0
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2020-01-25 19:53:56
mads@kiilerich.com
Grafted from: 68f0e1307d6d
py3: update ssh for base64.b64decode raising binascii.Error instead of TypeError

A command like:
python -c 'import base64; base64.b64decode("QQ")'
would fail in Python2 with:
TypeError: Incorrect padding
but in python3:
binascii.Error: Incorrect padding
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/ssh.py
Show inline comments
 
@@ -87,7 +87,7 @@ def parse_pub_key(ssh_key):
 

	
 
    try:
 
        key_bytes = base64.b64decode(keyvalue)
 
    except TypeError:
 
    except base64.binascii.Error:
 
        raise SshKeyParseError(_("Incorrect SSH key - failed to decode base64 part %r") % keyvalue)
 

	
 
    if not key_bytes.startswith(b'\x00\x00\x00%c%s\x00' % (len(keytype), ascii_bytes(keytype))):
0 comments (0 inline, 0 general)