security/samhain has been broken since the removal of sum(1).
The problem is the c_random.sh script, which returns a 16-bit random
number in decimal. Unless I'm missing something obvious, this is
surprisingly difficult to do in a semi-portable fashion at the shell
level.
I've settled on
printf %d `openssl rand -hex 2`
The other part is just re-indentation.
OK? Better ideas?
Index: patches/patch-c_random_sh
===================================================================
RCS file: patches/patch-c_random_sh
diff -N patches/patch-c_random_sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-c_random_sh 31 Mar 2014 18:51:46 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+--- c_random.sh.orig Tue Jun 14 14:04:56 2005
++++ c_random.sh Mon Mar 31 18:56:43 2014
+@@ -12,14 +12,23 @@ rnd_tst=no
+
+ /bin/rm -f ./my_random_file 2>/dev/null
+
+-if test -r "/dev/urandom"; then
+- if test -c "/dev/urandom"; then
+- dd if=/dev/urandom ibs=1 count=4 > my_random_file 2>/dev/null
+- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g'
2>/dev/null`
++if openssl version >/dev/null 2>&1 ; then
++ nsum=`printf %d 0x\`openssl rand -hex 2\``
+ if test x$nsum != x; then
+ rnd_tst=yes
+ fi
+- fi
++fi
++
++if test x$rnd_tst = xno; then
++ if test -r "/dev/urandom"; then
++ if test -c "/dev/urandom"; then
++ dd if=/dev/urandom ibs=1 count=4 > my_random_file 2>/dev/null
++ nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g'
2>/dev/null`
++ if test x$nsum != x; then
++ rnd_tst=yes
++ fi
++ fi
++ fi
+ fi
+
+ if test x$rnd_tst = xno; then
--
Christian "naddy" Weisgerber [email protected]