summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmish2020-04-23 19:42:54 +0530
committerAmish2020-04-23 19:42:54 +0530
commit7e7049ffdf6da8184aaee1bd1733d11eee2d26d9 (patch)
tree7f3238061123e1a084c51aa7319855fcfe756191
parentbb9b464f2f93021f18aafa843442e76f8a2d3eae (diff)
downloadaur-7e7049ffdf6da8184aaee1bd1733d11eee2d26d9.tar.gz
Gentoo patches and package improvements
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD57
-rw-r--r--barnyard2-1.13-Werror.patch17
-rw-r--r--barnyard2-1.13-free.patch11
-rw-r--r--barnyard2-1.13-libdir.patch112
-rw-r--r--barnyard2-1.13-my_bool.patch11
-rw-r--r--barnyard2-1.13-odbc.patch41
-rw-r--r--barnyard2-1.13-pcap-1.9.0.patch38
8 files changed, 282 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 72e8ffc0db8..a14f6404668 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
-*
+src
+pkg
+*x86_64.pkg.tar.xz
+barnyard2-*.tar.gz
diff --git a/PKGBUILD b/PKGBUILD
index c1776888bce..eab0eeeba86 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,5 @@
-# Maintainer: skogler
-
+# Maintainer: Amish <contact at via dot aur>
+# Contributor: skogler
pkgname=barnyard2
pkgver=1.13
pkgrel=1
@@ -7,21 +7,41 @@ pkgdesc="A dedicated spooler for Snort's unified2 binary output format."
arch=('i686' 'x86_64')
url="http://www.github.com/firnsy/barnyard2"
license=('GPL')
-depends=('libpcap' 'libmariadbclient')
+depends=('libpcap' 'mariadb-libs')
provides=('barnyard2')
conflicts=('barnyard2-git')
-options=()
-source=("https://github.com/firnsy/$pkgname/archive/v2-$pkgver.tar.gz")
-md5sums=('212066058364f18a4806720b271ffd87')
+backup=('etc/barnyard2/barnyard2.conf')
+source=("barnyard2-$pkgver.tar.gz::https://github.com/firnsy/$pkgname/archive/v2-$pkgver.tar.gz"
+ 'barnyard2-1.13-free.patch'
+ 'barnyard2-1.13-libdir.patch'
+ 'barnyard2-1.13-my_bool.patch'
+ 'barnyard2-1.13-odbc.patch'
+ 'barnyard2-1.13-Werror.patch'
+ 'barnyard2-1.13-pcap-1.9.0.patch')
+sha256sums=('b9e67f22334b937a59cf808ca20bdcd9c46561a4369979c965a0bb554d7dd09b'
+ 'c6f7be740df98017bcd9f79cf703e493a201adcfbfd45a371cd9b6e0f177fc6b'
+ 'c8ac95cc45a17d548a6331100d3ab26543278ea051a1f7f5f77db025ebd4417f'
+ '3fcae69a0e9b49a00d65557a35108b271c8890a7019b87b5f608fbafed2d54fb'
+ '3775bcffeaf9588a76006f275ade170b6f87147699fb50e75d2b9b07c8d139a5'
+ '3600ad80f463e58a14b66cc9e4d1262853555f74e0bc876b82aaf8b7a567e4e4'
+ '3bb6b787c4c66a67307ead1b91ba1ef99940894f825948402cfd6e0d50b893c1')
prepare() {
+ # patches from gentoo
+ # https://gitweb.gentoo.org/repo/gentoo.git/tree/net-analyzer/barnyard2/files
cd "$pkgname-2-$pkgver"
+ patch -p1 < "${srcdir}"/barnyard2-1.13-free.patch
+ patch -p1 < "${srcdir}"/barnyard2-1.13-libdir.patch
+ patch -p1 < "${srcdir}"/barnyard2-1.13-my_bool.patch
+ patch -p1 < "${srcdir}"/barnyard2-1.13-odbc.patch
+ patch -p1 < "${srcdir}"/barnyard2-1.13-Werror.patch
+ patch -p1 < "${srcdir}"/barnyard2-1.13-pcap-1.9.0.patch
}
build() {
cd "$pkgname-2-$pkgver"
./autogen.sh
- ./configure --prefix=/usr --sysconfdir=/etc/ --with-mysql --with-mysql- libraries=/usr/lib/
+ ./configure --prefix=/usr --sysconfdir=/etc/barnyard2 --with-mysql --disable-static
make
}
@@ -32,6 +52,25 @@ check() {
package() {
cd "$pkgname-2-$pkgver"
- make DESTDIR="$pkgdir/" install
- chmod 644 "$pkgdir/etc/barnyard2.conf"
+ make DESTDIR="$pkgdir" install
+ sed -i -e 's/^#\(config\s\+logdir:\s\+\).*/\1\/var\/log\/barnyard2/g' \
+ -e 's/^#\(config\s\+hostname:\s\+\).*/\1localhost/g' \
+ -e 's/^#\(config\s\+waldo_file:\s\+\).*/\1\/var\/log\/barnyard2\/barnyard2.waldo/g' \
+ -e 's/^\(#config\s\+pidpath:\s\+\).*/\1\/run\/barnyard2.pid/g' \
+ -e 's/^\(output\s\+alert_fast:\)/#\1/g' \
+ "${pkgdir}"/etc/barnyard2/barnyard2.conf
+ install -D -m644 -t "${pkgdir}"/usr/share/doc/barnyard2 doc/README*
+ install -D -m644 -t "${pkgdir}"/usr/share/doc/barnyard2/schemas schemas/create_* schemas/SCHEMA_ACCESS
+
+ echo "d /var/log/barnyard2 0750" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
+ install -D -m644 /dev/stdin "${pkgdir}"/etc/logrotate.d/barnyard2 << 'EOF'
+/var/log/barnyard2/*.log {
+ sharedscripts
+ missingok
+ notifempty
+ postrotate
+ /usr/bin/systemctl try-restart barnyard2.service > /dev/null 2>&1 || true
+ endscript
+}
+EOF
}
diff --git a/barnyard2-1.13-Werror.patch b/barnyard2-1.13-Werror.patch
new file mode 100644
index 00000000000..e3b8b9c9ae2
--- /dev/null
+++ b/barnyard2-1.13-Werror.patch
@@ -0,0 +1,17 @@
+--- a/configure.in
++++ b/configure.in
+@@ -12,14 +12,6 @@
+ NO_OPTIMIZE="no"
+ ADD_WERROR="no"
+
+-# Test for -Werror and sed it out for now since some of the auto tests,
+-# for example AC_CHECK_LIB, will fail because of
+-# warning: conflicting types for built-in function <func>
+-if eval "echo $CFLAGS | grep -e -Werror"; then
+- CFLAGS=`echo $CFLAGS | sed -e "s/-Werror//g"`
+- ADD_WERROR="yes"
+-fi
+-
+ # Disable annoying practice of recursively re-running the autotools
+ AM_MAINTAINER_MODE
+ AC_PROG_CC_STDC
diff --git a/barnyard2-1.13-free.patch b/barnyard2-1.13-free.patch
new file mode 100644
index 00000000000..216fe480de7
--- /dev/null
+++ b/barnyard2-1.13-free.patch
@@ -0,0 +1,11 @@
+--- a/src/output-plugins/spo_alert_unixsock.c
++++ b/src/output-plugins/spo_alert_unixsock.c
+@@ -56,6 +56,8 @@
+ #include "spo_alert_unixsock.h"
+ #include "barnyard2.h"
+
++#include <stdlib.h>
++
+ #define UNSOCK_FILE "barnyard2_alert"
+
+
diff --git a/barnyard2-1.13-libdir.patch b/barnyard2-1.13-libdir.patch
new file mode 100644
index 00000000000..5d3c7e37aa3
--- /dev/null
+++ b/barnyard2-1.13-libdir.patch
@@ -0,0 +1,112 @@
+--- a/configure.in
++++ b/configure.in
+@@ -570,53 +570,7 @@
+ fi
+ done
+
+- for i in $mysql_lib_directory; do
+- if test -z "$MYSQL_LIB_DIR"; then
+- str="$i/libmysqlclient.*"
+- for j in `echo $str`; do
+- if test -r $j; then
+- MYSQL_LIB_DIR=$i
+- break 2
+- fi
+- done
+- fi
+- if test -z "$MYSQL_LIB_DIR"; then
+- str="$i/lib/libmysqlclient.*"
+- for j in `echo $str`; do
+- if test -r "$j"; then
+- MYSQL_LIB_DIR="$i/lib"
+- break 2
+- fi
+- done
+- fi
+- if test -z "$MYSQL_LIB_DIR"; then
+- str="$i/mysql/libmysqlclient.*"
+- for j in `echo $str`; do
+- if test -r "$j"; then
+- MYSQL_LIB_DIR="$i/mysql"
+- break 2
+- fi
+- done
+- fi
+- if test -z "$MYSQL_LIB_DIR"; then
+- str="$i/mysql/lib/libmysqlclient.*"
+- for j in `echo $str`; do
+- if test -r "$j"; then
+- MYSQL_LIB_DIR="$i/mysql/lib"
+- break 2
+- fi
+- done
+- fi
+- if test -z "$MYSQL_LIB_DIR"; then
+- str="$i/lib/mysql/libmysqlclient.*"
+- for j in `echo $str`; do
+- if test -r "$j"; then
+- MYSQL_LIB_DIR="$i/lib/mysql"
+- break 2
+- fi
+- done
+- fi
+- done
++ AC_CHECK_LIB([mysqlclient],[mysql_query],[MYSQL_LIB_DIR="$libdir"])
+
+ if test -z "$MYSQL_INC_DIR"; then
+ if test "x$mysql_fail" != "xno"; then
+@@ -760,13 +714,7 @@
+ fi
+ else
+
+- str="$ODBC_DIR/lib/libodbc.*"
+- for j in `echo $str`; do
+- if test -r "$j"; then
+- ODBC_LIB_DIR="$ODBC_DIR/lib"
+- ODBC_LIB="odbc"
+- fi
+- done
++ AC_CHECK_LIB([odbc],[SQLAllocHandle],[ODBC_LIB_DIR="$libdir";ODBC_LIB="odbc"])
+
+ dnl if test -z "$ODBC_LIB_DIR"; then
+ dnl str="$ODBC_DIR/lib/libiodbc.*"
+@@ -786,7 +734,6 @@
+ fi
+ else
+ AC_MSG_RESULT(yes)
+- LDFLAGS="${LDFLAGS} -L${ODBC_LIB_DIR}"
+ CPPFLAGS="${CPPFLAGS} -I${ODBC_INC_DIR} -DENABLE_ODBC"
+ LIBS="${LIBS} -l$ODBC_LIB"
+ fi
+@@ -863,21 +810,7 @@
+ fi
+
+
+- if test -z "$POSTGRESQL_DIR"; then
+- for dir in $postgresql_directory; do
+- for i in "lib" "lib/pgsql"; do
+- str="$dir/$i/libpq.*"
+- for j in `echo $str`; do
+- if test -r $j; then
+- POSTGRESQL_LIB_DIR="$dir/$i"
+- break 2
+- fi
+- done
+- done
+- done
+- else
+- POSTGRESQL_LIB_DIR="$POSTGRESQL_DIR/lib"
+- fi
++ AC_CHECK_LIB([pq],[PQexec],[POSTGRESQL_LIB_DIR="$libdir"])
+
+ if test -z "$POSTGRESQL_LIB_DIR"; then
+ if test "$postgresql_fail" != "no"; then
+@@ -892,7 +825,7 @@
+ CPPFLAGS="${CPPFLAGS} -I${POSTGRESQL_INC_DIR} -DENABLE_POSTGRESQL"
+ AC_CHECK_LIB(pq, PQexec,, PQLIB="no")
+ if test "x$PQLIB" != "xno"; then
+- LIBS="${LIBS} -lpq"
++ :
+ else
+ echo
+ echo " ERROR! libpq (postgresql) not found!"
diff --git a/barnyard2-1.13-my_bool.patch b/barnyard2-1.13-my_bool.patch
new file mode 100644
index 00000000000..9cd93220662
--- /dev/null
+++ b/barnyard2-1.13-my_bool.patch
@@ -0,0 +1,11 @@
+--- a/src/output-plugins/spo_database.h
++++ b/src/output-plugins/spo_database.h
+@@ -357,7 +357,7 @@
+ /* Herited from shared data globals */
+
+ unsigned long pThreadID; /* Used to store thread information and know if we "reconnected automaticaly" */
+- my_bool mysql_reconnect; /* We will handle it via the api. */
++ u_int8_t mysql_reconnect; /* We will handle it via the api. */
+ #endif /* ENABLE_MYSQL */
+
+ #ifdef ENABLE_POSTGRESQL
diff --git a/barnyard2-1.13-odbc.patch b/barnyard2-1.13-odbc.patch
new file mode 100644
index 00000000000..a7d77ee914f
--- /dev/null
+++ b/barnyard2-1.13-odbc.patch
@@ -0,0 +1,41 @@
+--- a/src/output-plugins/spo_database_cache.c
++++ b/src/output-plugins/spo_database_cache.c
+@@ -1202,10 +1202,10 @@
+
+
+
+-#if (defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL))
++#if (defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC))
+ u_int32_t curr_row = 0;
+ u_int32_t queryColCount =0;
+-#endif /* (defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL)) */
++#endif /* (defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC)) */
+
+
+ #ifdef ENABLE_ODBC
+--- a/src/output-plugins/spo_database.c
++++ b/src/output-plugins/spo_database.c
+@@ -3443,9 +3443,9 @@
+ #endif
+
+
+-#if defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL)
++#if defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC)
+ int result = 0;
+-#endif /* defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) */
++#endif /* defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC) */
+
+
+ if( (query == NULL) ||
+@@ -3668,9 +3668,9 @@
+ int Select(char * query, DatabaseData * data,u_int32_t *rval)
+ {
+
+-#if defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL)
++#if defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC)
+ int result = 0;
+-#endif /* defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) */
++#endif /* defined(ENABLE_MYSQL) || defined(ENABLE_POSTGRESQL) || defined(ENABLE_ODBC) */
+
+ if( (query == NULL) ||
+ (data == NULL) ||
diff --git a/barnyard2-1.13-pcap-1.9.0.patch b/barnyard2-1.13-pcap-1.9.0.patch
new file mode 100644
index 00000000000..87aec539cae
--- /dev/null
+++ b/barnyard2-1.13-pcap-1.9.0.patch
@@ -0,0 +1,38 @@
+--- a/src/output-plugins/spo_alert_fwsam.c
++++ b/src/output-plugins/spo_alert_fwsam.c
+@@ -115,7 +115,7 @@
+ #include <sys/filio.h>
+ #endif
+
+-typedef int SOCKET;
++typedef int BY2_SOCKET;
+
+ #ifndef INVALID_SOCKET
+ #define INVALID_SOCKET -1
+@@ -961,7 +961,7 @@
+ FWsamPacket sampacket;
+ FWsamStation *station=NULL;
+ FWsamList *fwsamlist;
+- SOCKET stationsocket;
++ BY2_SOCKET stationsocket;
+ int i,len,deletestation,stationtry=0;
+ char *encbuf,*decbuf;
+ static unsigned long lastbsip[FWSAM_REPET_BLOCKS];
+@@ -1387,7 +1387,7 @@
+ void FWsamCheckOut(FWsamStation *station)
+ {
+ FWsamPacket sampacket;
+- SOCKET stationsocket;
++ BY2_SOCKET stationsocket;
+ int i,len;
+ char *encbuf,*decbuf;
+
+@@ -1538,7 +1538,7 @@
+ int i,len,stationok=TRUE;
+ FWsamPacket sampacket;
+ char *encbuf,*decbuf;
+- SOCKET stationsocket;
++ BY2_SOCKET stationsocket;
+
+
+ /* create a socket for the station */