Commit b1f350cd authored by Philipp Huebner's avatar Philipp Huebner

Release 1.0.12-1

parent 6f0278d1
erlang-p1-stun (1.0.12-1) unstable; urgency=medium
* New upstream version 1.0.12
* Updated Standards-Version: 4.0.0 (no changes needed)
-- Philipp Huebner <debalance@debian.org> Wed, 12 Jul 2017 18:34:06 +0200
erlang-p1-stun (1.0.10-1~exp1) experimental; urgency=medium
* New upstream version 1.0.10
......
Source: erlang-p1-stun
Priority: optional
Maintainer: Philipp Huebner <debalance@debian.org>
Build-Depends: debhelper (>= 9), dh-rebar, erlang-base, erlang-eunit, erlang-p1-tls (>= 1.0.11), erlang-p1-utils (>= 1.0.7), erlang-syntax-tools
Build-Depends: debhelper (>= 9), dh-rebar, erlang-base, erlang-eunit, erlang-p1-tls (>= 1.0.13), erlang-p1-utils (>= 1.0.9), erlang-syntax-tools
Standards-Version: 4.0.0
Section: libs
Homepage: https://github.com/processone/stun
......@@ -11,7 +11,7 @@ Vcs-Browser: https://anonscm.debian.org/git/users/debalance/erlang-p1-stun.git
Package: erlang-p1-stun
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, erlang-base | ${erlang-abi:Depends},
${erlang:Depends}, erlang-p1-tls (>= 1.0.11), erlang-p1-utils (>= 1.0.7)
${erlang:Depends}, erlang-p1-tls (>= 1.0.13), erlang-p1-utils (>= 1.0.9)
Suggests: stun-server | turn-server
Description: STUN library for Erlang
This library was written for ejabberd which still uses it.
......
Description: disable allocate_udp_test
allocate_udp_test is currently broken, so it must be disabled for the
package build to succeed.
Author: Philipp Huebner <debalance@debian.org>
Index: erlang-p1-stun/src/stun_test.erl
===================================================================
--- erlang-p1-stun.orig/src/stun_test.erl
+++ erlang-p1-stun/src/stun_test.erl
@@ -118,118 +118,6 @@ del_tcp_listener_test() ->
del_tls_listener_test() ->
?assertEqual(ok, stun_listener:del_listener(?STUNS_PORT, tcp)).
-allocate_udp_test() ->
- {ok, Socket} = gen_udp:open(0, [binary, {ip, {127,0,0,1}}, {active, false}]),
- {ok, PeerSocket} = gen_udp:open(0, [binary, {ip, {127,0,0,1}}, {active, false}]),
- {ok, PeerAddr} = inet:sockname(PeerSocket),
- {ok, Addr} = inet:sockname(Socket),
- %% Allocating address, receiving 401 with nonce and realm
- TrID1 = mk_trid(),
- Msg1 = #stun{method = ?STUN_METHOD_ALLOCATE,
- class = request,
- trid = TrID1},
- PktOut1 = stun_codec:encode(Msg1),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut1)),
- {ok, {_, _, PktIn1}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- {ok, #stun{trid = TrID1,
- class = error,
- 'ERROR-CODE' = {401, _},
- 'NONCE' = Nonce,
- 'REALM' = ?REALM}} = stun_codec:decode(PktIn1, datagram),
- %% Repeating allocation from the first step
- TrID2 = mk_trid(),
- Msg2 = #stun{method = ?STUN_METHOD_ALLOCATE,
- trid = TrID2,
- 'REQUESTED-TRANSPORT' = udp,
- 'NONCE' = Nonce,
- 'REALM' = ?REALM,
- 'USERNAME' = ?USER},
- PktOut2 = stun_codec:encode(Msg2, {?USER, ?REALM, ?PASS}),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut2)),
- {ok, {_, _, PktIn2}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- {ok, #stun{trid = TrID2,
- class = response,
- 'XOR-RELAYED-ADDRESS' = {RelayIP, RelayPort},
- 'XOR-MAPPED-ADDRESS' = Addr}} = stun_codec:decode(PktIn2, datagram),
- %% Creating permission for the peer
- TrID3 = mk_trid(),
- Msg3 = #stun{method = ?STUN_METHOD_CREATE_PERMISSION,
- trid = TrID3,
- 'XOR-PEER-ADDRESS' = [PeerAddr],
- 'NONCE' = Nonce,
- 'REALM' = ?REALM,
- 'USERNAME' = ?USER},
- PktOut3 = stun_codec:encode(Msg3, {?USER, ?REALM, ?PASS}),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut3)),
- {ok, {_, _, PktIn3}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- {ok, #stun{trid = TrID3,
- class = response}} = stun_codec:decode(PktIn3, datagram),
- %% Sending some data to the peer. Peer receives it.
- Data1 = crypto:rand_bytes(20),
- TrID4 = mk_trid(),
- Msg4 = #stun{method = ?STUN_METHOD_SEND,
- trid = TrID4,
- class = indication,
- 'XOR-PEER-ADDRESS' = [PeerAddr],
- 'DATA' = Data1},
- PktOut4 = stun_codec:encode(Msg4),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut4)),
- ?assertMatch({ok, {_, _, Data1}}, gen_udp:recv(PeerSocket, 0, ?RECV_TIMEOUT)),
- %% Peer sends the data back. We receive it.
- ?assertEqual(ok, gen_udp:send(PeerSocket, RelayIP, RelayPort, Data1)),
- {ok, {_, _, Data2}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- ?assertMatch(
- {ok, #stun{'DATA' = Data1,
- 'XOR-PEER-ADDRESS' = [PeerAddr],
- class = indication}},
- stun_codec:decode(Data2, datagram)),
- %% We're binding channel for our peer
- TrID5 = mk_trid(),
- Msg5 = #stun{method = ?STUN_METHOD_CHANNEL_BIND,
- trid = TrID5,
- class = request,
- 'CHANNEL-NUMBER' = ?CHANNEL,
- 'XOR-PEER-ADDRESS' = [PeerAddr],
- 'NONCE' = Nonce,
- 'REALM' = ?REALM,
- 'USERNAME' = ?USER},
- PktOut5 = stun_codec:encode(Msg5, {?USER, ?REALM, ?PASS}),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut5)),
- {ok, {_, _, PktIn5}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- ?assertMatch(
- {ok, #stun{trid = TrID5,
- class = response}},
- stun_codec:decode(PktIn5, datagram)),
- %% Now we send data to this channel. The peer receives it.
- Data3 = crypto:rand_bytes(20),
- Msg6 = #turn{channel = ?CHANNEL, data = Data3},
- PktOut6 = stun_codec:encode(Msg6),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut6)),
- ?assertMatch({ok, {_, _, Data3}}, gen_udp:recv(PeerSocket, 0, ?RECV_TIMEOUT)),
- %% The peer sends the data back. We receive it.
- ?assertEqual(ok, gen_udp:send(PeerSocket, RelayIP, RelayPort, Data3)),
- {ok, {_, _, Data4}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- ?assertMatch(
- {ok, #turn{channel = ?CHANNEL, data = Data3}},
- stun_codec:decode(Data4, datagram)),
- %% Destroying the allocation via Refresh method (with LIFETIME set to zero)
- TrID7 = mk_trid(),
- Msg7 = #stun{method = ?STUN_METHOD_REFRESH,
- trid = TrID7,
- 'LIFETIME' = 0,
- 'NONCE' = Nonce,
- 'REALM' = ?REALM,
- 'USERNAME' = ?USER},
- PktOut7 = stun_codec:encode(Msg7, {?USER, ?REALM, ?PASS}),
- ?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut7)),
- {ok, {_, _, PktIn7}} = gen_udp:recv(Socket, 0, ?RECV_TIMEOUT),
- ?assertMatch(
- {ok, #stun{trid = TrID7,
- 'LIFETIME' = 0,
- class = response}},
- stun_codec:decode(PktIn7, datagram)),
- ?assertEqual(ok, gen_udp:close(PeerSocket)),
- ?assertEqual(ok, gen_udp:close(Socket)).
%%--------------------------------------------------------------------
%% External functions
From 4b28e996bb8e82164e633c25fe77de36ddc3638c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C3=85=C2=82=20Chmielowski?=
<pchmielowski@process-one.net>
Date: Wed, 12 Jul 2017 00:44:43 +0200
Subject: [PATCH] Don't use crypto:rand_bytes/1 in tests
This was removed in R20, and should fix issue #10
---
src/stun_test.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stun_test.erl b/src/stun_test.erl
index faf2336..7c4b16a 100644
--- a/src/stun_test.erl
+++ b/src/stun_test.erl
@@ -165,7 +165,7 @@ allocate_udp_test() ->
{ok, #stun{trid = TrID3,
class = response}} = stun_codec:decode(PktIn3, datagram),
%% Sending some data to the peer. Peer receives it.
- Data1 = crypto:rand_bytes(20),
+ Data1 = crypto:strong_rand_bytes(20),
TrID4 = mk_trid(),
Msg4 = #stun{method = ?STUN_METHOD_SEND,
trid = TrID4,
@@ -201,7 +201,7 @@ allocate_udp_test() ->
class = response}},
stun_codec:decode(PktIn5, datagram)),
%% Now we send data to this channel. The peer receives it.
- Data3 = crypto:rand_bytes(20),
+ Data3 = crypto:strong_rand_bytes(20),
Msg6 = #turn{channel = ?CHANNEL, data = Data3},
PktOut6 = stun_codec:encode(Msg6),
?assertEqual(ok, gen_udp:send(Socket, {127,0,0,1}, ?STUN_PORT, PktOut6)),
remove-deps.diff
disable-allocate_udp_test.diff
fix-allocate_udp_test.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment