audit: update to 2.8.5.
This commit is contained in:
parent
3431f146e4
commit
33357dbf12
|
@ -0,0 +1 @@
|
|||
python-audit is no longer provided by Void Linux, and will be fully removed from the repos on 2019-06-19.
|
|
@ -1,158 +1,97 @@
|
|||
Source: Hoshpak, based on earlier work by doughdemon
|
||||
Upstream: No
|
||||
Reason: musl compatibility
|
||||
From 81e3ac4db3e779f38e92cb9d9329db4cd76a8954 Mon Sep 17 00:00:00 2001
|
||||
From: Helmut Pozimski <helmut@pozimski.eu>
|
||||
Date: Fri, 21 Sep 2018 20:22:47 +0200
|
||||
Subject: [PATCH] conditionally switch to alternatives for strndupa and
|
||||
rawmemchr for non-glibc libcs
|
||||
From d579a08bb1cde71f939c13ac6b2261052ae9f77e Mon Sep 17 00:00:00 2001
|
||||
From: Steve Grubb <sgrubb@redhat.com>
|
||||
Date: Tue, 26 Feb 2019 18:33:33 -0500
|
||||
Subject: [PATCH] Add substitue functions for strndupa & rawmemchr
|
||||
|
||||
---
|
||||
auparse/auparse.c | 17 +++++++++++++----
|
||||
auparse/interpret.c | 4 ++++
|
||||
src/auditd.c | 7 ++++++-
|
||||
src/ausearch-lol.c | 16 ++++++++++++----
|
||||
4 files changed, 35 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/auparse/auparse.c b/auparse/auparse.c
|
||||
index 69127b7..9e444f6 100644
|
||||
diff --git auparse/auparse.c auparse/auparse.c
|
||||
index 69127b7a..042ea2b0 100644
|
||||
--- auparse/auparse.c
|
||||
+++ auparse/auparse.c
|
||||
@@ -1126,10 +1126,19 @@ static int extract_timestamp(const char *b, au_event_t *e)
|
||||
int rc = 1;
|
||||
@@ -1119,6 +1119,16 @@ static int str2event(char *s, au_event_t *e)
|
||||
return 0;
|
||||
}
|
||||
|
||||
e->host = NULL;
|
||||
- if (*b == 'n')
|
||||
- tmp = strndupa(b, 340);
|
||||
- else
|
||||
- tmp = strndupa(b, 80);
|
||||
+ #ifdef __GLIBC__
|
||||
+ tmp = alloca(340);
|
||||
+ if (*b == 'n')
|
||||
+ tmp = strndupa(b, 340);
|
||||
+ else
|
||||
+ tmp = strndupa(b, 80);
|
||||
+ #else
|
||||
+ tmp = alloca(340);
|
||||
+ if (*b == 'n')
|
||||
+ tmp = strncpy(tmp, b, 340);
|
||||
+ else
|
||||
+ tmp = strncpy(tmp, b, 80);
|
||||
+#ifndef HAVE_STRNDUPA
|
||||
+static inline char *strndupa(const char *old, size_t n)
|
||||
+{
|
||||
+ size_t len = strnlen(old, n);
|
||||
+ char *tmp = alloca(len + 1);
|
||||
+ tmp[len] = 0;
|
||||
+ return memcpy(tmp, old, len);
|
||||
+}
|
||||
+#endif
|
||||
ptr = audit_strsplit(tmp);
|
||||
if (ptr) {
|
||||
// Optionally grab the node - may or may not be included
|
||||
diff --git a/auparse/interpret.c b/auparse/interpret.c
|
||||
index 4783d86..d779fc7 100644
|
||||
+
|
||||
/* Returns 0 on success and 1 on error */
|
||||
static int extract_timestamp(const char *b, au_event_t *e)
|
||||
{
|
||||
diff --git auparse/interpret.c auparse/interpret.c
|
||||
index 88523c6d..f19ee854 100644
|
||||
--- auparse/interpret.c
|
||||
+++ auparse/interpret.c
|
||||
@@ -864,7 +864,11 @@ static const char *print_proctitle(const char *val)
|
||||
@@ -855,6 +855,13 @@ static const char *print_escaped_ext(const idata *id)
|
||||
return print_escaped(id->val);
|
||||
}
|
||||
|
||||
+// rawmemchr is faster. Let's use it if we have it.
|
||||
+#ifdef HAVE_RAWMEMCHR
|
||||
+#define STRCHR rawmemchr
|
||||
+#else
|
||||
+#define STRCHR strchr
|
||||
+#endif
|
||||
+
|
||||
static const char *print_proctitle(const char *val)
|
||||
{
|
||||
char *out = (char *)print_escaped(val);
|
||||
@@ -865,7 +872,7 @@ static const char *print_proctitle(const char *val)
|
||||
// Proctitle has arguments separated by NUL bytes
|
||||
// We need to write over the NUL bytes with a space
|
||||
// so that we can see the arguments
|
||||
+ #ifdef __GLIBC__
|
||||
while ((ptr = rawmemchr(ptr, '\0'))) {
|
||||
+ #else
|
||||
+ while (ptr < end) {
|
||||
+ #endif
|
||||
- while ((ptr = rawmemchr(ptr, '\0'))) {
|
||||
+ while ((ptr = STRCHR(ptr, '\0'))) {
|
||||
if (ptr >= end)
|
||||
break;
|
||||
*ptr = ' ';
|
||||
diff --git a/src/auditd.c b/src/auditd.c
|
||||
index 4939b5a..8ad08d8 100644
|
||||
--- src/auditd.c
|
||||
+++ src/auditd.c
|
||||
@@ -224,7 +224,12 @@ static int extract_type(const char *str)
|
||||
// ptr should be at 't'
|
||||
ptr2 = strchr(ptr, ' ');
|
||||
// get type=xxx in a buffer
|
||||
- tptr = strndupa(ptr, ptr2 - ptr);
|
||||
+ #ifdef __GLIBC__
|
||||
+ tptr = strndupa(ptr, ptr2 - ptr);
|
||||
+ #else
|
||||
+ tptr = alloca(ptr2 - ptr);
|
||||
+ tptr = strncpy(tptr, ptr, ptr2 - ptr);
|
||||
+ #endif
|
||||
// find =
|
||||
str = strchr(tptr, '=');
|
||||
if (str == NULL)
|
||||
diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c
|
||||
index ec6f453..51e7696 100644
|
||||
diff --git configure.ac configure.ac
|
||||
index acd6d615..00658d4f 100644
|
||||
--- configure.ac
|
||||
+++ configure.ac
|
||||
@@ -72,6 +72,18 @@ dnl; posix_fallocate is used in audisp-remote
|
||||
AC_CHECK_FUNCS([posix_fallocate])
|
||||
dnl; signalfd is needed for libev
|
||||
AC_CHECK_FUNC([signalfd], [], [ AC_MSG_ERROR([The signalfd system call is necessary for auditd]) ])
|
||||
+dnl; check if rawmemchr is available
|
||||
+AC_CHECK_FUNCS([rawmemchr])
|
||||
+dnl; check if strndupa is available
|
||||
+AC_LINK_IFELSE(
|
||||
+ [AC_LANG_SOURCE(
|
||||
+ [[
|
||||
+ #define _GNU_SOURCE
|
||||
+ #include <string.h>
|
||||
+ int main() { (void) strndupa("test", 10); return 0; }]])],
|
||||
+ [AC_DEFINE(HAVE_STRNDUPA, 1, [Let us know if we have it or not])],
|
||||
+ []
|
||||
+)
|
||||
|
||||
ALLWARNS=""
|
||||
ALLDEBUG="-g"
|
||||
diff --git src/ausearch-lol.c src/ausearch-lol.c
|
||||
index bebbcf4b..0babd517 100644
|
||||
--- src/ausearch-lol.c
|
||||
+++ src/ausearch-lol.c
|
||||
@@ -160,10 +160,18 @@ static int extract_timestamp(const char *b, event *e)
|
||||
char *ptr, *tmp, *tnode, *ttype;
|
||||
|
||||
e->node = NULL;
|
||||
- if (*b == 'n')
|
||||
- tmp = strndupa(b, 340);
|
||||
- else
|
||||
- tmp = strndupa(b, 80);
|
||||
+ #ifdef __GLIBC__
|
||||
+ if (*b == 'n')
|
||||
+ tmp = strndupa(b, 340);
|
||||
+ else
|
||||
+ tmp = strndupa(b, 80);
|
||||
+ #else
|
||||
+ tmp = alloca(340);
|
||||
+ if (*b == 'n')
|
||||
+ tmp = strncpy(tmp, b, 340);
|
||||
+ else
|
||||
+ tmp = strncpy(tmp, b, 80);
|
||||
+ #endif
|
||||
ptr = audit_strsplit(tmp);
|
||||
if (ptr) {
|
||||
// Check to see if this is the node info
|
||||
--
|
||||
2.19.0
|
||||
|
||||
From ca1590b95b3f786ca11f165656c31e525359e19c Mon Sep 17 00:00:00 2001
|
||||
From: Helmut Pozimski <helmut@pozimski.eu>
|
||||
Date: Fri, 21 Sep 2018 20:44:18 +0200
|
||||
Subject: [PATCH 2/2] replace usage of pthread_yield with sched_yield
|
||||
|
||||
---
|
||||
audisp/plugins/zos-remote/zos-remote-queue.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/audisp/plugins/zos-remote/zos-remote-queue.c b/audisp/plugins/zos-remote/zos-remote-queue.c
|
||||
index 8071dca..d5e30dd 100644
|
||||
--- audisp/plugins/zos-remote/zos-remote-queue.c
|
||||
+++ audisp/plugins/zos-remote/zos-remote-queue.c
|
||||
@@ -77,7 +77,7 @@ retry:
|
||||
pthread_mutex_unlock(&queue_lock);
|
||||
} else {
|
||||
pthread_mutex_unlock(&queue_lock);
|
||||
- pthread_yield(); /* Let dequeue thread run to clear queue */
|
||||
+ sched_yield(); /* Let dequeue thread run to clear queue */
|
||||
retry_cnt++;
|
||||
goto retry;
|
||||
@@ -152,6 +152,16 @@ static int compare_event_time(event *e1, event *e2)
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.19.0
|
||||
|
||||
From 5c52c6c662f0a3ab3b2f7a45024ef7aee9a6999d Mon Sep 17 00:00:00 2001
|
||||
From: Helmut Pozimski <helmut@pozimski.eu>
|
||||
Date: Fri, 21 Sep 2018 21:24:56 +0200
|
||||
Subject: [PATCH 3/3] change stdint include to import in auditswig.i to
|
||||
accomodate compilation on musl
|
||||
|
||||
---
|
||||
bindings/swig/src/auditswig.i | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i
|
||||
index 356a5ab..8ad09da 100644
|
||||
--- bindings/swig/src/auditswig.i
|
||||
+++ bindings/swig/src/auditswig.i
|
||||
@@ -41,6 +41,6 @@ typedef unsigned __u32;
|
||||
typedef unsigned uid_t;
|
||||
%include "/usr/include/linux/audit.h"
|
||||
#define __extension__ /*nothing*/
|
||||
-%include "/usr/include/stdint.h"
|
||||
+%import "/usr/include/stdint.h"
|
||||
%include "../lib/libaudit.h"
|
||||
|
||||
--
|
||||
2.19.0
|
||||
|
||||
+#ifndef HAVE_STRNDUPA
|
||||
+static inline char *strndupa(const char *old, size_t n)
|
||||
+{
|
||||
+ size_t len = strnlen(old, n);
|
||||
+ char *tmp = alloca(len + 1);
|
||||
+ tmp[len] = 0;
|
||||
+ return memcpy(tmp, old, len);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* This function will look at the line and pick out pieces of it.
|
||||
*/
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
# Template file for 'audit'
|
||||
pkgname=audit
|
||||
version=2.8.4
|
||||
revision=2
|
||||
version=2.8.5
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
configure_args="--libdir=/usr/lib --enable-shared=audit --enable-gssapi-krb5
|
||||
--with-apparmor --with-libcap-ng --with-python --with-python3"
|
||||
hostmakedepends="automake libtool pkg-config intltool python python3 swig"
|
||||
--with-apparmor --with-libcap-ng --with-python3"
|
||||
hostmakedepends="automake libtool pkg-config intltool python3 swig"
|
||||
makedepends="mit-krb5-devel libldap-devel libapparmor-devel libcap-ng-devel
|
||||
python-devel python3-devel"
|
||||
python3-devel"
|
||||
make_dirs="/var/log/audit 0700 root root"
|
||||
short_desc="Linux Security Auditing Framework"
|
||||
maintainer="Cameron Nemo <camerontnorman@gmail.com>"
|
||||
license="GPL-2.0-or-later, LGPL-2.0-or-later"
|
||||
homepage="https://people.redhat.com/sgrubb/audit"
|
||||
distfiles="${homepage}/${pkgname}-${version}.tar.gz"
|
||||
checksum=a410694d09fc5708d980a61a5abcb9633a591364f1ecc7e97ad5daef9c898c38
|
||||
checksum=0e5d4103646e00f8d1981e1cd2faea7a2ae28e854c31a803e907a383c5e2ecb7
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
pre_configure() {
|
||||
sed -i "s;^PYINCLUDEDIR=.*;PYINCLUDEDIR=${XBPS_CROSS_BASE}/usr/include/python${py2_ver};" configure
|
||||
}
|
||||
fi
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl) configure_args+=" --disable-zos-remote" ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
post_install() {
|
||||
vinstall rules/10-base-config.rules 644 etc/audit/rules.d
|
||||
vmkdir usr/share/examples/audit/rules.d
|
||||
vcopy "rules/*" usr/share/examples/audit/rules.d
|
||||
rm -rf "${DESTDIR}/etc/rc.d"
|
||||
rm -rf "${DESTDIR}/etc/sysconfig"
|
||||
rm -rf -- "${DESTDIR}/etc/rc.d"
|
||||
rm -rf -- "${DESTDIR}/etc/sysconfig"
|
||||
vsv auditd
|
||||
vsv auditctl
|
||||
}
|
||||
|
@ -85,12 +84,9 @@ libauparse-devel_package() {
|
|||
}
|
||||
|
||||
python-audit_package() {
|
||||
lib32disabled=yes
|
||||
short_desc+=" - Python2 bindings"
|
||||
pycompile_module="audit.py"
|
||||
pkg_install() {
|
||||
vmove "usr/lib/python2*"
|
||||
}
|
||||
archs=noarch
|
||||
build_style=meta
|
||||
short_desc+=" - Python2 bindings (removed package)"
|
||||
}
|
||||
|
||||
python3-audit_package() {
|
||||
|
|
Loading…
Reference in New Issue