[erlang-questions] problem with eldap module

Minin Maxim Maxim.Minin@REDACTED
Fri Oct 4 14:16:44 CEST 2019


I have a problem with eldap module.  The call  eldap:simple_bind(Handle, Dn, Password) don't work correct if the password contains sign '§'.
Is it a known issue? Have I to report this as a bug?

I think , the cause of the problem is maybe the encoding function in ELDAPv3 module (asn1 module from eldap lib). I have generated ELDAPv3.erl from ELDAPv3.asn1 (call asn1ct:compile("ELDAPv3.asn1") and found this:
encode(Type, Data) ->
try iolist_to_binary(element(1, encode_disp(Type, Data))) of
  Bytes ->

this call to iolist_to_binary makes the problem by § sign and should by replace by  unicode:characters_to_binary/3
1> erlang:iolist_to_binary([167]).
2> unicode:characters_to_binary([167], utf8, utf8).

As a workaround I just convert the password string to binary bevor eldap:simple_bind/4 call, like that:
PaswordAsBin = unicode:characters_to_binary(Password,utf8,utf8),
BindAnswer =  eldap:simple_bind(UserHandle,DN,PaswordAsBin),

It works but according to documentation of eldap module the password have to be string:
"simple_bind(Handle, Dn, Password) -> return_value()
                OTP R15B01
Handle = handle()
Dn = string()
Password = string()
Authenticate the connection using simple authentication."


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191004/b12d3acd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5514 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191004/b12d3acd/attachment.bin>

More information about the erlang-questions mailing list