25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Get rid of asn1rt calls

This commit is contained in:
Evgeniy Khramtsov 2015-01-15 14:46:14 +03:00
parent d53a54d900
commit 4575649e10

View File

@ -828,7 +828,7 @@ send_command(Command, From, S) ->
Message = #'LDAPMessage'{messageID = Id, Message = #'LDAPMessage'{messageID = Id,
protocolOp = {Name, Request}}, protocolOp = {Name, Request}},
?DEBUG("~p~n", [{Name, Request}]), ?DEBUG("~p~n", [{Name, Request}]),
{ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', {ok, Bytes} = 'ELDAPv3':encode('LDAPMessage',
Message), Message),
case (S#eldap.sockmod):send(S#eldap.fd, Bytes) of case (S#eldap.sockmod):send(S#eldap.fd, Bytes) of
ok -> ok ->
@ -863,8 +863,7 @@ gen_req({modify_dn, Entry, NewRDN, DelOldRDN,
#'ModifyDNRequest'{entry = Entry, newrdn = NewRDN, #'ModifyDNRequest'{entry = Entry, newrdn = NewRDN,
deleteoldrdn = DelOldRDN, newSuperior = NewSup}}; deleteoldrdn = DelOldRDN, newSuperior = NewSup}};
gen_req({modify_passwd, DN, Passwd}) -> gen_req({modify_passwd, DN, Passwd}) ->
{ok, ReqVal} = asn1rt:encode('ELDAPv3', {ok, ReqVal} = 'ELDAPv3':encode('PasswdModifyRequestValue',
'PasswdModifyRequestValue',
#'PasswdModifyRequestValue'{userIdentity = DN, #'PasswdModifyRequestValue'{userIdentity = DN,
newPasswd = newPasswd =
Passwd}), Passwd}),
@ -887,7 +886,7 @@ gen_req({bind, RootDN, Passwd}) ->
%% {'EXIT', Reason} - Broke %% {'EXIT', Reason} - Broke
%%----------------------------------------------------------------------- %%-----------------------------------------------------------------------
recvd_packet(Pkt, S) -> recvd_packet(Pkt, S) ->
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of case 'ELDAPv3':decode('LDAPMessage', Pkt) of
{ok, Msg} -> {ok, Msg} ->
Op = Msg#'LDAPMessage'.protocolOp, Op = Msg#'LDAPMessage'.protocolOp,
?DEBUG("~p", [Op]), ?DEBUG("~p", [Op]),
@ -1005,7 +1004,7 @@ get_op_rec(Id, Dict) ->
%% {'EXIT', Reason} - Broken packet %% {'EXIT', Reason} - Broken packet
%%----------------------------------------------------------------------- %%-----------------------------------------------------------------------
recvd_wait_bind_response(Pkt, S) -> recvd_wait_bind_response(Pkt, S) ->
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of case 'ELDAPv3':decode('LDAPMessage', Pkt) of
{ok, Msg} -> {ok, Msg} ->
?DEBUG("~p", [Msg]), ?DEBUG("~p", [Msg]),
check_id(S#eldap.id, Msg#'LDAPMessage'.messageID), check_id(S#eldap.id, Msg#'LDAPMessage'.messageID),
@ -1152,7 +1151,7 @@ bind_request(Socket, S) ->
Message = #'LDAPMessage'{messageID = Id, Message = #'LDAPMessage'{messageID = Id,
protocolOp = {bindRequest, Req}}, protocolOp = {bindRequest, Req}},
?DEBUG("Bind Request Message:~p~n", [Message]), ?DEBUG("Bind Request Message:~p~n", [Message]),
{ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', {ok, Bytes} = 'ELDAPv3':encode('LDAPMessage',
Message), Message),
case (S#eldap.sockmod):send(Socket, Bytes) of case (S#eldap.sockmod):send(Socket, Bytes) of
ok -> {ok, S#eldap{id = Id}}; ok -> {ok, S#eldap{id = Id}};