mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix get_trusted_domain_object_from_sid()
DomainValidator.get_trusted_domain_object_from_sid() was using escape_filter_chars() with bytes. The function only works with text. This caused idview to fail under some circumstances. Reimplement backslash hex quoting for bytes. Fixes: https://pagure.io/freeipa/issue/7958 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
@@ -63,7 +63,6 @@ import pysss
|
|||||||
import six
|
import six
|
||||||
from ipaplatform.paths import paths
|
from ipaplatform.paths import paths
|
||||||
|
|
||||||
from ldap.filter import escape_filter_chars
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -491,9 +490,9 @@ class DomainValidator:
|
|||||||
# If unsuccessful, search AD DC LDAP
|
# If unsuccessful, search AD DC LDAP
|
||||||
logger.debug("Searching AD DC LDAP")
|
logger.debug("Searching AD DC LDAP")
|
||||||
|
|
||||||
escaped_sid = escape_filter_chars(
|
# escape_filter_chars(sid_bytes, 2) but for bytes
|
||||||
security.dom_sid(sid).__ndr_pack__(),
|
escaped_sid = "".join(
|
||||||
2 # 2 means every character needs to be escaped
|
"\\%02x" % b for b in ndr_pack(security.dom_sid(sid))
|
||||||
)
|
)
|
||||||
|
|
||||||
attrs = ['sAMAccountName']
|
attrs = ['sAMAccountName']
|
||||||
|
|||||||
Reference in New Issue
Block a user