mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
fix suspicious except statements
The "except ValueError as UnicodeDecodeError" looks very suspicious. Commit change except to catch both exceptions. https://fedorahosted.org/freeipa/ticket/5718 Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
parent
3c519951c5
commit
2c8e100c73
@ -1798,7 +1798,7 @@ def update_ssh_keys(server, hostname, ssh_dir, create_sshfp):
|
||||
continue
|
||||
try:
|
||||
pubkey = SSHPublicKey(line)
|
||||
except ValueError as UnicodeDecodeError:
|
||||
except (ValueError, UnicodeDecodeError):
|
||||
continue
|
||||
root_logger.info("Adding SSH public key from %s", filename)
|
||||
pubkeys.append(pubkey)
|
||||
|
@ -278,13 +278,13 @@ def normalize_sshpubkey(value):
|
||||
def validate_sshpubkey(ugettext, value):
|
||||
try:
|
||||
SSHPublicKey(value)
|
||||
except ValueError as UnicodeDecodeError:
|
||||
except (ValueError, UnicodeDecodeError):
|
||||
return _('invalid SSH public key')
|
||||
|
||||
def validate_sshpubkey_no_options(ugettext, value):
|
||||
try:
|
||||
pubkey = SSHPublicKey(value)
|
||||
except ValueError as UnicodeDecodeError:
|
||||
except (ValueError, UnicodeDecodeError):
|
||||
return _('invalid SSH public key')
|
||||
|
||||
if pubkey.has_options():
|
||||
@ -304,7 +304,7 @@ def convert_sshpubkey_post(ldap, dn, entry_attrs):
|
||||
for pubkey in pubkeys:
|
||||
try:
|
||||
pubkey = SSHPublicKey(pubkey)
|
||||
except ValueError as UnicodeDecodeError:
|
||||
except (ValueError, UnicodeDecodeError):
|
||||
continue
|
||||
|
||||
fp = pubkey.fingerprint_hex_md5()
|
||||
|
Loading…
Reference in New Issue
Block a user