Fix encoding issues with LDAP/AD on Python 3.x

Review Request #11424 — Created Feb. 1, 2021 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

A user reported encoding errors in their logs when attempting to log in
a new user when connected to LDAP. The issue here was that data returned
from ldap was bytes, but we were attempting to split it using a
unicode splitter. According to the ldap documentation, field names are
returned as the text type, but attribute values will be bytestrings. The
documentation is a unclear in that it also claims that "text values"
will be the unicode type. In order to accomodate potentially different
behavior across Python versions, all values have been wrapped in
force_text. The unit tests have been updated to supply the expected
(bytes) types for values.

Ran unit tests on Python 2.7 and 3.8.

Commits

Files