mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-29 15:55:47 -05:00
py3: fix csrgen error handling
csrgen error handling marshalls an error string from libcrypto. This is not handled correctly under python3. Fix the error handling. Part of: https://pagure.io/freeipa/issue/7496 Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
committed by
Christian Heimes
parent
13b9608d5c
commit
53f87ee5cd
@@ -182,8 +182,12 @@ def _raise_openssl_errors():
|
|||||||
|
|
||||||
code = ERR_get_error()
|
code = ERR_get_error()
|
||||||
while code != 0:
|
while code != 0:
|
||||||
msg = ERR_error_string(code, NULL)
|
msg = _ffi.string(ERR_error_string(code, NULL))
|
||||||
msgs.append(_ffi.string(msg))
|
try:
|
||||||
|
strmsg = msg.decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
strmsg = repr(msg)
|
||||||
|
msgs.append(strmsg)
|
||||||
code = ERR_get_error()
|
code = ERR_get_error()
|
||||||
|
|
||||||
raise errors.CSRTemplateError(reason='\n'.join(msgs))
|
raise errors.CSRTemplateError(reason='\n'.join(msgs))
|
||||||
|
|||||||
Reference in New Issue
Block a user