mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
fix a bug that causes LDAP TLS connection flags to not be set properly
co-authored-by: Jim Ladd <jladd@redhat.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
|
from collections import OrderedDict
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -54,6 +55,20 @@ class LDAPSettings(BaseLDAPSettings):
|
|||||||
options[ldap.OPT_NETWORK_TIMEOUT] = 30
|
options[ldap.OPT_NETWORK_TIMEOUT] = 30
|
||||||
self.CONNECTION_OPTIONS = options
|
self.CONNECTION_OPTIONS = options
|
||||||
|
|
||||||
|
# when specifying `.set_option()` calls for TLS in python-ldap, the
|
||||||
|
# *order* in which you invoke them *matters*, particularly in Python3,
|
||||||
|
# where dictionary insertion order is persisted
|
||||||
|
#
|
||||||
|
# specifically, it is *critical* that `ldap.OPT_X_TLS_NEWCTX` be set *last*
|
||||||
|
# this manual sorting puts `OPT_X_TLS_NEWCTX` *after* other TLS-related
|
||||||
|
# options
|
||||||
|
#
|
||||||
|
# see: https://github.com/python-ldap/python-ldap/issues/55
|
||||||
|
newctx_option = self.CONNECTION_OPTIONS.pop(ldap.OPT_X_TLS_NEWCTX, None)
|
||||||
|
self.CONNECTION_OPTIONS = OrderedDict(self.CONNECTION_OPTIONS)
|
||||||
|
if newctx_option:
|
||||||
|
self.CONNECTION_OPTIONS[ldap.OPT_X_TLS_NEWCTX] = newctx_option
|
||||||
|
|
||||||
|
|
||||||
class LDAPBackend(BaseLDAPBackend):
|
class LDAPBackend(BaseLDAPBackend):
|
||||||
'''
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user