25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Fix Record-Route signing

This commit is contained in:
Evgeniy Khramtsov 2014-07-17 20:30:09 +04:00
parent e0c9242dcf
commit 1f4e0c8aea

View File

@ -308,10 +308,10 @@ need_record_route(LServer) ->
make_sign(TS, Hdrs) -> make_sign(TS, Hdrs) ->
{_, #uri{user = FUser, host = FServer}, FParams} = esip:get_hdr('from', Hdrs), {_, #uri{user = FUser, host = FServer}, FParams} = esip:get_hdr('from', Hdrs),
{_, #uri{user = TUser, host = TServer}, _} = esip:get_hdr('to', Hdrs), {_, #uri{user = TUser, host = TServer}, _} = esip:get_hdr('to', Hdrs),
LFUser = jlib:nodeprep(FUser), LFUser = safe_nodeprep(FUser),
LTUser = jlib:nodeprep(TUser), LTUser = safe_nodeprep(TUser),
LFServer = jlib:nameprep(FServer), LFServer = safe_nameprep(FServer),
LTServer = jlib:nameprep(TServer), LTServer = safe_nameprep(TServer),
FromTag = esip:get_param(<<"tag">>, FParams), FromTag = esip:get_param(<<"tag">>, FParams),
CallID = esip:get_hdr('call-id', Hdrs), CallID = esip:get_hdr('call-id', Hdrs),
SharedKey = ejabberd_config:get_option(shared_key, fun(V) -> V end), SharedKey = ejabberd_config:get_option(shared_key, fun(V) -> V end),
@ -427,3 +427,15 @@ prepare_request(LServer, #sip{hdrs = Hdrs} = Req) ->
true true
end, Hdrs2), end, Hdrs2),
Req#sip{hdrs = Hdrs3}. Req#sip{hdrs = Hdrs3}.
safe_nodeprep(S) ->
case jlib:nodeprep(S) of
error -> S;
S1 -> S1
end.
safe_nameprep(S) ->
case jlib:nameprep(S) of
error -> S;
S1 -> S1
end.