Update to stuntman 1.2.5, add patches to use arc4random.
From maintainer Roman Kravchuk.
This commit is contained in:
parent
f84c18d8b9
commit
1169a7ec01
@ -1,9 +1,9 @@
|
||||
# $OpenBSD:
|
||||
# $OpenBSD: Makefile,v 1.4 2013/12/24 13:57:18 sthen Exp $
|
||||
|
||||
COMMENT = STUN server implementing RFCs 5389, 5769, and 5780
|
||||
NOT_FOR_ARCHS = hppa mips64 mips64el sparc64 # atomic ops
|
||||
|
||||
VERSION = 1.2.3
|
||||
VERSION = 1.2.5
|
||||
DISTNAME = stunserver-${VERSION}
|
||||
PKGNAME = stuntman-${VERSION}
|
||||
CATEGORIES = telephony net
|
||||
@ -23,7 +23,7 @@ WANTLIB += c crypto m pthread stdc++
|
||||
BUILD_DEPENDS = devel/boost
|
||||
|
||||
MAKE_FLAGS = BOOST_INCLUDE='-I${LOCALBASE}/include' \
|
||||
FLAVOR_FLAGS='${CXXFLAGS} -Wno-unknown-pragmas'
|
||||
FLAVOR_FLAGS='${CXXFLAGS} -Wno-unknown-pragmas -DHAVE_ARC4RANDOM'
|
||||
|
||||
USE_GMAKE = Yes
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (stunserver-1.2.3.tgz) = ELrazKqkyRUYDvo6Jqa6jlBTvfF7ASo3rqyItYp+i90=
|
||||
SIZE (stunserver-1.2.3.tgz) = 115322
|
||||
SHA256 (stunserver-1.2.5.tgz) = NDi8VT3iDlb/MXeNXI1wmtSGF3XSfJN/anWd6T0fQa8=
|
||||
SIZE (stunserver-1.2.5.tgz) = 116060
|
||||
|
36
telephony/stuntman/patches/patch-stuncore_stunbuilder_cpp
Normal file
36
telephony/stuntman/patches/patch-stuncore_stunbuilder_cpp
Normal file
@ -0,0 +1,36 @@
|
||||
$OpenBSD: patch-stuncore_stunbuilder_cpp,v 1.1 2013/12/24 13:57:18 sthen Exp $
|
||||
--- stuncore/stunbuilder.cpp.orig Sun Jun 23 20:45:16 2013
|
||||
+++ stuncore/stunbuilder.cpp Sun Dec 22 14:27:53 2013
|
||||
@@ -88,6 +88,7 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St
|
||||
StunTransactionId transid;
|
||||
uint32_t stun_cookie_nbo = htonl(STUN_COOKIE);
|
||||
|
||||
+#ifndef HAVE_ARC4RANDOM
|
||||
uint32_t entropy=0;
|
||||
|
||||
|
||||
@@ -122,10 +123,11 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St
|
||||
entropy ^= AtomicIncrement(&g_sequence_number);
|
||||
}
|
||||
|
||||
-#endif
|
||||
+#endif /* _WIN32 */
|
||||
|
||||
|
||||
srand(entropy);
|
||||
+#endif /* HAVE_ARC4RANDOM */
|
||||
|
||||
|
||||
// the first four bytes of the transaction id is always the magic cookie
|
||||
@@ -133,7 +135,11 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St
|
||||
memcpy(transid.id, &stun_cookie_nbo, sizeof(stun_cookie_nbo));
|
||||
for (int x = 4; x < (STUN_TRANSACTION_ID_LENGTH-4); x++)
|
||||
{
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ transid.id[x] = (uint8_t)(arc4random_uniform(256));
|
||||
+#else
|
||||
transid.id[x] = (uint8_t)(rand() % 256);
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (pTransId)
|
22
telephony/stuntman/patches/patch-testcode_testfasthash_cpp
Normal file
22
telephony/stuntman/patches/patch-testcode_testfasthash_cpp
Normal file
@ -0,0 +1,22 @@
|
||||
$OpenBSD: patch-testcode_testfasthash_cpp,v 1.1 2013/12/24 13:57:18 sthen Exp $
|
||||
--- testcode/testfasthash.cpp.orig Sun Jun 23 20:45:16 2013
|
||||
+++ testcode/testfasthash.cpp Sat Dec 21 15:08:08 2013
|
||||
@@ -233,11 +233,18 @@ HRESULT CTestFastHash::TestRemove()
|
||||
}
|
||||
|
||||
// shuffle our array - this is the order in which we'll do removes
|
||||
+#ifndef HAVE_ARC4RANDOM
|
||||
srand(99);
|
||||
+#endif
|
||||
for (size_t x = 0; x < c_maxsize; x++)
|
||||
{
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ int firstindex = arc4random_uniform(c_maxsize);
|
||||
+ int secondindex = arc4random_uniform(c_maxsize);
|
||||
+#else
|
||||
int firstindex = rand() % c_maxsize;
|
||||
int secondindex = rand() % c_maxsize;
|
||||
+#endif
|
||||
|
||||
int val1 = tracking[firstindex];
|
||||
int val2 = tracking[secondindex];
|
60
telephony/stuntman/patches/patch-testcode_testpolling_cpp
Normal file
60
telephony/stuntman/patches/patch-testcode_testpolling_cpp
Normal file
@ -0,0 +1,60 @@
|
||||
$OpenBSD: patch-testcode_testpolling_cpp,v 1.1 2013/12/24 13:57:18 sthen Exp $
|
||||
--- testcode/testpolling.cpp.orig Sun Jun 23 20:45:16 2013
|
||||
+++ testcode/testpolling.cpp Sat Dec 21 15:13:23 2013
|
||||
@@ -257,7 +257,9 @@ HRESULT CTestPolling::Test1()
|
||||
int fd;
|
||||
int count = 0;
|
||||
|
||||
+#ifndef HAVE_ARC4RANDOM
|
||||
srand(100);
|
||||
+#endif
|
||||
|
||||
ChkA(TestInit(10, 10));
|
||||
|
||||
@@ -269,8 +271,11 @@ HRESULT CTestPolling::Test1()
|
||||
// one event at a time model
|
||||
for (int index = 0; index < 100; index++)
|
||||
{
|
||||
-
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ size_t item = arc4random_uniform(size);
|
||||
+#else
|
||||
size_t item = rand() % size;
|
||||
+#endif
|
||||
|
||||
ChkA(WritePipe(&_pipes[item]));
|
||||
|
||||
@@ -303,7 +308,9 @@ HRESULT CTestPolling::Test2()
|
||||
PollEvent event;
|
||||
const size_t c_maxSockets = 10;
|
||||
|
||||
+#ifndef HAVE_ARC4RANDOM
|
||||
srand(100);
|
||||
+#endif
|
||||
|
||||
ChkA(TestInit(c_maxSockets, 0));
|
||||
|
||||
@@ -314,7 +321,11 @@ HRESULT CTestPolling::Test2()
|
||||
|
||||
for (size_t index = 0; index < 1000; index++)
|
||||
{
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ int randresult = ::arc4random_uniform(4);
|
||||
+#else
|
||||
int randresult = ::rand() % 4;
|
||||
+#endif
|
||||
|
||||
switch (randresult)
|
||||
{
|
||||
@@ -342,7 +353,11 @@ HRESULT CTestPolling::Test2()
|
||||
continue;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ itemindex = arc4random_uniform(size);
|
||||
+#else
|
||||
itemindex = rand() % size;
|
||||
+#endif
|
||||
ChkA(WritePipe(&_pipes[itemindex]));
|
||||
|
||||
break;
|
25
telephony/stuntman/patches/patch-testcode_testreader_cpp
Normal file
25
telephony/stuntman/patches/patch-testcode_testreader_cpp
Normal file
@ -0,0 +1,25 @@
|
||||
$OpenBSD: patch-testcode_testreader_cpp,v 1.1 2013/12/24 13:57:18 sthen Exp $
|
||||
--- testcode/testreader.cpp.orig Sun Jun 23 20:45:16 2013
|
||||
+++ testcode/testreader.cpp Sat Dec 21 15:58:18 2013
|
||||
@@ -130,7 +130,9 @@ HRESULT CTestReader::Test2()
|
||||
Chk(TestFixedReadSizes(chunksize));
|
||||
}
|
||||
|
||||
+#ifndef HAVE_ARC4RANDOM
|
||||
srand(888);
|
||||
+#endif
|
||||
for (size_t i = 0; i < 200; i++)
|
||||
{
|
||||
Chk(TestFixedReadSizes(0));
|
||||
@@ -158,7 +160,11 @@ HRESULT CTestReader::TestFixedReadSizes(size_t chunksi
|
||||
|
||||
if (fRandomChunkSizing)
|
||||
{
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ chunksize = arc4random_uniform(17) + 1;
|
||||
+#else
|
||||
chunksize = (rand() % 17) + 1;
|
||||
+#endif
|
||||
}
|
||||
|
||||
remaining = msgSize - bytesread;
|
Loading…
x
Reference in New Issue
Block a user