summaryrefslogtreecommitdiffstats
path: root/ipaplatform
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-10-06 13:54:33 +0200
committerMartin Basti <mbasti@redhat.com>2015-10-22 18:34:46 +0200
commiteab334dde8e3f94fcf1fca0d111b5121e26c1f4f (patch)
tree0e68560a9a7bfb89204bc78e34b7d95adc59fdc6 /ipaplatform
parent92a4b18fc282ab7b40899c4885617fc080e9e955 (diff)
downloadfreeipa-eab334dde8e3f94fcf1fca0d111b5121e26c1f4f.tar.gz
freeipa-eab334dde8e3f94fcf1fca0d111b5121e26c1f4f.tar.xz
freeipa-eab334dde8e3f94fcf1fca0d111b5121e26c1f4f.zip
Handle binascii.Error from base64.b64decode()
In Python 3, the base64.b64decode function raises binascii.Error (a ValueError subclass) when it finds incorrect padding. In Python 2 it raises TypeError. Callers should usually handle ValueError; unless they are specifically concerned with handling base64 padding issues). In some cases, callers should handle ValueError: - ipalib.pkcs10 (get_friendlyname, load_certificate_request): callers should handle ValueError - ipalib.x509 (load_certificate*, get_*): callers should handle ValueError In other cases ValueError is handled: - ipalib.parameters - ipapython.ssh - ipalib.rpc (json_decode_binary - callers already expect ValueError) - ipaserver.install.ldapupdate Elsewhere no error handling is done, because values come from trusted sources, or are pre-validated: - vault plugin - ipaserver.install.cainstance - ipaserver.install.certs - ipaserver.install.ipa_otptoken_import Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipaplatform')
-rw-r--r--ipaplatform/redhat/tasks.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index 446e2886e..94d2cb4e9 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -210,7 +210,7 @@ class RedHatTaskNamespace(BaseTaskNamespace):
issuer = x509.get_der_issuer(cert, x509.DER)
serial_number = x509.get_der_serial_number(cert, x509.DER)
public_key_info = x509.get_der_public_key_info(cert, x509.DER)
- except (NSPRError, PyAsn1Error) as e:
+ except (NSPRError, PyAsn1Error, ValueError) as e:
root_logger.warning(
"Failed to decode certificate \"%s\": %s", nickname, e)
continue