fix broken ssh public key handling
- make sure that AddSshPublicKeyForm does not try to parse the key if it is None - split the key text into a maximum of 3 parts to allow whitespace in comments - update changelog
This commit is contained in:
parent
dd38edd498
commit
25b5b82a06
3 changed files with 13 additions and 11 deletions
|
@ -528,9 +528,9 @@ class SshPublicKeyManager(models.Manager):
|
|||
if 'comment' in headers:
|
||||
comment = headers['comment']
|
||||
else:
|
||||
parts = keytext.split()
|
||||
if len(parts) > 3:
|
||||
raise ValueError("unsupported key format")
|
||||
parts = keytext.split(None, 2)
|
||||
if len(parts) < 2:
|
||||
raise ValueError('invalid SSH public key')
|
||||
data = parts[1]
|
||||
comment = len(parts) == 3 and parts[2] or ""
|
||||
keybytes = base64.b64decode(data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue