On Sat, Feb 17, 2018 at 10:46:26PM +0100, Adam Wolk wrote: > On Sat, Feb 17, 2018 at 08:51:02PM +0000, Stuart Henderson wrote: > > > + #include <arpa/inet.h> > > > + #define strtok_ret strtok_r > > > ++#ifdef __OpenBSD__ > > > ++#define VENTRILO_RAND arc4random() > > > ++#else > > > + #define VENTRILO_RAND random() > > > ++#endif > > > + #else > > > + #include <winsock.h> > > > + #define strtok_ret strtok_s > > > > > *p = (((VENTRILO_RAND * 0x343fd) + 0x269ec3) >> 16) & 0x7fff; > > > > any idea what's going on here? > > > > The code is for checking a ventrilo server, the header points > out that the alogirthm was developed by Luigi Auriemma as > a result of reverse engineering the protocol. > > The implementation from the author seems to be: > > http://aluigi.altervista.org/papers/ventrilo3_handshake.c > > in this implementation the only random value is > > putbe(sbuff + 0x12, time(NULL),16); // rand useless number > > in both implementations the code is in the section handling > the udp header. > > I guess they don't really care if the number is truly random. > > Perhaps we should not change that and let upstream decide > on that single patch.
That sounds like a good idea. I amended my pull request upstream for now. Here's the latest diff with the blank line formatting and I removed the arc4random() change to ventrilo.c Thanks, Tom Index: Makefile =================================================================== RCS file: /cvs/ports/games/qstat/Makefile,v retrieving revision 1.9 diff -u -p -r1.9 Makefile --- Makefile 11 Mar 2013 11:07:40 -0000 1.9 +++ Makefile 17 Feb 2018 22:03:59 -0000 @@ -2,18 +2,35 @@ COMMENT= displays the status of multi-player Internet Game servers -DISTNAME= qstat-2.11 -REVISION= 0 +GH_ACCOUNT= multiplay +GH_PROJECT= qstat +GH_TAGNAME= v2.14 + +DISTNAME= qstat-2.14 CATEGORIES= games +MAINTAINER= Tom Murphy <open...@pertho.net> # Artistic PERMIT_PACKAGE_CDROM= Yes WANTLIB= c -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=qstat/} +BUILD_DEPENDS += ${MODGNU_AUTOCONF_DEPENDS} \ + ${MODGNU_AUTOMAKE_DEPENDS} + +CONFIGURE_STYLE = gnu + +AUTOCONF_VERSION = 2.61 +AUTOMAKE_VERSION = 1.9 + +MAKE_ENV = AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} -CONFIGURE_STYLE=gnu +post-patch: + cd ${WRKSRC}; \ + export AUTOCONF_VERSION=${AUTOCONF_VERSION}; \ + export AUTOMAKE_VERSION=${AUTOMAKE_VERSION}; \ + ./autogen.sh post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/qstat Index: distinfo =================================================================== RCS file: /cvs/ports/games/qstat/distinfo,v retrieving revision 1.5 diff -u -p -r1.5 distinfo --- distinfo 18 Jan 2015 03:14:01 -0000 1.5 +++ distinfo 17 Feb 2018 22:03:59 -0000 @@ -1,2 +1,2 @@ -SHA256 (qstat-2.11.tar.gz) = FvDA9VVnWX1/LbUTaghYxW7/tEgaLIIaSM0EMupXIVA= -SIZE (qstat-2.11.tar.gz) = 258335 +SHA256 (qstat-2.14.tar.gz) = rpBrdNTM6AV7WiZbdoWRAdqBBMKgfAXxGlH3yfAz74s= +SIZE (qstat-2.14.tar.gz) = 210440 Index: patches/patch-utils_h =================================================================== RCS file: patches/patch-utils_h diff -N patches/patch-utils_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-utils_h 17 Feb 2018 22:03:59 -0000 @@ -0,0 +1,14 @@ +$OpenBSD$ + +Index: utils.h +--- utils.h.orig ++++ utils.h +@@ -8,7 +8,7 @@ + #define QSTAT_UTILS_H + + // BSD has strnstr +-#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__OpenBSD__) ++#if defined(__FreeBSD__) || defined(__MidnightBSD__) + #ifndef HAVE_STRNSTR + #define HAVE_STRNSTR 1 + #endif /* HAVE_STRNSTR */