"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/identity/backends/ldap/common.py" between
keystone-17.0.0.tar.gz and keystone-18.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Victoria" series (latest release).

common.py  (keystone-17.0.0):common.py  (keystone-18.0.0)
skipping to change at line 21 skipping to change at line 21
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import abc import abc
import codecs import codecs
import functools import functools
import os.path import os.path
import re import re
import sys import sys
import uuid
import weakref import weakref
import ldap.controls import ldap.controls
import ldap.filter import ldap.filter
import ldappool import ldappool
from oslo_log import log from oslo_log import log
from oslo_utils import reflection from oslo_utils import reflection
from keystone.common import driver_hints from keystone.common import driver_hints
from keystone import exception from keystone import exception
skipping to change at line 91 skipping to change at line 92
If the value is a binary string assume it's UTF-8 encoded and decode If the value is a binary string assume it's UTF-8 encoded and decode
it into a unicode string. Otherwise convert the value from its it into a unicode string. Otherwise convert the value from its
type into a unicode string. type into a unicode string.
:param value: value to be returned as unicode :param value: value to be returned as unicode
:returns: value as unicode :returns: value as unicode
:raises UnicodeDecodeError: for invalid UTF-8 encoding :raises UnicodeDecodeError: for invalid UTF-8 encoding
""" """
if isinstance(value, bytes): if isinstance(value, bytes):
return _utf8_decoder(value)[0] try:
return _utf8_decoder(value)[0]
except UnicodeDecodeError:
# NOTE(lbragstad): We could be dealing with a UUID in byte form,
# which some LDAP implementations use.
uuid_byte_string_length = 16
if len(value) == uuid_byte_string_length:
return str(uuid.UUID(bytes_le=value))
else:
raise
return str(value) return str(value)
def py2ldap(val): def py2ldap(val):
"""Type convert a Python value to a type accepted by LDAP (unicode). """Type convert a Python value to a type accepted by LDAP (unicode).
The LDAP API only accepts strings for values therefore convert The LDAP API only accepts strings for values therefore convert
the value's type to a unicode string. A subsequent type conversion the value's type to a unicode string. A subsequent type conversion
will encode the unicode as UTF-8 as required by the python-ldap API, will encode the unicode as UTF-8 as required by the python-ldap API,
but for now we just want a string representation of the value. but for now we just want a string representation of the value.
 End of changes. 2 change blocks. 
1 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)