David Hill [2013-09-24, 11:37:59]:
> Hello -
> 
> This patch replaces rand() calls with arc4random(), which happens to fix
> a regress test.  I also added --without-libnet to stop an ugly
> libnet-config not found on ./configure.  Maybe we want to add it?

makes sense, i'll add your patches with the update i sent a few days ago.

> 
> Tested on amd64 and i386 with my libivykis update.
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/syslog-ng/Makefile,v
> retrieving revision 1.37
> diff -u -p -r1.37 Makefile
> --- Makefile  19 Jun 2013 20:26:05 -0000      1.37
> +++ Makefile  24 Sep 2013 15:35:32 -0000
> @@ -7,6 +7,7 @@ SHARED_ONLY = Yes
>  V =          3.3.11
>  DISTNAME =   syslog-ng-$V
>  CATEGORIES = sysutils
> +REVISION =   0
>  
>  MAINTAINER = Steven Mestdagh <ste...@openbsd.org>
>  
> @@ -40,7 +41,8 @@ CONFIGURE_ARGS +=   --enable-tcp-wrapper \
>                       --with-libmongo-client=no \
>                       --disable-mongodb \
>                       --with-ivykis=system \
> -                     --enable-sql
> +                     --enable-sql \
> +                     --without-libnet
>  CONFIGURE_ENV +=     OPENSSL_CFLAGS="-I/usr/include/openssl" \
>                       OPENSSL_LIBS="-lssl -lcrypto" \
>                       LIBDBI_CFLAGS="-I/usr/include/openssl" \
> Index: patches/patch-lib_gsockaddr_c
> ===================================================================
> RCS file: patches/patch-lib_gsockaddr_c
> diff -N patches/patch-lib_gsockaddr_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-lib_gsockaddr_c     24 Sep 2013 15:35:32 -0000
> @@ -0,0 +1,12 @@
> +$OpenBSD$
> +--- lib/gsockaddr.c.orig     Fri Jun 14 07:54:20 2013
> ++++ lib/gsockaddr.c  Tue Sep 24 01:24:06 2013
> +@@ -355,7 +355,7 @@ g_sockaddr_inet_range_new(gchar *ip, guint16 min_port,
> +   addr->sa_funcs = &inet_range_sockaddr_funcs;
> +   if (max_port > min_port)
> +     {
> +-      addr->last_port = (rand() % (max_port - min_port)) + min_port;
> ++      addr->last_port = arc4random_uniform(max_port - min_port) + min_port;
> +     }
> +   addr->min_port = min_port;
> +   addr->max_port = max_port;
> Index: patches/patch-modules_afmongodb_libmongo-client_src_mongo-utils_c
> ===================================================================
> RCS file: patches/patch-modules_afmongodb_libmongo-client_src_mongo-utils_c
> diff -N patches/patch-modules_afmongodb_libmongo-client_src_mongo-utils_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-modules_afmongodb_libmongo-client_src_mongo-utils_c 24 Sep 
> 2013 15:35:32 -0000
> @@ -0,0 +1,13 @@
> +$OpenBSD$
> +--- modules/afmongodb/libmongo-client/src/mongo-utils.c.orig Fri Jun 14 
> 08:00:37 2013
> ++++ modules/afmongodb/libmongo-client/src/mongo-utils.c      Tue Sep 24 
> 01:44:07 2013
> +@@ -38,8 +38,7 @@ mongo_util_oid_init (gint32 mid)
> + 
> +   if (mid == 0)
> +     {
> +-      srand (time (NULL));
> +-      machine_id = rand ();
> ++      machine_id = arc4random();
> +     }
> +   else
> +     machine_id = mid;
> Index: patches/patch-modules_dbparser_patternize_c
> ===================================================================
> RCS file: patches/patch-modules_dbparser_patternize_c
> diff -N patches/patch-modules_dbparser_patternize_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-modules_dbparser_patternize_c       24 Sep 2013 15:35:32 
> -0000
> @@ -0,0 +1,14 @@
> +$OpenBSD$
> +--- modules/dbparser/patternize.c.orig       Fri Jun 14 07:54:20 2013
> ++++ modules/dbparser/patternize.c    Tue Sep 24 01:25:30 2013
> +@@ -168,9 +168,8 @@ ptz_find_frequent_words(GPtrArray *logs, guint support
> +           msg_progress("Finding frequent words",
> +                        evt_tag_str("phase", "caching"),
> +                        NULL);
> +-          srand(time(NULL));
> +           cachesize = (guint) ((logs->len * PTZ_WORDLIST_CACHE));
> +-          cacheseed = rand();
> ++          cacheseed = arc4random();
> +           wordlist_cache = g_new0(int, cachesize);
> +         }
> +       else
> 

Reply via email to