properly encode LDAP DN values on validation

see: https://github.com/ansible/ansible-tower/issues/7554
This commit is contained in:
Ryan Petrello
2017-09-20 15:53:08 -04:00
committed by Matthew Jones
parent 91ec0a4482
commit 7a21a45781

View File

@@ -22,7 +22,7 @@ def validate_ldap_dn(value, with_user=False):
else:
dn_value = value
try:
ldap.dn.str2dn(dn_value)
ldap.dn.str2dn(dn_value.encode('utf-8'))
except ldap.DECODING_ERROR:
raise ValidationError(_('Invalid DN: %s') % value)