eldap compatibility with Unicode strings

Guilherme Andrade g@REDACTED
Wed Apr 7 14:26:28 CEST 2021


Hello,

Can eldap handle Unicode strings (e.g. passwords) in general?

I'm not in a position to test it myself as of this moment, and so I looked
into the source code.

- the eldap docs say the API mostly receives the built-in `string()` type
as input(s)[1]
- the `string()` type is defined as being a list of `char()`, which in
return is defined as a Unicode codepoint[2]
- eldap uses a module named ELDAPv3 to encode LDAP messages[3]
- ELDAPv3 appears to be generated from an ASN.1-defined protocol[4]
- under said protocol, most messages appear to transport "OCTET STRING"s[5]
- there's also an LDAPString[6] type, which is nevertheless also defined as
an "OCTET STRING"[7]
- finally, there's a separate notion of character strings under the docs
for the asn1 app[8], which is not used in eldap

With all of this in mind: would eldap handle Unicode strings? Or would I
have to convert them to UTF-8 encoded byte lists first?

(The later notion not being ideal, since they would be neither Unicode
strings nor UTF-8 binaries, but something in-between which is unsupported,
I presume, by both the `string` and `unicode` modules.)

[1]: http://erlang.org/doc/man/eldap.html#simple_bind-3
[2]:
https://erlang.org/doc/reference_manual/typespec.html#types-and-their-syntax
[3]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/src/eldap.erl#L1008
[4]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1
[5]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1#L148-L155
[6]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1#L42-L43
[7]: Expected to be encoded in UTF-8 no less
[8]:
http://erlang.org/doc/apps/asn1/asn1_getting_started.html#character-strings

--
Guilherme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210407/5a1110e2/attachment.htm>


More information about the erlang-questions mailing list