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

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

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.

Summary ID
Fix encoding issues with LDAP/AD on Python 3.x
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. Testing Done: Ran unit tests on Python 2.7 and 3.8.
5496def4229b4f5a30cb0dba00325a044ff2be03
Description From Last Updated

Swap these (alphabetical order).

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/accounts/backends/ad.py (Diff revision 1)
     
     
     
    Show all issues

    Swap these (alphabetical order).

  3. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (0edccb2)
Loading...