[erlang-questions] eldap using binary() rather than string() in Erlang 17.0 rc2?

Simon MacMullen simon@REDACTED
Wed Mar 5 13:56:47 CET 2014


Using R16B01:

1> {ok, LDAP} = eldap:open(["localhost"], []).
{ok,<0.34.0>}
2> eldap:search(LDAP, [{base, "cn=Simon 
MacMullen,ou=People,dc=example,dc=com"},{filter, 
eldap:present("objectClass")}, {attributes, ["description"]}]).
{ok,{eldap_search_result,
         [{eldap_entry,
              "cn=Simon MacMullen,ou=people,dc=example,dc=com",
              [{"description",["can-declare-queues"]}]}],
         []}}

So the attribute key/values come back as lists.

Using 17.0 rc2:

1> {ok, LDAP} = eldap:open(["localhost"], []).
{ok,<0.34.0>}
2> eldap:search(LDAP, [{base, "cn=Simon 
MacMullen,ou=People,dc=example,dc=com"},{filter, 
eldap:present("objectClass")}, {attributes, ["description"]}]).
{ok,{eldap_search_result,
         [{eldap_entry,
              <<"cn=Simon MacMullen,ou=people,dc=example,dc=com">>,
              [{<<"description">>,[<<"can-declare-queues">>]}]}],
         []}}

Now they come back as binaries. Is this intentional or a bug?

Note that in either case if I give attribute names as binaries I get a 
crash:

3> eldap:search(LDAP, [{base, "cn=Simon 
MacMullen,ou=People,dc=example,dc=com"},{filter, 
eldap:present("objectClass")}, {attributes, [<<"description">>]}]).
{error,{function_clause,[{lists,thing_to_list,
                                 [<<"description">>],
                                 [{file,"lists.erl"},{line,601}]},
 
{lists,flatmap,2,[{file,"lists.erl"},{line,1248}]},
 
{lists,flatmap,2,[{file,"lists.erl"},{line,1248}]},
                          {eldap,'-v_attributes/1-fun-0-',1,
                                 [{file,"eldap.erl"},{line,850}]},
                          {lists,map,2,[{file,"lists.erl"},{line,1237}]},
 
{eldap,do_search_0,2,[{file,"eldap.erl"},{line,613}]},
 
{eldap,do_search,2,[{file,"eldap.erl"},{line,577}]},
                          {eldap,loop,2,[{file,"eldap.erl"},{line,425}]}]}}

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal



More information about the erlang-questions mailing list