summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/ldapupdate.py
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 /ipaserver/install/ldapupdate.py
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 'ipaserver/install/ldapupdate.py')
-rw-r--r--ipaserver/install/ldapupdate.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index fd02bdc02..86c011047 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -423,7 +423,7 @@ class LDAPUpdate:
for i, v in enumerate(value):
try:
value[i] = base64.b64decode(v)
- except TypeError as e:
+ except (TypeError, ValueError) as e:
raise BadSyntax(
"Base64 encoded value %s on line %s:%d: %s is "
"incorrect (%s)" % (v, data_source_name,