From 7b51ba5bd48188c7f3010c6fe552a4af9bbe1574 Mon Sep 17 00:00:00 2001 From: Mihail Ivanchev Date: Sun, 2 Jun 2024 22:28:22 +0200 Subject: [PATCH] audit: update to 3.1.4 --- srcpkgs/audit/files/musl.patch | 64 ++++++++++++++++++++++++++++++++++ srcpkgs/audit/template | 13 +++++-- 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/audit/files/musl.patch diff --git a/srcpkgs/audit/files/musl.patch b/srcpkgs/audit/files/musl.patch new file mode 100644 index 00000000000000..dcd7f6330d4cf3 --- /dev/null +++ b/srcpkgs/audit/files/musl.patch @@ -0,0 +1,64 @@ +diff --git a/auparse/auparse.c b/auparse/auparse.c +index 20ebe4f8..ab3d3189 100644 +--- a/auparse/auparse.c ++++ b/auparse/auparse.c +@@ -1224,12 +1224,23 @@ static int extract_timestamp(const char *b, au_event_t *e) + { + char *ptr, *tmp; + int rc = 1; ++ size_t len; + + e->host = NULL; +- if (*b == 'n') +- tmp = strndupa(b, 340); +- else +- tmp = strndupa(b, 80); ++ if (*b == 'n') { ++ /* tmp = strndupa(b, 340); */ ++ len = strnlen(b, 340); ++ tmp = alloca(len + 1); ++ tmp[len] = 0; ++ memcpy(tmp, b, len); ++ } ++ else { ++ /* tmp = strndupa(b, 80); */ ++ len = strnlen(b, 80); ++ tmp = alloca(len + 1); ++ tmp[len] = 0; ++ memcpy(tmp, b, len); ++ } + ptr = audit_strsplit(tmp); + if (ptr) { + // Optionally grab the node - may or may not be included +diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c +index 9893afb0..4695817e 100644 +--- a/src/ausearch-lol.c ++++ b/src/ausearch-lol.c +@@ -178,12 +178,23 @@ static inline char *strndupa(const char *old, size_t n) + static int extract_timestamp(const char *b, event *e) + { + char *ptr, *tmp, *tnode, *ttype; ++ size_t len; + + e->node = NULL; +- if (*b == 'n') +- tmp = strndupa(b, 340); +- else +- tmp = strndupa(b, 80); ++ if (*b == 'n') { ++ /* tmp = strndupa(b, 340); */ ++ len = strnlen(b, 340); ++ tmp = alloca(len + 1); ++ tmp[len] = 0; ++ memcpy(tmp, b, len); ++ } ++ else { ++ /* tmp = strndupa(b, 80); */ ++ len = strnlen(b, 80); ++ tmp = alloca(len + 1); ++ tmp[len] = 0; ++ memcpy(tmp, b, len); ++ } + ptr = audit_strsplit(tmp); + if (ptr) { + // Check to see if this is the node info diff --git a/srcpkgs/audit/template b/srcpkgs/audit/template index 63913bc07c31b6..56f94480fbd23d 100644 --- a/srcpkgs/audit/template +++ b/srcpkgs/audit/template @@ -1,7 +1,7 @@ # Template file for 'audit' pkgname=audit -version=3.0.3 -revision=6 +version=3.1.4 +revision=1 build_style=gnu-configure configure_args="--libdir=/usr/lib --enable-shared=audit --enable-gssapi-krb5 --with-apparmor --with-libcap-ng --with-python3" @@ -15,13 +15,20 @@ license="GPL-2.0-or-later, LGPL-2.0-or-later" homepage="https://people.redhat.com/sgrubb/audit" changelog="https://raw.githubusercontent.com/linux-audit/audit-userspace/master/ChangeLog" distfiles="${homepage}/${pkgname}-${version}.tar.gz" -checksum=23777e1dc9a80a2ee06a4d442a6a0a9bcbf1ae7ee4b5738a220ff619738cc904 +checksum=220a78cf35e6a7c57f42fcfc42b759692641c7e8e0e39c9844fbc0aa51783631 case "$XBPS_TARGET_MACHINE" in *-musl) configure_args+=" --disable-zos-remote" ;; *) ;; esac +post_patch() { + case "$XBPS_TARGET_MACHINE" in + *-musl) patch -Np1 -i "${FILESDIR}/musl.patch" ;; + *) ;; + esac +} + post_install() { vinstall rules/10-base-config.rules 644 etc/audit/rules.d vmkdir usr/share/examples/audit/rules.d