Fix parsing of emulated enabled DN

If a non-default emulated enabled DN is specified in configuration,
the DN structure returned from python-ldap is incorrectly converted
to a string.  This leads to an index error when we attempt to extract
the RDN attribute and value.

This patch removes the incorrect string conversion and instead does
the proper conversion on the RDN strings that we extract.

Change-Id: I8f0c4594cfa9a41e1875870c3eb63fae32c8c041
Resolves-bug: #1375772
Convert unicode to UTF8 when calling ldap.str2dn()

The string passed to ldap.str2dn() needs to be UTF8 encoded, otherwise
we encounter UnicodeEncodeError exceptions.

This patch adds UTF8 encoding where it was missing for ldap.str2dn()
calls as well as some unit tests to cover the functions that were
lacking this encoding step.

Change-Id: I96e718f1d43f4aad272ca4990d3905a5adf1f07d
Closes-bug: #1375139
Merge "Fix parsing of emulated enabled DN"
Merge "Convert unicode to UTF8 when calling ldap.str2dn()"