mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixed a problem where the OpenSSL bindings refuse to consume unicode
strings.
This commit is contained in:
parent
399cf08860
commit
cc12844922
1 changed files with 7 additions and 1 deletions
|
@ -25,6 +25,7 @@ import sys
|
|||
# Import salt libs
|
||||
import salt.utils.files
|
||||
import salt.utils.path
|
||||
import salt.utils.stringutils
|
||||
import salt.exceptions
|
||||
from salt.ext import six
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
@ -945,6 +946,8 @@ def create_crl( # pylint: disable=too-many-arguments,too-many-locals
|
|||
rev_item['not_after'] = rev_cert['Not After']
|
||||
|
||||
serial_number = rev_item['serial_number'].replace(':', '')
|
||||
# OpenSSL bindings requires this to be a non-unicode string
|
||||
serial_number = salt.utils.stringutils.to_str(serial_number)
|
||||
|
||||
if 'not_after' in rev_item and not include_expired:
|
||||
not_after = datetime.datetime.strptime(
|
||||
|
@ -961,11 +964,14 @@ def create_crl( # pylint: disable=too-many-arguments,too-many-locals
|
|||
rev_date = rev_date.strftime('%Y%m%d%H%M%SZ')
|
||||
|
||||
rev = OpenSSL.crypto.Revoked()
|
||||
|
||||
rev.set_serial(serial_number)
|
||||
rev.set_rev_date(rev_date)
|
||||
|
||||
if 'reason' in rev_item:
|
||||
rev.set_reason(rev_item['reason'])
|
||||
# Same here for OpenSSL bindings and non-unicode strings
|
||||
reason = salt.utils.stringutils.to_str(rev_item['reason'])
|
||||
rev.set_reason(reason)
|
||||
|
||||
crl.add_revoked(rev)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue