Hello ports@, This is update port telephony/stuntman to v1.2.5
Change log: - update to v 1.2.5 - use arc4random(3) Tested on amd64 current. Comments? Ok? - Roman
Index: Makefile =================================================================== RCS file: /cvs/ports/telephony/stuntman/Makefile,v retrieving revision 1.3 diff -u -p -u -p -r1.3 Makefile --- Makefile 4 Jul 2013 06:57:45 -0000 1.3 +++ Makefile 21 Dec 2013 14:10:07 -0000 @@ -1,9 +1,9 @@ -# $OpenBSD: +# $OpenBSD: $ 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 Index: distinfo =================================================================== RCS file: /cvs/ports/telephony/stuntman/distinfo,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 distinfo --- distinfo 18 Jun 2013 14:28:37 -0000 1.1.1.1 +++ distinfo 21 Dec 2013 14:10:07 -0000 @@ -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 Index: patches/patch-stuncore_stunbuilder_cpp =================================================================== RCS file: patches/patch-stuncore_stunbuilder_cpp diff -N patches/patch-stuncore_stunbuilder_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-stuncore_stunbuilder_cpp 21 Dec 2013 14:10:07 -0000 @@ -0,0 +1,45 @@ +$OpenBSD$ +--- stuncore/stunbuilder.cpp.orig Sun Jun 23 20:45:16 2013 ++++ stuncore/stunbuilder.cpp Sat Dec 21 15:52:49 2013 +@@ -88,7 +88,9 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St + StunTransactionId transid; + uint32_t stun_cookie_nbo = htonl(STUN_COOKIE); + ++#ifndef HAVE_ARC4RANDOM + uint32_t entropy=0; ++#endif + + + // on x86, the rdtsc instruction is about as good as it gets for a random sequence number +@@ -100,7 +102,7 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St + // the rdtsc instruction is about as good as it gets + uint64_t clock = __rdtsc(); + entropy ^= (uint32_t)(clock); +-#else ++#elifndef HAVE_ARC4RANDOM + // on linux, /dev/urandom should be sufficient + { + int randomfile = ::open("/dev/urandom", O_RDONLY); +@@ -124,16 +126,20 @@ HRESULT CStunMessageBuilder::AddRandomTransactionId(St + + #endif + +- ++#ifndef HAVE_ARC4RANDOM + srand(entropy); ++#endif + +- + // the first four bytes of the transaction id is always the magic cookie + // followed by 12 bytes of the real transaction id + 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) Index: patches/patch-testcode_testfasthash_cpp =================================================================== RCS file: patches/patch-testcode_testfasthash_cpp diff -N patches/patch-testcode_testfasthash_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-testcode_testfasthash_cpp 21 Dec 2013 14:10:07 -0000 @@ -0,0 +1,22 @@ +$OpenBSD$ +--- 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]; Index: patches/patch-testcode_testpolling_cpp =================================================================== RCS file: patches/patch-testcode_testpolling_cpp diff -N patches/patch-testcode_testpolling_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-testcode_testpolling_cpp 21 Dec 2013 14:10:07 -0000 @@ -0,0 +1,60 @@ +$OpenBSD$ +--- 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; Index: patches/patch-testcode_testreader_cpp =================================================================== RCS file: patches/patch-testcode_testreader_cpp diff -N patches/patch-testcode_testreader_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-testcode_testreader_cpp 21 Dec 2013 14:10:07 -0000 @@ -0,0 +1,25 @@ +$OpenBSD$ +--- 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;