已开启
Update to version 3.1.5 #134
Funda Wang创建于 2024年8月9日
Update to version 3.1.5 #134
已开启
从refs/pull/134/head合入到master
共 38 个文件变更+28-3603
Binary files do not support preview
| @@ -1,50 +1,17 @@ | |||
| 1 | Summary: User space tools for kernel auditing | 1 | Summary: User space tools for kernel auditing |
| 2 | Name: audit | 2 | Name: audit |
| 3 | Epoch: 1 | 3 | Epoch: 1 |
| 4 | -Version: 3.1.2 | 4 | +Version: 3.1.5 |
| 5 | -Release: 7 | 5 | +Release: 1 |
| 6 | -License: GPLv2+ and LGPLv2+ | 6 | +License: GPL-2.0-or-later AND LGPL-2.0-or-later |
| 7 | URL: https://people.redhat.com/sgrubb/audit/ | 7 | URL: https://people.redhat.com/sgrubb/audit/ |
| 8 | Source0: https://people.redhat.com/sgrubb/audit/%{name}-%{version}.tar.gz | 8 | Source0: https://people.redhat.com/sgrubb/audit/%{name}-%{version}.tar.gz |
| 9 | -Source1: https://www.gnu.org/licenses/lgpl-2.1.txt | ||
| 10 | 9 | ||
| 11 | Patch0: bugfix-audit-support-armv7b.patch | 10 | Patch0: bugfix-audit-support-armv7b.patch |
| 12 | Patch1: bugfix-audit-userspace-missing-syscalls-for-aarm64.patch | 11 | Patch1: bugfix-audit-userspace-missing-syscalls-for-aarm64.patch |
| 13 | Patch2: bugfix-audit-reload-coredump.patch | 12 | Patch2: bugfix-audit-reload-coredump.patch |
| 14 | Patch3: audit-Add-sw64-architecture.patch | 13 | Patch3: audit-Add-sw64-architecture.patch |
| 15 | -Patch4: backport-Rewrite-legacy-service-functions-in-terms-of-systemc.patch | 14 | +Patch4: backport-ausearch-format-Fix-display-of-renamed-file-411.patch |
| 16 | -Patch5: backport-Error-out-if-required-zos-parameters-missing.patch | ||
| 17 | -Patch6: backport-Fix-deprecated-python-function.patch | ||
| 18 | -Patch7: backport-lib-close-audit-socket-in-load_feature_bitmap-334.patch | ||
| 19 | -Patch8: backport-lib-enclose-macro-to-avoid-precedence-issues.patch | ||
| 20 | -Patch9: backport-memory-allocation-updates-341.patch | ||
| 21 | -Patch10: backport-lib-cast-to-unsigned-char-for-character-test-functio.patch | ||
| 22 | -Patch11: backport-Make-session-id-consistently-typed-327.patch | ||
| 23 | -Patch12: backport-Avoid-file-descriptor-leaks-in-multi-threaded-applic.patch | ||
| 24 | -Patch13: backport-fix-the-use-of-isdigit-everywhere.patch | ||
| 25 | -Patch14: backport-Fix-new-warnings-for-unused-results.patch | ||
| 26 | -Patch15: backport-Change-the-first-iteration-test-so-static-analysis-b.patch | ||
| 27 | -Patch16: backport-Consolidate-end-of-event-detection-to-a-common-funct.patch | ||
| 28 | -Patch17: backport-Issue343-Fix-checkpoint-issue-to-ensure-all-complete.patch | ||
| 29 | -Patch18: backport-lib-avoid-UB-on-sequence-wrap-around-347.patch | ||
| 30 | -Patch19: backport-Change-python-bindings-to-switch-from-PyEval_CallObj.patch | ||
| 31 | -Patch20: backport-Cleanup-shell-script-warnings.patch | ||
| 32 | -Patch21: backport-Solve-issue-363-by-moving-check-to-after-load_config.patch | ||
| 33 | -Patch22: backport-first-part-of-NULL-pointer-checks.patch | ||
| 34 | -Patch23: backport-second-part-of-NULL-pointer-checks.patch | ||
| 35 | -Patch24: backport-last-part-of-NULL-pointer-checks.patch | ||
| 36 | -Patch25: backport-Fixed-NULL-checks.patch | ||
| 37 | -Patch26: backport-update-error-messages-in-NULL-Checks.patch | ||
| 38 | -Patch27: backport-adding-the-file-descriptor-closure.patch | ||
| 39 | -Patch28: backport-correcting-memcmp-args-in-check_rule_mismatch-functi.patch | ||
| 40 | -Patch29: backport-Use-atomic_int-if-available-for-signal-related-flags.patch | ||
| 41 | -Patch30: backport-Use-atomic_uint-if-available-for-signal-related-flag.patch | ||
| 42 | -Patch31: backport-avoiding-of-NULL-pointers-dereference-366.patch | ||
| 43 | -Patch32: backport-Cleanup-code-in-LRU.patch | ||
| 44 | -Patch33: backport-Fix-memory-leaks.patch | ||
| 45 | -Patch34: backport-fix-one-more-leak.patch | ||
| 46 | -Patch35: backport-Correct-output-when-displaying-rules-with-exe-path-d.patch | ||
| 47 | -Patch36: backport-ausearch-format-Fix-display-of-renamed-file-411.patch | ||
| 48 | 15 | ||
| 49 | BuildRequires: gcc swig libtool systemd kernel-headers >= 2.6.29 | 16 | BuildRequires: gcc swig libtool systemd kernel-headers >= 2.6.29 |
| 50 | BuildRequires: openldap-devel krb5-devel libcap-ng-devel | 17 | BuildRequires: openldap-devel krb5-devel libcap-ng-devel |
| @@ -64,7 +31,7 @@ kernels. | |||
| 64 | 31 | ||
| 65 | %package libs | 32 | %package libs |
| 66 | Summary: Dynamic library for libaudit | 33 | Summary: Dynamic library for libaudit |
| 67 | -License: LGPLv2+ | 34 | +License: LGPL-2.0-or-later |
| 68 | 35 | ||
| 69 | %description libs | 36 | %description libs |
| 70 | The audit-libs package contains the dynamic libraries needed for | 37 | The audit-libs package contains the dynamic libraries needed for |
| @@ -72,7 +39,7 @@ applications to use the audit framework. | |||
| 72 | 39 | ||
| 73 | %package -n audispd-plugins | 40 | %package -n audispd-plugins |
| 74 | Summary: Plugins for audit event dispatcher | 41 | Summary: Plugins for audit event dispatcher |
| 75 | -License: GPLv2+ | 42 | +License: GPL-2.0-or-later |
| 76 | Requires: %{name} = %{epoch}:%{version}-%{release} | 43 | Requires: %{name} = %{epoch}:%{version}-%{release} |
| 77 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} | 44 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} |
| 78 | 45 | ||
| @@ -81,7 +48,7 @@ This package provides plugins for the real-time interface to audispd. | |||
| 81 | 48 | ||
| 82 | %package -n audispd-plugins-zos | 49 | %package -n audispd-plugins-zos |
| 83 | Summary: z/OS plugin for audit event dispatcher | 50 | Summary: z/OS plugin for audit event dispatcher |
| 84 | -License: GPLv2+ | 51 | +License: GPL-2.0-or-later |
| 85 | Requires: %{name} = %{epoch}:%{version}-%{release} | 52 | Requires: %{name} = %{epoch}:%{version}-%{release} |
| 86 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} | 53 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} |
| 87 | Requires: openldap | 54 | Requires: openldap |
| @@ -93,7 +60,7 @@ database. | |||
| 93 | 60 | ||
| 94 | %package devel | 61 | %package devel |
| 95 | Summary: Header files for libaudit | 62 | Summary: Header files for libaudit |
| 96 | -License: LGPLv2+ | 63 | +License: LGPL-2.0-or-later |
| 97 | Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} | 64 | Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} |
| 98 | Requires: kernel-headers >= 2.6.29 | 65 | Requires: kernel-headers >= 2.6.29 |
| 99 | Provides: audit-libs-devel audit-libs-static | 66 | Provides: audit-libs-devel audit-libs-static |
| @@ -104,7 +71,7 @@ applications that need to use the audit framework libraries. | |||
| 104 | 71 | ||
| 105 | %package -n python3-audit | 72 | %package -n python3-audit |
| 106 | Summary: Python3 bindings for libaudit | 73 | Summary: Python3 bindings for libaudit |
| 107 | -License: LGPLv2+ | 74 | +License: LGPL-2.0-or-later |
| 108 | BuildRequires: python3-devel | 75 | BuildRequires: python3-devel |
| 109 | Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} | 76 | Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} |
| 110 | Provides: audit-libs-python3 = %{version}-%{release} | 77 | Provides: audit-libs-python3 = %{version}-%{release} |
| @@ -119,11 +86,10 @@ libauparse can be used by python3. | |||
| 119 | 86 | ||
| 120 | %prep | 87 | %prep |
| 121 | %autosetup -n %{name}-%{version} -p1 | 88 | %autosetup -n %{name}-%{version} -p1 |
| 122 | -cp %{SOURCE1} . | ||
| 123 | cp /usr/include/linux/audit.h lib/ | 89 | cp /usr/include/linux/audit.h lib/ |
| 124 | -autoreconf -f -i | ||
| 125 | 90 | ||
| 126 | %build | 91 | %build |
| 92 | +autoreconf -fi | ||
| 127 | %configure --sbindir=/sbin --libdir=/%{_lib} --with-python=no \ | 93 | %configure --sbindir=/sbin --libdir=/%{_lib} --with-python=no \ |
| 128 | --with-python3=yes \ | 94 | --with-python3=yes \ |
| 129 | --enable-gssapi-krb5=yes --with-arm --with-aarch64 \ | 95 | --enable-gssapi-krb5=yes --with-arm --with-aarch64 \ |
| @@ -133,7 +99,7 @@ autoreconf -f -i | |||
| 133 | %endif | 99 | %endif |
| 134 | --enable-systemd | 100 | --enable-systemd |
| 135 | 101 | ||
| 136 | -make CC=%{__cc} CFLAGS="%{optflags}" %{?_smp_mflags} | 102 | +%make_build |
| 137 | 103 | ||
| 138 | %install | 104 | %install |
| 139 | mkdir -p $RPM_BUILD_ROOT/{sbin,etc/audit/plugins.d,etc/audit/rules.d} | 105 | mkdir -p $RPM_BUILD_ROOT/{sbin,etc/audit/plugins.d,etc/audit/rules.d} |
| @@ -142,7 +108,7 @@ mkdir -p $RPM_BUILD_ROOT/%{_lib} | |||
| 142 | mkdir -p $RPM_BUILD_ROOT/%{_libdir}/audit | 108 | mkdir -p $RPM_BUILD_ROOT/%{_libdir}/audit |
| 143 | mkdir -p --mode=0700 $RPM_BUILD_ROOT/%{_var}/log/audit | 109 | mkdir -p --mode=0700 $RPM_BUILD_ROOT/%{_var}/log/audit |
| 144 | mkdir -p $RPM_BUILD_ROOT/%{_var}/spool/audit | 110 | mkdir -p $RPM_BUILD_ROOT/%{_var}/spool/audit |
| 145 | -make DESTDIR=$RPM_BUILD_ROOT install | 111 | +%make_install |
| 146 | 112 | ||
| 147 | mkdir -p $RPM_BUILD_ROOT/%{_libdir} | 113 | mkdir -p $RPM_BUILD_ROOT/%{_libdir} |
| 148 | mv $RPM_BUILD_ROOT/%{_lib}/libaudit.a $RPM_BUILD_ROOT%{_libdir} | 114 | mv $RPM_BUILD_ROOT/%{_lib}/libaudit.a $RPM_BUILD_ROOT%{_libdir} |
| @@ -162,7 +128,7 @@ find $RPM_BUILD_ROOT/%{_libdir}/python%{python3_version}/site-packages -name '*. | |||
| 162 | mv $RPM_BUILD_ROOT/%{_lib}/pkgconfig $RPM_BUILD_ROOT%{_libdir} | 128 | mv $RPM_BUILD_ROOT/%{_lib}/pkgconfig $RPM_BUILD_ROOT%{_libdir} |
| 163 | 129 | ||
| 164 | touch -r ./audit.spec $RPM_BUILD_ROOT/etc/libaudit.conf | 130 | touch -r ./audit.spec $RPM_BUILD_ROOT/etc/libaudit.conf |
| 165 | -touch -r ./audit.spec $RPM_BUILD_ROOT/usr/share/man/man5/libaudit.conf.5.gz | 131 | +touch -r ./audit.spec $RPM_BUILD_ROOT/usr/share/man/man5/libaudit.conf.5 |
| 166 | 132 | ||
| 167 | cur=`pwd` | 133 | cur=`pwd` |
| 168 | cd $RPM_BUILD_ROOT | 134 | cd $RPM_BUILD_ROOT |
| @@ -172,7 +138,7 @@ cd $cur | |||
| 172 | %delete_la | 138 | %delete_la |
| 173 | 139 | ||
| 174 | %check | 140 | %check |
| 175 | -make check | 141 | +%make_build check |
| 176 | rm -f rules/Makefile* | 142 | rm -f rules/Makefile* |
| 177 | 143 | ||
| 178 | %pre | 144 | %pre |
| @@ -200,7 +166,6 @@ if [ -d "/etc/audisp/" ];then | |||
| 200 | fi | 166 | fi |
| 201 | 167 | ||
| 202 | %post | 168 | %post |
| 203 | -/sbin/ldconfig | ||
| 204 | files=`ls /etc/audit/rules.d/ 2>/dev/null | wc -w` | 169 | files=`ls /etc/audit/rules.d/ 2>/dev/null | wc -w` |
| 205 | if [ "$files" -eq 0 ] ; then | 170 | if [ "$files" -eq 0 ] ; then |
| 206 | if [ -e /usr/share/doc/audit/rules/10-no-audit.rules ] ; then | 171 | if [ -e /usr/share/doc/audit/rules/10-no-audit.rules ] ; then |
| @@ -296,15 +261,13 @@ if [ $1 -eq 0 ]; then | |||
| 296 | fi | 261 | fi |
| 297 | 262 | ||
| 298 | %postun | 263 | %postun |
| 299 | -/sbin/ldconfig | ||
| 300 | if [ $1 -ge 1 ]; then | 264 | if [ $1 -ge 1 ]; then |
| 301 | /sbin/service auditd condrestart > /dev/null 2>&1 || : | 265 | /sbin/service auditd condrestart > /dev/null 2>&1 || : |
| 302 | fi | 266 | fi |
| 303 | 267 | ||
| 304 | %files | 268 | %files |
| 305 | %doc README | 269 | %doc README |
| 306 | -%{!?_licensedir:%global license %%doc} | 270 | +%license COPYING COPYING.LIB |
| 307 | -%license COPYING lgpl-2.1.txt | ||
| 308 | %attr(755,root,root) /sbin/auditctl | 271 | %attr(755,root,root) /sbin/auditctl |
| 309 | %attr(755,root,root) /sbin/auditd | 272 | %attr(755,root,root) /sbin/auditd |
| 310 | %attr(755,root,root) /sbin/ausearch | 273 | %attr(755,root,root) /sbin/ausearch |
| @@ -355,10 +318,8 @@ fi | |||
| 355 | %attr(750,root,root) /sbin/audispd-zos-remote | 318 | %attr(750,root,root) /sbin/audispd-zos-remote |
| 356 | 319 | ||
| 357 | %files devel | 320 | %files devel |
| 358 | -%defattr(-,root,root) | ||
| 359 | %doc contrib/plugin | 321 | %doc contrib/plugin |
| 360 | -%{!?_licensedir:%global license %%doc} | 322 | +%license COPYING.LIB |
| 361 | -%license lgpl-2.1.txt | ||
| 362 | %{_libdir}/libaudit.so | 323 | %{_libdir}/libaudit.so |
| 363 | %{_libdir}/libauparse.so | 324 | %{_libdir}/libauparse.so |
| 364 | %ifarch %{golang_arches} | 325 | %ifarch %{golang_arches} |
| @@ -378,22 +339,21 @@ fi | |||
| 378 | %attr(755,root,root) %{python3_sitearch}/* | 339 | %attr(755,root,root) %{python3_sitearch}/* |
| 379 | 340 | ||
| 380 | %files help | 341 | %files help |
| 381 | -%defattr(-,root,root) | ||
| 382 | %doc ChangeLog rules init.d/auditd.cron | 342 | %doc ChangeLog rules init.d/auditd.cron |
| 383 | -%attr(644,root,root) %{_datadir}/%{name}/sample-rules/* | 343 | +%{_datadir}/%{name}/sample-rules/* |
| 384 | -%attr(644,root,root) %{_mandir}/man3/*.3.gz | 344 | +%{_mandir}/man?/* |
| 385 | -%attr(644,root,root) %{_mandir}/man5/*.5.gz | ||
| 386 | -%attr(644,root,root) %{_mandir}/man7/*.7.gz | ||
| 387 | -%attr(644,root,root) %{_mandir}/man8/*.8.gz | ||
| 388 | 345 | ||
| 389 | %changelog | 346 | %changelog |
| 347 | +* Wed Dec 25 2024 Funda Wang <fundawang@yeah.net> - 1:3.1.5-1 | ||
| 348 | +- update to 3.1.5 | ||
| 349 | + | ||
| 390 | * Wed Dec 11 2024 wangjiang <app@cameyan.coom> - 1:3.1.2-7 | 350 | * Wed Dec 11 2024 wangjiang <app@cameyan.coom> - 1:3.1.2-7 |
| 391 | - backport patches to fix bug | 351 | - backport patches to fix bug |
| 392 | 352 | ||
| 393 | -* Sat Aug 24 2024 xuraoqing<xuraoqing@huawei.com> - 1:3.1.2-6 | 353 | +* Sat Aug 24 2024 xuraoqing <xuraoqing@huawei.com> - 1:3.1.2-6 |
| 394 | - backport patches to fix bug | 354 | - backport patches to fix bug |
| 395 | 355 | ||
| 396 | -* Wed Jul 17 2024 xuraoqing<xuraoqing@huawei.com> - 1:3.1.2-5 | 356 | +* Wed Jul 17 2024 xuraoqing <xuraoqing@huawei.com> - 1:3.1.2-5 |
| 397 | - backport patches to fix bugs | 357 | - backport patches to fix bugs |
| 398 | 358 | ||
| 399 | * Thu Jun 06 2024 fuanan <fuanan3@h-partners.com> - 1:3.1.2-4 | 359 | * Thu Jun 06 2024 fuanan <fuanan3@h-partners.com> - 1:3.1.2-4 |
| @@ -1,4 +1,4 @@ | |||
| 1 | version_control: github | 1 | version_control: github |
| 2 | src_repo: linux-audit/audit-userspace | 2 | src_repo: linux-audit/audit-userspace |
| 3 | tag_prefix: ^v | 3 | tag_prefix: ^v |
| 4 | -seperator: . | 4 | +separator: . |
| @@ -1,137 +0,0 @@ | |||
| 1 | -From 2663987c5088924bce510fcf8e7891d6aae976ba Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: cgzones <cgzones@googlemail.com> | ||
| 3 | -Date: Sat, 4 Nov 2023 03:48:39 +0100 | ||
| 4 | -Subject: [PATCH] Avoid file descriptor leaks in multi-threaded applications | ||
| 5 | - (#339) | ||
| 6 | - | ||
| 7 | -* lib: set close-on-exec flag | ||
| 8 | - | ||
| 9 | -libaudit may be called from a multi-threaded application. | ||
| 10 | -Avoid leaking local file descriptors on a concurrent execve. | ||
| 11 | - | ||
| 12 | -* lib: simplify SOCK_CLOEXEC | ||
| 13 | - | ||
| 14 | -SOCK_CLOEXEC is supported since Linux 2.6.27. | ||
| 15 | - | ||
| 16 | -Reference:https://github.com/linux-audit/audit-userspace/commit/2663987c5088924bce510fcf8e7891d6aae976ba | ||
| 17 | -Conflict:lib/audit_logging.c,lib/netlink.c,lib/libaudit.c | ||
| 18 | - | ||
| 19 | ---- | ||
| 20 | - lib/audit_logging.c | 2 +- | ||
| 21 | - lib/libaudit.c | 14 +++++++------- | ||
| 22 | - lib/netlink.c | 12 +----------- | ||
| 23 | - 3 files changed, 9 insertions(+), 19 deletions(-) | ||
| 24 | - | ||
| 25 | -diff --git a/lib/audit_logging.c b/lib/audit_logging.c | ||
| 26 | -index 302c242..08b53aa 100644 | ||
| 27 | ---- a/lib/audit_logging.c | ||
| 28 | -+++ b/lib/audit_logging.c | ||
| 29 | -@@ -177,7 +177,7 @@ static char *_get_commname(const char *comm, char *commname, unsigned int size) | ||
| 30 | - | ||
| 31 | - if (comm == NULL) { | ||
| 32 | - int len; | ||
| 33 | -- int fd = open("/proc/self/comm", O_RDONLY); | ||
| 34 | -+ int fd = open("/proc/self/comm", O_RDONLY|O_CLOEXEC); | ||
| 35 | - if (fd < 0) { | ||
| 36 | - strcpy(commname, "\"?\""); | ||
| 37 | - return commname; | ||
| 38 | -diff --git a/lib/libaudit.c b/lib/libaudit.c | ||
| 39 | -index 2cc7afd..74fa2f3 100644 | ||
| 40 | ---- a/lib/libaudit.c | ||
| 41 | -+++ b/lib/libaudit.c | ||
| 42 | -@@ -221,7 +221,7 @@ static int load_libaudit_config(const char *path) | ||
| 43 | - char buf[128]; | ||
| 44 | - | ||
| 45 | - /* open the file */ | ||
| 46 | -- rc = open(path, O_NOFOLLOW|O_RDONLY); | ||
| 47 | -+ rc = open(path, O_NOFOLLOW|O_RDONLY|O_CLOEXEC); | ||
| 48 | - if (rc < 0) { | ||
| 49 | - if (errno != ENOENT) { | ||
| 50 | - audit_msg(LOG_ERR, "Error opening %s (%s)", | ||
| 51 | -@@ -261,7 +261,7 @@ static int load_libaudit_config(const char *path) | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - /* it's ok, read line by line */ | ||
| 55 | -- f = fdopen(fd, "rm"); | ||
| 56 | -+ f = fdopen(fd, "rme"); | ||
| 57 | - if (f == NULL) { | ||
| 58 | - audit_msg(LOG_ERR, "Error - fdopen failed (%s)", | ||
| 59 | - strerror(errno)); | ||
| 60 | -@@ -705,7 +705,7 @@ char *audit_format_signal_info(char *buf, int len, char *op, | ||
| 61 | - char path[32], ses[16]; | ||
| 62 | - int rlen; | ||
| 63 | - snprintf(path, sizeof(path), "/proc/%u", rep->signal_info->pid); | ||
| 64 | -- int fd = open(path, O_RDONLY); | ||
| 65 | -+ int fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC); | ||
| 66 | - if (fd >= 0) { | ||
| 67 | - if (fstat(fd, &sb) < 0) | ||
| 68 | - sb.st_uid = -1; | ||
| 69 | -@@ -714,7 +714,7 @@ char *audit_format_signal_info(char *buf, int len, char *op, | ||
| 70 | - sb.st_uid = -1; | ||
| 71 | - snprintf(path, sizeof(path), "/proc/%u/sessionid", | ||
| 72 | - rep->signal_info->pid); | ||
| 73 | -- fd = open(path, O_RDONLY, rep->signal_info->pid); | ||
| 74 | -+ fd = open(path, O_RDONLY|O_CLOEXEC, rep->signal_info->pid); | ||
| 75 | - if (fd < 0) | ||
| 76 | - strcpy(ses, "4294967295"); | ||
| 77 | - else { | ||
| 78 | -@@ -918,7 +918,7 @@ uid_t audit_getloginuid(void) | ||
| 79 | - char buf[16]; | ||
| 80 | - | ||
| 81 | - errno = 0; | ||
| 82 | -- in = open("/proc/self/loginuid", O_NOFOLLOW|O_RDONLY); | ||
| 83 | -+ in = open("/proc/self/loginuid", O_NOFOLLOW|O_RDONLY|O_CLOEXEC); | ||
| 84 | - if (in < 0) | ||
| 85 | - return -1; | ||
| 86 | - do { | ||
| 87 | -@@ -946,7 +946,7 @@ int audit_setloginuid(uid_t uid) | ||
| 88 | - | ||
| 89 | - errno = 0; | ||
| 90 | - count = snprintf(loginuid, sizeof(loginuid), "%u", uid); | ||
| 91 | -- o = open("/proc/self/loginuid", O_NOFOLLOW|O_WRONLY|O_TRUNC); | ||
| 92 | -+ o = open("/proc/self/loginuid", O_NOFOLLOW|O_WRONLY|O_TRUNC|O_CLOEXEC); | ||
| 93 | - if (o >= 0) { | ||
| 94 | - int block, offset = 0; | ||
| 95 | - | ||
| 96 | -@@ -982,7 +982,7 @@ uint32_t audit_get_session(void) | ||
| 97 | - char buf[16]; | ||
| 98 | - | ||
| 99 | - errno = 0; | ||
| 100 | -- in = open("/proc/self/sessionid", O_NOFOLLOW|O_RDONLY); | ||
| 101 | -+ in = open("/proc/self/sessionid", O_NOFOLLOW|O_RDONLY|O_CLOEXEC); | ||
| 102 | - if (in < 0) | ||
| 103 | - return -2; | ||
| 104 | - do { | ||
| 105 | -diff --git a/lib/netlink.c b/lib/netlink.c | ||
| 106 | -index 66a1e7c..f862da4 100644 | ||
| 107 | ---- a/lib/netlink.c | ||
| 108 | -+++ b/lib/netlink.c | ||
| 109 | -@@ -47,7 +47,7 @@ static int check_ack(int fd); | ||
| 110 | - int audit_open(void) | ||
| 111 | - { | ||
| 112 | - int saved_errno; | ||
| 113 | -- int fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_AUDIT); | ||
| 114 | -+ int fd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_AUDIT); | ||
| 115 | - | ||
| 116 | - if (fd < 0) { | ||
| 117 | - saved_errno = errno; | ||
| 118 | -@@ -60,16 +60,6 @@ int audit_open(void) | ||
| 119 | - "Error opening audit netlink socket (%s)", | ||
| 120 | - strerror(errno)); | ||
| 121 | - errno = saved_errno; | ||
| 122 | -- return fd; | ||
| 123 | -- } | ||
| 124 | -- if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { | ||
| 125 | -- saved_errno = errno; | ||
| 126 | -- audit_msg(LOG_ERR, | ||
| 127 | -- "Error setting audit netlink socket CLOEXEC flag (%s)", | ||
| 128 | -- strerror(errno)); | ||
| 129 | -- close(fd); | ||
| 130 | -- errno = saved_errno; | ||
| 131 | -- return -1; | ||
| 132 | - } | ||
| 133 | - return fd; | ||
| 134 | - } | ||
| 135 | --- | ||
| 136 | -2.33.0 | ||
| 137 | - | ||
| @@ -1,30 +0,0 @@ | |||
| 1 | -From cd7599210fe398360ddb81c0c2453a085d408089 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Mon, 19 Feb 2024 10:50:42 -0500 | ||
| 4 | -Subject: [PATCH] Change python bindings to switch from PyEval_CallObject on | ||
| 5 | - 3.12 and later to silence warning | ||
| 6 | - | ||
| 7 | - | ||
| 8 | -Reference:https://github.com/linux-audit/audit-userspace/commit/cd7599210fe398360ddb81c0c2453a085d408089 | ||
| 9 | -Conflict:NA | ||
| 10 | - | ||
| 11 | ---- | ||
| 12 | - bindings/python/auparse_python.c | 2 +- | ||
| 13 | - 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 14 | - | ||
| 15 | -diff --git a/bindings/python/auparse_python.c b/bindings/python/auparse_python.c | ||
| 16 | -index 99d37cca..9ab919b3 100644 | ||
| 17 | ---- a/bindings/python/auparse_python.c | ||
| 18 | -+++ b/bindings/python/auparse_python.c | ||
| 19 | -@@ -290,7 +290,7 @@ static void auparse_callback(auparse_state_t *au, | ||
| 20 | - if (debug) printf("<< auparse_callback\n"); | ||
| 21 | - arglist = Py_BuildValue("OiO", cb->py_AuParser, cb_event_type, | ||
| 22 | - cb->user_data); | ||
| 23 | --#if PY_MINOR_VERSION >= 13 | ||
| 24 | -+#if PY_MINOR_VERSION >= 12 | ||
| 25 | - result = PyObject_CallObject(cb->func, arglist); | ||
| 26 | - #else | ||
| 27 | - result = PyEval_CallObject(cb->func, arglist); | ||
| 28 | --- | ||
| 29 | -2.33.0 | ||
| 30 | - | ||
| @@ -1,39 +0,0 @@ | |||
| 1 | -From b84b007cd0ef504e8c86b8cc73646f3119ed343c Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Wed, 29 Nov 2023 15:49:21 -0500 | ||
| 4 | -Subject: [PATCH] Change the first iteration test so static analysis better | ||
| 5 | - understands the code | ||
| 6 | - | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/b84b007cd0ef504e8c86b8cc73646f3119ed343c | ||
| 8 | -Conflict:NA | ||
| 9 | - | ||
| 10 | ---- | ||
| 11 | - tools/aulast/aulast-llist.c | 10 +++++++--- | ||
| 12 | - 1 file changed, 7 insertions(+), 3 deletions(-) | ||
| 13 | - | ||
| 14 | -diff --git a/tools/aulast/aulast-llist.c b/tools/aulast/aulast-llist.c | ||
| 15 | -index 87638ebc..d7765ba4 100644 | ||
| 16 | ---- a/tools/aulast/aulast-llist.c | ||
| 17 | -+++ b/tools/aulast/aulast-llist.c | ||
| 18 | -@@ -140,11 +140,15 @@ int list_update_logout(llist* l, time_t t, unsigned long serial) | ||
| 19 | - lnode *list_delete_cur(llist *l) | ||
| 20 | - { | ||
| 21 | - register lnode *cur, *prev; | ||
| 22 | -- | ||
| 23 | -- prev = cur = l->head; /* start at the beginning */ | ||
| 24 | -+ | ||
| 25 | -+ if (l == NULL || l->head == NULL) | ||
| 26 | -+ return NULL; | ||
| 27 | -+ | ||
| 28 | -+ prev = cur = l->head; /* start at the beginning */ | ||
| 29 | - while (cur) { | ||
| 30 | - if (cur == l->cur) { | ||
| 31 | -- if (cur == prev && cur == l->head) { | ||
| 32 | -+ // If the first iteration | ||
| 33 | -+ if (prev == l->head && cur == l->head) { | ||
| 34 | - l->head = cur->next; | ||
| 35 | - l->cur = cur->next; | ||
| 36 | - free((void *)cur->name); | ||
| 37 | --- | ||
| 38 | -2.33.0 | ||
| 39 | - | ||
| @@ -1,77 +0,0 @@ | |||
| 1 | -From 4939b8541322cbf3a53affc28e71ce53d92f121f Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Fri, 3 May 2024 17:50:35 -0400 | ||
| 4 | -Subject: [PATCH] Cleanup code in LRU | ||
| 5 | - | ||
| 6 | -Dont dereference anything until after checking if the queue is not empty. | ||
| 7 | -Also, leave a note disputing static analysis thinking there is a use after | ||
| 8 | -free destroying the queue. | ||
| 9 | - | ||
| 10 | -Conflict:NA | ||
| 11 | -Reference:https://github.com/linux-audit/audit-userspace/commit/4939b8541322cbf3a53affc28e71ce53d92f121f | ||
| 12 | - | ||
| 13 | ---- | ||
| 14 | - auparse/lru.c | 20 ++++++++++++-------- | ||
| 15 | - 1 file changed, 12 insertions(+), 8 deletions(-) | ||
| 16 | - | ||
| 17 | -diff --git a/auparse/lru.c b/auparse/lru.c | ||
| 18 | -index 05c4088d..f30bcf41 100644 | ||
| 19 | ---- a/auparse/lru.c | ||
| 20 | -+++ b/auparse/lru.c | ||
| 21 | -@@ -116,6 +116,11 @@ static void destroy_queue(Queue *queue) | ||
| 22 | - dump_queue_stats(queue); | ||
| 23 | - #endif | ||
| 24 | - | ||
| 25 | -+ // Some static analysis scanners try to flag this as a use after | ||
| 26 | -+ // free accessing queue->end. This is a false positive. It is freed. | ||
| 27 | -+ // However, static analysis apps are incapable of seeing that in | ||
| 28 | -+ // remove_node, end is updated to a prior node as part of detaching | ||
| 29 | -+ // the current end node. | ||
| 30 | - while (queue->count) | ||
| 31 | - dequeue(queue); | ||
| 32 | - | ||
| 33 | -@@ -252,34 +257,33 @@ out: | ||
| 34 | - sanity_check_queue(queue, "2 remove_node"); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | --// Remove from the end of the queue | ||
| 38 | -+// Remove from the end of the queue | ||
| 39 | - static void dequeue(Queue *queue) | ||
| 40 | - { | ||
| 41 | -- QNode *temp = queue->end; | ||
| 42 | -- | ||
| 43 | - if (queue_is_empty(queue)) | ||
| 44 | - return; | ||
| 45 | - | ||
| 46 | -+ QNode *temp = queue->end; | ||
| 47 | - remove_node(queue, queue->end); | ||
| 48 | - | ||
| 49 | - // if (queue->cleanup) | ||
| 50 | - // queue->cleanup(temp->str); | ||
| 51 | - free(temp->str); | ||
| 52 | - free(temp); | ||
| 53 | -- | ||
| 54 | -+ | ||
| 55 | - // decrement the total of full slots by 1 | ||
| 56 | - queue->count--; | ||
| 57 | - } | ||
| 58 | -- | ||
| 59 | -+ | ||
| 60 | - // Remove front of the queue because its a mismatch | ||
| 61 | - void lru_evict(Queue *queue, unsigned int key) | ||
| 62 | - { | ||
| 63 | -+ if (queue_is_empty(queue)) | ||
| 64 | -+ return; | ||
| 65 | -+ | ||
| 66 | - Hash *hash = queue->hash; | ||
| 67 | - QNode *temp = queue->front; | ||
| 68 | - | ||
| 69 | -- if (queue_is_empty(queue)) | ||
| 70 | -- return; | ||
| 71 | -- | ||
| 72 | - hash->array[key] = NULL; | ||
| 73 | - remove_node(queue, queue->front); | ||
| 74 | - | ||
| 75 | --- | ||
| 76 | -2.33.0 | ||
| 77 | - | ||
| @@ -1,111 +0,0 @@ | |||
| 1 | -From 79c1212ff38254a961c27d8eb10bc766e412ffe9 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Fri, 23 Feb 2024 12:26:05 -0500 | ||
| 4 | -Subject: [PATCH] Cleanup shell script warnings | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/79c1212ff38254a961c27d8eb10bc766e412ffe9 | ||
| 7 | -Conflict:NA | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - init.d/auditd.reload | 2 +- | ||
| 11 | - init.d/auditd.resume | 2 +- | ||
| 12 | - init.d/auditd.rotate | 2 +- | ||
| 13 | - init.d/auditd.state | 6 +++--- | ||
| 14 | - init.d/auditd.stop | 2 +- | ||
| 15 | - init.d/augenrules | 2 +- | ||
| 16 | - 6 files changed, 8 insertions(+), 8 deletions(-) | ||
| 17 | - | ||
| 18 | -diff --git a/init.d/auditd.reload b/init.d/auditd.reload | ||
| 19 | -index 53ff2f4..4f09d00 100644 | ||
| 20 | ---- a/init.d/auditd.reload | ||
| 21 | -+++ b/init.d/auditd.reload | ||
| 22 | -@@ -3,7 +3,7 @@ | ||
| 23 | - # directly supported by systemd | ||
| 24 | - | ||
| 25 | - # Check that we are root ... so non-root users stop here | ||
| 26 | --test $(id -u) = 0 || exit 4 | ||
| 27 | -+test "$(id -u)" = "0" || exit 4 | ||
| 28 | - | ||
| 29 | - printf "Reconfiguring: " | ||
| 30 | - /sbin/augenrules --load | ||
| 31 | -diff --git a/init.d/auditd.resume b/init.d/auditd.resume | ||
| 32 | -index 96189eb..8193bea 100644 | ||
| 33 | ---- a/init.d/auditd.resume | ||
| 34 | -+++ b/init.d/auditd.resume | ||
| 35 | -@@ -3,7 +3,7 @@ | ||
| 36 | - # directly supported by systemd | ||
| 37 | - | ||
| 38 | - # Check that we are root ... so non-root users stop here | ||
| 39 | --test $(id -u) = 0 || exit 4 | ||
| 40 | -+test "$(id -u)" = "0" || exit 4 | ||
| 41 | - | ||
| 42 | - printf "Resuming logging: " | ||
| 43 | - /sbin/auditctl --signal resume | ||
| 44 | -diff --git a/init.d/auditd.rotate b/init.d/auditd.rotate | ||
| 45 | -index dcb12c2..8bb6553 100644 | ||
| 46 | ---- a/init.d/auditd.rotate | ||
| 47 | -+++ b/init.d/auditd.rotate | ||
| 48 | -@@ -3,7 +3,7 @@ | ||
| 49 | - # directly supported by systemd | ||
| 50 | - | ||
| 51 | - # Check that we are root ... so non-root users stop here | ||
| 52 | --test $(id -u) = 0 || exit 4 | ||
| 53 | -+test "$(id -u)" = "0" || exit 4 | ||
| 54 | - | ||
| 55 | - printf "Rotating logs: " | ||
| 56 | - /sbin/auditctl --signal rotate | ||
| 57 | -diff --git a/init.d/auditd.state b/init.d/auditd.state | ||
| 58 | -index 6ae0845..c59fe5a 100644 | ||
| 59 | ---- a/init.d/auditd.state | ||
| 60 | -+++ b/init.d/auditd.state | ||
| 61 | -@@ -3,7 +3,7 @@ | ||
| 62 | - # directly supported by systemd | ||
| 63 | - | ||
| 64 | - # Check that we are root ... so non-root users stop here | ||
| 65 | --test $(id -u) = 0 || exit 4 | ||
| 66 | -+test "$(id -u)" = "0" || exit 4 | ||
| 67 | - | ||
| 68 | - PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 69 | - state_file="/var/run/auditd.state" | ||
| 70 | -@@ -11,10 +11,10 @@ state_file="/var/run/auditd.state" | ||
| 71 | - printf "Getting auditd internal state: " | ||
| 72 | - /sbin/auditctl --signal state | ||
| 73 | - RETVAL=$? | ||
| 74 | --echo -e "\n" | ||
| 75 | - sleep 1 | ||
| 76 | --if [ $? -eq 0 ] ; then | ||
| 77 | -+if [ $RETVAL -eq 0 ] ; then | ||
| 78 | - if [ -e $state_file ] ; then | ||
| 79 | -+ printf "\n\n" | ||
| 80 | - cat $state_file | ||
| 81 | - fi | ||
| 82 | - fi | ||
| 83 | -diff --git a/init.d/auditd.stop b/init.d/auditd.stop | ||
| 84 | -index 5049285..41c67d6 100644 | ||
| 85 | ---- a/init.d/auditd.stop | ||
| 86 | -+++ b/init.d/auditd.stop | ||
| 87 | -@@ -3,7 +3,7 @@ | ||
| 88 | - # directly supported by systemd | ||
| 89 | - | ||
| 90 | - # Check that we are root ... so non-root users stop here | ||
| 91 | --test $(id -u) = 0 || exit 4 | ||
| 92 | -+test "$(id -u)" = "0" || exit 4 | ||
| 93 | - | ||
| 94 | - PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 95 | - prog="auditd" | ||
| 96 | -diff --git a/init.d/augenrules b/init.d/augenrules | ||
| 97 | -index ea96aa7..605cfef 100644 | ||
| 98 | ---- a/init.d/augenrules | ||
| 99 | -+++ b/init.d/augenrules | ||
| 100 | -@@ -35,7 +35,7 @@ RETVAL=0 | ||
| 101 | - usage="Usage: $0 [--check|--load]" | ||
| 102 | - | ||
| 103 | - # Delete the interim file on faults | ||
| 104 | --trap 'rm -f ${TmpRules}; exit 1' 1 2 3 13 15 | ||
| 105 | -+trap 'rm -f ${TmpRules}; exit 1' HUP INT QUIT PIPE TERM | ||
| 106 | - | ||
| 107 | - try_load() { | ||
| 108 | - if [ $LoadRules -eq 1 ] ; then | ||
| 109 | --- | ||
| 110 | -2.33.0 | ||
| 111 | - | ||
| @@ -1,143 +0,0 @@ | |||
| 1 | -From 6dabe8de1c502b4bcd0ad945f6d7636d5aeb9fed Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <sgrubb@redhat.com> | ||
| 3 | -Date: Sat, 26 Aug 2023 08:52:25 -0400 | ||
| 4 | -Subject: [PATCH] Consolidate end of event detection to a common function | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/6dabe8de1c502b4bcd0ad945f6d7636d5aeb9fed | ||
| 7 | -Conflict:ChangeLog | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - auparse/auparse.c | 9 +-------- | ||
| 11 | - common/Makefile.am | 2 +- | ||
| 12 | - common/common.c | 43 +++++++++++++++++++++++++++++++++++++++++++ | ||
| 13 | - common/common.h | 3 ++- | ||
| 14 | - src/ausearch-lol.c | 9 ++------- | ||
| 15 | - 5 files changed, 49 insertions(+), 17 deletions(-) | ||
| 16 | - create mode 100644 common/common.c | ||
| 17 | - | ||
| 18 | -diff --git a/auparse/auparse.c b/auparse/auparse.c | ||
| 19 | -index 6f3fb945..359b1875 100644 | ||
| 20 | ---- a/auparse/auparse.c | ||
| 21 | -+++ b/auparse/auparse.c | ||
| 22 | -@@ -309,14 +309,7 @@ static void au_check_events(auparse_state_t *au, time_t sec) | ||
| 23 | - if (cur->l->e.sec + eoe_timeout <= sec) { | ||
| 24 | - cur->status = EBS_COMPLETE; | ||
| 25 | - au->au_ready++; | ||
| 26 | -- } else if ( // FIXME: Check this v remains true | ||
| 27 | -- r->type == AUDIT_PROCTITLE || | ||
| 28 | -- r->type == AUDIT_EOE || | ||
| 29 | -- r->type < AUDIT_FIRST_EVENT || | ||
| 30 | -- r->type >= AUDIT_FIRST_ANOM_MSG || | ||
| 31 | -- r->type == AUDIT_KERNEL || | ||
| 32 | -- (r->type >= AUDIT_MAC_UNLBL_ALLOW && | ||
| 33 | -- r->type <= AUDIT_MAC_CALIPSO_DEL)) { | ||
| 34 | -+ } else if (audit_is_last_record(r->type)) { | ||
| 35 | - // If known to be 1 record event, we are done | ||
| 36 | - cur->status = EBS_COMPLETE; | ||
| 37 | - au->au_ready++; | ||
| 38 | -diff --git a/common/Makefile.am b/common/Makefile.am | ||
| 39 | -index dbf0f76c..9738ee87 100644 | ||
| 40 | ---- a/common/Makefile.am | ||
| 41 | -+++ b/common/Makefile.am | ||
| 42 | -@@ -27,6 +27,6 @@ AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/lib | ||
| 43 | - | ||
| 44 | - noinst_HEADERS = common.h | ||
| 45 | - libaucommon_la_DEPENDENCIES = ../config.h | ||
| 46 | --libaucommon_la_SOURCES = audit-fgets.c strsplit.c | ||
| 47 | -+libaucommon_la_SOURCES = audit-fgets.c strsplit.c common.c | ||
| 48 | - noinst_LTLIBRARIES = libaucommon.la | ||
| 49 | - | ||
| 50 | -diff --git a/common/common.c b/common/common.c | ||
| 51 | -new file mode 100644 | ||
| 52 | -index 00000000..cbfa46cb | ||
| 53 | ---- /dev/null | ||
| 54 | -+++ b/common/common.c | ||
| 55 | -@@ -0,0 +1,43 @@ | ||
| 56 | -+/* common.c -- | ||
| 57 | -+ * Copyright 2023 Red Hat Inc. | ||
| 58 | -+ * All Rights Reserved. | ||
| 59 | -+ * | ||
| 60 | -+ * This library is free software; you can redistribute it and/or | ||
| 61 | -+ * modify it under the terms of the GNU Lesser General Public | ||
| 62 | -+ * License as published by the Free Software Foundation; either | ||
| 63 | -+ * version 2.1 of the License, or (at your option) any later version. | ||
| 64 | -+ * | ||
| 65 | -+ * This library is distributed in the hope that it will be useful, | ||
| 66 | -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 67 | -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 68 | -+ * Lesser General Public License for more details. | ||
| 69 | -+ * | ||
| 70 | -+ * You should have received a copy of the GNU Lesser General Public | ||
| 71 | -+ * License along with this library; if not, write to the Free Software | ||
| 72 | -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 73 | -+ * | ||
| 74 | -+ * Authors: | ||
| 75 | -+ * Steve Grubb <sgrubb@redhat.com> | ||
| 76 | -+ */ | ||
| 77 | -+ | ||
| 78 | -+#include "libaudit.h" | ||
| 79 | -+#include "common.h" | ||
| 80 | -+ | ||
| 81 | -+/* | ||
| 82 | -+ * This function returns 1 if it is the last record in an event. | ||
| 83 | -+ * It returns 0 otherwise. | ||
| 84 | -+ */ | ||
| 85 | -+int audit_is_last_record(int type) | ||
| 86 | -+{ | ||
| 87 | -+ if (type == AUDIT_PROCTITLE || | ||
| 88 | -+ type == AUDIT_EOE || | ||
| 89 | -+ type < AUDIT_FIRST_EVENT || | ||
| 90 | -+ type >= AUDIT_FIRST_ANOM_MSG || | ||
| 91 | -+ type == AUDIT_KERNEL || | ||
| 92 | -+ (type >= AUDIT_MAC_UNLBL_ALLOW && | ||
| 93 | -+ type <= AUDIT_MAC_CALIPSO_DEL)) { | ||
| 94 | -+ return 1; | ||
| 95 | -+ } | ||
| 96 | -+ return 0; | ||
| 97 | -+} | ||
| 98 | -+ | ||
| 99 | -diff --git a/common/common.h b/common/common.h | ||
| 100 | -index 6a5437e9..1db80d4b 100644 | ||
| 101 | ---- a/common/common.h | ||
| 102 | -+++ b/common/common.h | ||
| 103 | -@@ -1,5 +1,5 @@ | ||
| 104 | - /* audit-fgets.h -- a replacement for glibc's fgets | ||
| 105 | -- * Copyright 2018,2022 Red Hat Inc. | ||
| 106 | -+ * Copyright 2018-23 Red Hat Inc. | ||
| 107 | - * All Rights Reserved. | ||
| 108 | - * | ||
| 109 | - * This library is free software; you can redistribute it and/or | ||
| 110 | -@@ -38,6 +38,7 @@ int audit_fgets(char *buf, size_t blen, int fd) | ||
| 111 | - | ||
| 112 | - char *audit_strsplit_r(char *s, char **savedpp); | ||
| 113 | - char *audit_strsplit(char *s); | ||
| 114 | -+int audit_is_last_record(int type); | ||
| 115 | - | ||
| 116 | - AUDIT_HIDDEN_END | ||
| 117 | - #endif | ||
| 118 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 119 | -index 4a7e5fdf..9ed39d4f 100644 | ||
| 120 | ---- a/src/ausearch-lol.c | ||
| 121 | -+++ b/src/ausearch-lol.c | ||
| 122 | -@@ -252,16 +252,11 @@ static void check_events(lol *lo, time_t sec) | ||
| 123 | - if (cur->l->e.sec + eoe_timeout <= sec) { | ||
| 124 | - cur->status = L_COMPLETE; | ||
| 125 | - ready++; | ||
| 126 | -- } else if (cur->l->e.type == AUDIT_PROCTITLE || | ||
| 127 | -- cur->l->e.type < AUDIT_FIRST_EVENT || | ||
| 128 | -- cur->l->e.type >= AUDIT_FIRST_ANOM_MSG || | ||
| 129 | -- cur->l->e.type == AUDIT_KERNEL || | ||
| 130 | -- (cur->l->e.type >= AUDIT_MAC_UNLBL_ALLOW && | ||
| 131 | -- cur->l->e.type <= AUDIT_MAC_CALIPSO_DEL)) { | ||
| 132 | -+ } else if (audit_is_last_record(cur->l->e.type)) { | ||
| 133 | - // If known to be 1 record event, we are done | ||
| 134 | - cur->status = L_COMPLETE; | ||
| 135 | - ready++; | ||
| 136 | -- } | ||
| 137 | -+ } | ||
| 138 | - } | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | --- | ||
| 142 | -2.33.0 | ||
| 143 | - | ||
| @@ -1,52 +0,0 @@ | |||
| 1 | -From e5b0c9d74a54e0c6c83ba402807a53e4544b7898 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Attila Lakatos <Cropi@users.noreply.github.com> | ||
| 3 | -Date: Wed, 12 Jun 2024 18:22:00 +0200 | ||
| 4 | -Subject: [PATCH] Correct output when displaying rules with exe/path/dir (#379) | ||
| 5 | - | ||
| 6 | -Some audit operators were not displayed properly | ||
| 7 | -because auditctl used the "=" operator in all | ||
| 8 | -the scenarios mentioned above. | ||
| 9 | - | ||
| 10 | -Reference:https://github.com/linux-audit/audit-userspace/commit/e5b0c9d74a54e0c6c83ba402807a53e4544b7898 | ||
| 11 | -Conflict:NA | ||
| 12 | - | ||
| 13 | ---- | ||
| 14 | - src/auditctl-listing.c | 11 ++++++++--- | ||
| 15 | - 1 file changed, 8 insertions(+), 3 deletions(-) | ||
| 16 | - | ||
| 17 | -diff --git a/src/auditctl-listing.c b/src/auditctl-listing.c | ||
| 18 | -index 57ae1837..9c322670 100644 | ||
| 19 | ---- a/src/auditctl-listing.c | ||
| 20 | -+++ b/src/auditctl-listing.c | ||
| 21 | -@@ -380,7 +380,9 @@ static void print_rule(const struct audit_rule_data *r) | ||
| 22 | - printf("-w %.*s", r->values[i], | ||
| 23 | - &r->buf[boffset]); | ||
| 24 | - else | ||
| 25 | -- printf(" -F path=%.*s", r->values[i], | ||
| 26 | -+ printf(" -F path%s%.*s", | ||
| 27 | -+ audit_operator_to_symbol(op), | ||
| 28 | -+ r->values[i], | ||
| 29 | - &r->buf[boffset]); | ||
| 30 | - boffset += r->values[i]; | ||
| 31 | - } else if (field == AUDIT_DIR) { | ||
| 32 | -@@ -388,12 +390,15 @@ static void print_rule(const struct audit_rule_data *r) | ||
| 33 | - printf("-w %.*s", r->values[i], | ||
| 34 | - &r->buf[boffset]); | ||
| 35 | - else | ||
| 36 | -- printf(" -F dir=%.*s", r->values[i], | ||
| 37 | -+ printf(" -F dir%s%.*s", | ||
| 38 | -+ audit_operator_to_symbol(op), | ||
| 39 | -+ r->values[i], | ||
| 40 | - &r->buf[boffset]); | ||
| 41 | - | ||
| 42 | - boffset += r->values[i]; | ||
| 43 | - } else if (field == AUDIT_EXE) { | ||
| 44 | -- printf(" -F exe=%.*s", | ||
| 45 | -+ printf(" -F exe%s%.*s", | ||
| 46 | -+ audit_operator_to_symbol(op), | ||
| 47 | - r->values[i], &r->buf[boffset]); | ||
| 48 | - boffset += r->values[i]; | ||
| 49 | - } else if (field == AUDIT_FILTERKEY) { | ||
| 50 | --- | ||
| 51 | -2.33.0 | ||
| 52 | - | ||
| @@ -1,41 +0,0 @@ | |||
| 1 | -From bbe96f9798451129ae2555f92e2f698f842f7833 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <sgrubb@redhat.com> | ||
| 3 | -Date: Tue, 10 Oct 2023 08:22:49 -0400 | ||
| 4 | -Subject: [PATCH] Error out if required zos parameters missing | ||
| 5 | - | ||
| 6 | - | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/bbe96f9798451129ae2555f92e2f698f842f7833 | ||
| 8 | -Conflict:NA | ||
| 9 | - | ||
| 10 | ---- | ||
| 11 | - audisp/plugins/zos-remote/zos-remote-ldap.c | 8 ++++++-- | ||
| 12 | - 1 file changed, 6 insertions(+), 2 deletions(-) | ||
| 13 | - | ||
| 14 | -diff --git a/audisp/plugins/zos-remote/zos-remote-ldap.c b/audisp/plugins/zos-remote/zos-remote-ldap.c | ||
| 15 | -index 7dd1424f..7e27eda4 100644 | ||
| 16 | ---- a/audisp/plugins/zos-remote/zos-remote-ldap.c | ||
| 17 | -+++ b/audisp/plugins/zos-remote/zos-remote-ldap.c | ||
| 18 | -@@ -134,14 +134,18 @@ retry: | ||
| 19 | - | ||
| 20 | - int zos_remote_init(ZOS_REMOTE *zos_remote, const char *server, int port, | ||
| 21 | - const char *user, const char *password, int timeout) | ||
| 22 | --{ | ||
| 23 | -+{ | ||
| 24 | -+ if (server == NULL || user == NULL || password == NULL) { | ||
| 25 | -+ log_err("Error: required parameters are not present in config file"); | ||
| 26 | -+ return ICTX_E_FATAL; | ||
| 27 | -+ } | ||
| 28 | - zos_remote->server = strdup(server); | ||
| 29 | - zos_remote->port = port; | ||
| 30 | - zos_remote->user = strdup(user); | ||
| 31 | - zos_remote->password = strdup(password); | ||
| 32 | - zos_remote->timeout = timeout; | ||
| 33 | - zos_remote->connected = 0; | ||
| 34 | -- | ||
| 35 | -+ | ||
| 36 | - if (!zos_remote->server || !zos_remote->user || !zos_remote->password) { | ||
| 37 | - log_err("Error allocating memory for session members"); | ||
| 38 | - return ICTX_E_FATAL; | ||
| 39 | --- | ||
| 40 | -2.33.0 | ||
| 41 | - | ||
| @@ -1,31 +0,0 @@ | |||
| 1 | -From c344a8a370afed66e78db88c2d129f6672dae1e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <sgrubb@redhat.com> | ||
| 3 | -Date: Tue, 24 Oct 2023 11:51:04 -0400 | ||
| 4 | -Subject: [PATCH] Fix deprecated python function | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/c344a8a370afed66e78db88c2d129f6672dae1e6 | ||
| 7 | -Conflict:NA | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - bindings/python/auparse_python.c | 4 ++++ | ||
| 11 | - 1 file changed, 4 insertions(+) | ||
| 12 | - | ||
| 13 | -diff --git a/bindings/python/auparse_python.c b/bindings/python/auparse_python.c | ||
| 14 | -index 78ef832c..1371ed54 100644 | ||
| 15 | ---- a/bindings/python/auparse_python.c | ||
| 16 | -+++ b/bindings/python/auparse_python.c | ||
| 17 | -@@ -290,7 +290,11 @@ static void auparse_callback(auparse_state_t *au, | ||
| 18 | - if (debug) printf("<< auparse_callback\n"); | ||
| 19 | - arglist = Py_BuildValue("OiO", cb->py_AuParser, cb_event_type, | ||
| 20 | - cb->user_data); | ||
| 21 | -+#if PY_MINOR_VERSION >= 13 | ||
| 22 | -+ result = PyObject_CallObject(cb->func, arglist); | ||
| 23 | -+#else | ||
| 24 | - result = PyEval_CallObject(cb->func, arglist); | ||
| 25 | -+#endif | ||
| 26 | - Py_DECREF(arglist); | ||
| 27 | - Py_XDECREF(result); | ||
| 28 | - } | ||
| 29 | --- | ||
| 30 | -2.33.0 | ||
| 31 | - | ||
| @@ -1,69 +0,0 @@ | |||
| 1 | -From 289dc3a077f05fba93816fbdfbbfe032322d7f64 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Tue, 21 May 2024 12:28:29 -0400 | ||
| 4 | -Subject: [PATCH] Fix memory leaks | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/289dc3a077f05fba93816fbdfbbfe032322d7f64 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/auditd-listen.c | 2 +- | ||
| 11 | - src/ausearch-lol.c | 2 ++ | ||
| 12 | - src/ausearch-parse.c | 6 ++++-- | ||
| 13 | - 3 files changed, 7 insertions(+), 3 deletions(-) | ||
| 14 | - | ||
| 15 | -diff --git a/src/auditd-listen.c b/src/auditd-listen.c | ||
| 16 | -index ea3f137c..52076361 100644 | ||
| 17 | ---- a/src/auditd-listen.c | ||
| 18 | -+++ b/src/auditd-listen.c | ||
| 19 | -@@ -443,8 +443,8 @@ static int negotiate_credentials(ev_tcp *io) | ||
| 20 | - gss_release_name(&min_stat, &client); | ||
| 21 | - return -1; | ||
| 22 | - } | ||
| 23 | -- gss_release_buffer(&min_stat, &send_tok); | ||
| 24 | - } | ||
| 25 | -+ gss_release_buffer(&min_stat, &send_tok); | ||
| 26 | - } while (maj_stat == GSS_S_CONTINUE_NEEDED); | ||
| 27 | - | ||
| 28 | - maj_stat = gss_display_name(&min_stat, client, &recv_tok, NULL); | ||
| 29 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 30 | -index a5418079..784c58f6 100644 | ||
| 31 | ---- a/src/ausearch-lol.c | ||
| 32 | -+++ b/src/ausearch-lol.c | ||
| 33 | -@@ -311,6 +311,7 @@ int lol_add_record(lol *lo, char *buff) | ||
| 34 | - n.type = e.type; | ||
| 35 | - n.message = strdup(buff); | ||
| 36 | - if(n.message == NULL) { | ||
| 37 | -+ free((char *)e.node); | ||
| 38 | - fprintf(stderr, "Out of memory. Check %s file, %d line", __FILE__, __LINE__); | ||
| 39 | - return 0; | ||
| 40 | - } | ||
| 41 | -@@ -369,6 +370,7 @@ int lol_add_record(lol *lo, char *buff) | ||
| 42 | - // Create new event and fill it in | ||
| 43 | - l = malloc(sizeof(llist)); | ||
| 44 | - if (l == NULL) { | ||
| 45 | -+ free((char *)e.node); | ||
| 46 | - fprintf(stderr, "Out of memory. Check %s file, %d line", __FILE__, __LINE__); | ||
| 47 | - return 0; | ||
| 48 | - } | ||
| 49 | -diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c | ||
| 50 | -index be57606b..4c9bef0d 100644 | ||
| 51 | ---- a/src/ausearch-parse.c | ||
| 52 | -+++ b/src/ausearch-parse.c | ||
| 53 | -@@ -769,9 +769,11 @@ static int common_path_parser(search_items *s, char *path) | ||
| 54 | - if ((sn.str[0] == '.') && ((sn.str[1] == '.') || | ||
| 55 | - (sn.str[1] == '/')) && s->cwd) { | ||
| 56 | - char *tmp = malloc(PATH_MAX); | ||
| 57 | -- if (tmp == NULL) | ||
| 58 | -+ if (tmp == NULL) { | ||
| 59 | -+ free(sn.str); | ||
| 60 | - return 6; | ||
| 61 | -- snprintf(tmp, PATH_MAX, "%s/%s", | ||
| 62 | -+ } | ||
| 63 | -+ snprintf(tmp, PATH_MAX, "%s/%s", | ||
| 64 | - s->cwd, sn.str); | ||
| 65 | - free(sn.str); | ||
| 66 | - sn.str = tmp; | ||
| 67 | --- | ||
| 68 | -2.33.0 | ||
| 69 | - | ||
| @@ -1,107 +0,0 @@ | |||
| 1 | -From a4e8b7e18f249fe5decdd2fe748a5068ffeaee57 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Mon, 20 Nov 2023 16:37:46 -0500 | ||
| 4 | -Subject: [PATCH] Fix new warnings for unused results | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/a4e8b7e18f249fe5decdd2fe748a5068ffeaee57 | ||
| 7 | -Conflict:NA | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - audisp/plugins/ids/ids.c | 5 +++-- | ||
| 11 | - audisp/plugins/ids/ids.h | 2 +- | ||
| 12 | - audisp/plugins/statsd/audisp-statsd.c | 4 ++-- | ||
| 13 | - lib/libaudit.c | 3 ++- | ||
| 14 | - lib/netlink.c | 3 ++- | ||
| 15 | - src/auditd.c | 3 ++- | ||
| 16 | - 6 files changed, 12 insertions(+), 8 deletions(-) | ||
| 17 | - | ||
| 18 | -diff --git a/audisp/plugins/ids/ids.c b/audisp/plugins/ids/ids.c | ||
| 19 | -index d28237e5..1446ca71 100644 | ||
| 20 | ---- a/audisp/plugins/ids/ids.c | ||
| 21 | -+++ b/audisp/plugins/ids/ids.c | ||
| 22 | -@@ -107,9 +107,10 @@ static void destroy_audit(void) | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - | ||
| 26 | --void log_audit_event(int type, const char *text, int res) | ||
| 27 | -+int log_audit_event(int type, const char *text, int res) | ||
| 28 | - { | ||
| 29 | -- audit_log_user_message(audit_fd, type, text, NULL, NULL, NULL, res); | ||
| 30 | -+ return audit_log_user_message(audit_fd, type, text, | ||
| 31 | -+ NULL, NULL, NULL, res); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - | ||
| 35 | -diff --git a/audisp/plugins/ids/ids.h b/audisp/plugins/ids/ids.h | ||
| 36 | -index f3710066..cb98cdba 100644 | ||
| 37 | ---- a/audisp/plugins/ids/ids.h | ||
| 38 | -+++ b/audisp/plugins/ids/ids.h | ||
| 39 | -@@ -15,6 +15,6 @@ | ||
| 40 | - extern int debug; | ||
| 41 | - extern void my_printf(const char *fmt, ...) | ||
| 42 | - __attribute__ (( format(printf, 1, 2) )); | ||
| 43 | --extern void log_audit_event(int type, const char *text, int res); | ||
| 44 | -+extern int log_audit_event(int type, const char *text, int res); | ||
| 45 | - | ||
| 46 | - #endif | ||
| 47 | -diff --git a/audisp/plugins/statsd/audisp-statsd.c b/audisp/plugins/statsd/audisp-statsd.c | ||
| 48 | -index db2c6111..912f9171 100644 | ||
| 49 | ---- a/audisp/plugins/statsd/audisp-statsd.c | ||
| 50 | -+++ b/audisp/plugins/statsd/audisp-statsd.c | ||
| 51 | -@@ -218,9 +218,9 @@ static void get_kernel_status(void) | ||
| 52 | - struct audit_reply rep; | ||
| 53 | - | ||
| 54 | - audit_request_status(audit_fd); | ||
| 55 | -- audit_get_reply(audit_fd, &rep, GET_REPLY_BLOCKING, 0); | ||
| 56 | -+ int rc = audit_get_reply(audit_fd, &rep, GET_REPLY_BLOCKING, 0); | ||
| 57 | - | ||
| 58 | -- if (rep.type == AUDIT_GET) { | ||
| 59 | -+ if (rc > 0 && rep.type == AUDIT_GET) { | ||
| 60 | - // add info to global audit event struct | ||
| 61 | - r.lost = rep.status->lost; | ||
| 62 | - r.backlog = rep.status->backlog; | ||
| 63 | -diff --git a/lib/libaudit.c b/lib/libaudit.c | ||
| 64 | -index e5f2a7c5..3decff12 100644 | ||
| 65 | ---- a/lib/libaudit.c | ||
| 66 | -+++ b/lib/libaudit.c | ||
| 67 | -@@ -473,7 +473,8 @@ int audit_set_pid(int fd, uint32_t pid, rep_wait_t wmode) | ||
| 68 | - rc = poll(pfd, 1, 100); /* .1 second */ | ||
| 69 | - } while (rc < 0 && errno == EINTR); | ||
| 70 | - | ||
| 71 | -- (void)audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0); | ||
| 72 | -+ if (audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0)) | ||
| 73 | -+ ; // intentionally empty | ||
| 74 | - return 1; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | -diff --git a/lib/netlink.c b/lib/netlink.c | ||
| 78 | -index eeeefc26..3381651a 100644 | ||
| 79 | ---- a/lib/netlink.c | ||
| 80 | -+++ b/lib/netlink.c | ||
| 81 | -@@ -280,7 +280,8 @@ retry: | ||
| 82 | - else if (rc > 0 && rep.type == NLMSG_ERROR) { | ||
| 83 | - int error = rep.error->error; | ||
| 84 | - /* Eat the message */ | ||
| 85 | -- (void)audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0); | ||
| 86 | -+ if (audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0)) | ||
| 87 | -+ ; // intentionally empty | ||
| 88 | - | ||
| 89 | - /* NLMSG_ERROR can indicate success, only report nonzero */ | ||
| 90 | - if (error) { | ||
| 91 | -diff --git a/src/auditd.c b/src/auditd.c | ||
| 92 | -index 2dedf35b..54b407f3 100644 | ||
| 93 | ---- a/src/auditd.c | ||
| 94 | -+++ b/src/auditd.c | ||
| 95 | -@@ -1044,7 +1044,8 @@ static void clean_exit(void) | ||
| 96 | - audit_msg(LOG_INFO, "The audit daemon is exiting."); | ||
| 97 | - if (fd >= 0) { | ||
| 98 | - if (!opt_aggregate_only) | ||
| 99 | -- audit_set_pid(fd, 0, WAIT_NO); | ||
| 100 | -+ if (audit_set_pid(fd, 0, WAIT_NO)) | ||
| 101 | -+ ; // intentionally empty | ||
| 102 | - audit_close(fd); | ||
| 103 | - } | ||
| 104 | - if (pidfile) | ||
| 105 | --- | ||
| 106 | -2.33.0 | ||
| 107 | - | ||
| @@ -1,54 +0,0 @@ | |||
| 1 | -From 68131717821ee5c946fb561218551c98e46d7d06 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Tue, 19 Mar 2024 17:01:53 +0300 | ||
| 4 | -Subject: [PATCH] Fixed NULL checks | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/68131717821ee5c946fb561218551c98e46d7d06 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - audisp/plugins/zos-remote/zos-remote-queue.c | 2 +- | ||
| 11 | - auparse/auparse.c | 1 + | ||
| 12 | - src/ausearch-lol.c | 1 + | ||
| 13 | - 3 files changed, 3 insertions(+), 1 deletion(-) | ||
| 14 | - | ||
| 15 | -diff --git a/audisp/plugins/zos-remote/zos-remote-queue.c b/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 16 | -index 47dd006e..f8019890 100644 | ||
| 17 | ---- a/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 18 | -+++ b/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 19 | -@@ -131,7 +131,7 @@ void increase_queue_depth(unsigned int size) | ||
| 20 | - | ||
| 21 | - tmp_q = realloc(q, size * sizeof(BerElement *)); | ||
| 22 | - if (tmp_q == NULL) { | ||
| 23 | -- log_err("Memory allocation error");; | ||
| 24 | -+ log_err("Memory allocation error");; | ||
| 25 | - pthread_mutex_unlock(&queue_lock); | ||
| 26 | - return; | ||
| 27 | - } | ||
| 28 | -diff --git a/auparse/auparse.c b/auparse/auparse.c | ||
| 29 | -index 516ee8f1..e782058d 100644 | ||
| 30 | ---- a/auparse/auparse.c | ||
| 31 | -+++ b/auparse/auparse.c | ||
| 32 | -@@ -116,6 +116,7 @@ static int setup_log_file_array(auparse_state_t *au) | ||
| 33 | - if (!tmp) { | ||
| 34 | - fprintf(stderr, "No memory\n"); | ||
| 35 | - aup_free_config(&config); | ||
| 36 | -+ free(filename); | ||
| 37 | - return 1; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 41 | -index c2140b7e..7562dc21 100644 | ||
| 42 | ---- a/src/ausearch-lol.c | ||
| 43 | -+++ b/src/ausearch-lol.c | ||
| 44 | -@@ -49,6 +49,7 @@ void lol_create(lol *lo) | ||
| 45 | - lo->array = (lolnode *)malloc(size); | ||
| 46 | - if (lo->array == NULL) { | ||
| 47 | - fprintf(stderr, "Memory allocation error"); | ||
| 48 | -+ lo->limit = 0; | ||
| 49 | - return; | ||
| 50 | - } | ||
| 51 | - memset(lo->array, 0, size); | ||
| 52 | --- | ||
| 53 | -2.33.0 | ||
| 54 | - | ||
| @@ -1,114 +0,0 @@ | |||
| 1 | -From 139c61a9007600c93702947179d7836be1bc8403 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: burnalting <burnalting@users.noreply.github.com> | ||
| 3 | -Date: Thu, 11 Jan 2024 08:22:32 +1100 | ||
| 4 | -Subject: [PATCH] Issue343: Fix checkpoint issue to ensure all complete events | ||
| 5 | - are gained (#345) | ||
| 6 | - | ||
| 7 | -Co-authored-by: Burn Alting <burn@auditdtest.swtf.dyndns.org> | ||
| 8 | - | ||
| 9 | -Reference:https://github.com/linux-audit/audit-userspace/commit/139c61a9007600c93702947179d7836be1bc8403 | ||
| 10 | -Conflict:NA | ||
| 11 | - | ||
| 12 | ---- | ||
| 13 | - src/ausearch-lol.c | 33 +++++++++++++++++++++++++++++++++ | ||
| 14 | - src/ausearch-lol.h | 1 + | ||
| 15 | - src/ausearch.c | 12 +++++++----- | ||
| 16 | - 3 files changed, 41 insertions(+), 5 deletions(-) | ||
| 17 | - | ||
| 18 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 19 | -index 9ed39d4f..bcfb9ad8 100644 | ||
| 20 | ---- a/src/ausearch-lol.c | ||
| 21 | -+++ b/src/ausearch-lol.c | ||
| 22 | -@@ -261,6 +261,32 @@ static void check_events(lol *lo, time_t sec) | ||
| 23 | - } | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | -+// This function will check events to see if they are complete but not compare against a given time | ||
| 27 | -+static void check_events_without_time(lol *lo) | ||
| 28 | -+{ | ||
| 29 | -+ int i; | ||
| 30 | -+ | ||
| 31 | -+ for(i=0;i<=lo->maxi; i++) { | ||
| 32 | -+ lolnode *cur = &lo->array[i]; | ||
| 33 | -+ if (cur->status == L_BUILDING) { | ||
| 34 | -+ /* We now iterate over the event's records but without affecting the node's current | ||
| 35 | -+ * pointer (cur->l->cur). That is, we don't call the list-* routines | ||
| 36 | -+ * We could jump to the last record in the list which is normally a PROCTITLE, but this | ||
| 37 | -+ * may not be guaranteed, so we check all record types | ||
| 38 | -+ */ | ||
| 39 | -+ lnode *ln = cur->l->head; | ||
| 40 | -+ while (ln) { | ||
| 41 | -+ if (audit_is_last_record(ln->type)) { | ||
| 42 | -+ cur->status = L_COMPLETE; | ||
| 43 | -+ ready++; | ||
| 44 | -+ break; | ||
| 45 | -+ } | ||
| 46 | -+ ln = ln->next; | ||
| 47 | -+ } | ||
| 48 | -+ } | ||
| 49 | -+ } | ||
| 50 | -+} | ||
| 51 | -+ | ||
| 52 | - // This function adds a new record to an existing linked list | ||
| 53 | - // or creates a new one if its a new event | ||
| 54 | - int lol_add_record(lol *lo, char *buff) | ||
| 55 | -@@ -360,6 +386,13 @@ void terminate_all_events(lol *lo) | ||
| 56 | - } | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | -+// This function will mark all events as complete if it can. | ||
| 60 | -+void complete_all_events(lol *lo) | ||
| 61 | -+{ | ||
| 62 | -+ | ||
| 63 | -+ check_events_without_time(lo); | ||
| 64 | -+} | ||
| 65 | -+ | ||
| 66 | - /* Search the list for any event that is ready to go. The caller | ||
| 67 | - * takes custody of the memory */ | ||
| 68 | - llist* get_ready_event(lol *lo) | ||
| 69 | -diff --git a/src/ausearch-lol.h b/src/ausearch-lol.h | ||
| 70 | -index e189491e..427d083c 100644 | ||
| 71 | ---- a/src/ausearch-lol.h | ||
| 72 | -+++ b/src/ausearch-lol.h | ||
| 73 | -@@ -49,6 +49,7 @@ void lol_create(lol *lo); | ||
| 74 | - void lol_clear(lol *lo); | ||
| 75 | - int lol_add_record(lol *lo, char *buff); | ||
| 76 | - void terminate_all_events(lol *lo); | ||
| 77 | -+void complete_all_events(lol *lo); | ||
| 78 | - llist* get_ready_event(lol *lo); | ||
| 79 | - | ||
| 80 | - void lol_set_eoe_timeout(time_t new_eoe_tmo); | ||
| 81 | -diff --git a/src/ausearch.c b/src/ausearch.c | ||
| 82 | -index c8cafb5f..409e43e9 100644 | ||
| 83 | ---- a/src/ausearch.c | ||
| 84 | -+++ b/src/ausearch.c | ||
| 85 | -@@ -610,19 +610,21 @@ static int get_next_event(llist **l) | ||
| 86 | - * If we get an EINTR error or we are at EOF, we check | ||
| 87 | - * to see if we have any events to print and return | ||
| 88 | - * appropriately. If we are the last file being | ||
| 89 | -- * processed, we mark all incomplete events as | ||
| 90 | -- * complete so they will be printed. | ||
| 91 | -+ * processed, and we are not checkpointing, we mark all incomplete | ||
| 92 | -+ * events as complete so they will be printed. If we are checkpointing | ||
| 93 | -+ * we do an exhaustive validation to see if there are complete events still | ||
| 94 | - */ | ||
| 95 | - if ((ferror_unlocked(log_fd) && | ||
| 96 | - errno == EINTR) || feof_unlocked(log_fd)) { | ||
| 97 | - /* | ||
| 98 | -- * Only mark all events as L_COMPLETE if we are | ||
| 99 | -+ * Only attempt to mark all events as L_COMPLETE if we are | ||
| 100 | - * the last file being processed. | ||
| 101 | -- * We DO NOT do this if we are checkpointing. | ||
| 102 | - */ | ||
| 103 | - if (files_to_process == 0) { | ||
| 104 | - if (!checkpt_filename) | ||
| 105 | -- terminate_all_events(&lo); | ||
| 106 | -+ terminate_all_events(&lo); // terminate as we are not checkpointing | ||
| 107 | -+ else | ||
| 108 | -+ complete_all_events(&lo); // exhaustively check if we can complete events | ||
| 109 | - } | ||
| 110 | - *l = get_ready_event(&lo); | ||
| 111 | - if (*l) | ||
| 112 | --- | ||
| 113 | -2.33.0 | ||
| 114 | - | ||
| @@ -1,62 +0,0 @@ | |||
| 1 | -From 8359a7004de5e22c5a9b85c01c56e3b376d84a81 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Michael Tautschnig <mt@debian.org> | ||
| 3 | -Date: Thu, 2 Nov 2023 21:53:29 +0100 | ||
| 4 | -Subject: [PATCH] Make session id consistently typed (#327) | ||
| 5 | - | ||
| 6 | -This fixes type-conflicting definitions and declarations. | ||
| 7 | - | ||
| 8 | -Reference:https://github.com/linux-audit/audit-userspace/commit/8359a7004de5e22c5a9b85c01c56e3b376d84a81 | ||
| 9 | -Conflict:NA | ||
| 10 | - | ||
| 11 | ---- | ||
| 12 | - src/aureport-options.c | 3 ++- | ||
| 13 | - src/ausearch-options.c | 10 ++++++---- | ||
| 14 | - 2 files changed, 8 insertions(+), 5 deletions(-) | ||
| 15 | - | ||
| 16 | -diff --git a/src/aureport-options.c b/src/aureport-options.c | ||
| 17 | -index 93621e25..76a4b9f1 100644 | ||
| 18 | ---- a/src/aureport-options.c | ||
| 19 | -+++ b/src/aureport-options.c | ||
| 20 | -@@ -61,7 +61,8 @@ const char *event_uuid = NULL; | ||
| 21 | - const char *event_vmname = NULL; | ||
| 22 | - long long event_exit = 0; | ||
| 23 | - int event_exit_is_set = 0; | ||
| 24 | --int event_ppid = -1, event_session_id = -2; | ||
| 25 | -+pid_t event_ppid = -1; | ||
| 26 | -+uint32_t event_session_id = -2; | ||
| 27 | - int event_debug = 0, event_machine = -1; | ||
| 28 | - time_t arg_eoe_timeout = (time_t)0; | ||
| 29 | - | ||
| 30 | -diff --git a/src/ausearch-options.c b/src/ausearch-options.c | ||
| 31 | -index 8a1f4772..499c2aa3 100644 | ||
| 32 | ---- a/src/ausearch-options.c | ||
| 33 | -+++ b/src/ausearch-options.c | ||
| 34 | -@@ -895,19 +895,21 @@ int check_params(int count, char *vars[]) | ||
| 35 | - size_t len = strlen(optarg); | ||
| 36 | - if (isdigit(optarg[0])) { | ||
| 37 | - errno = 0; | ||
| 38 | -- event_session_id = strtoul(optarg,NULL,10); | ||
| 39 | -- if (errno) | ||
| 40 | -+ unsigned long optval = strtoul(optarg,NULL,10); | ||
| 41 | -+ if (errno || optval >= (1ul << 32)) | ||
| 42 | - retval = -1; | ||
| 43 | -+ event_session_id = optval; | ||
| 44 | - c++; | ||
| 45 | - } else if (len >= 2 && *(optarg)=='-' && | ||
| 46 | - (isdigit(optarg[1]))) { | ||
| 47 | - errno = 0; | ||
| 48 | -- event_session_id = strtoul(optarg, NULL, 0); | ||
| 49 | -- if (errno) { | ||
| 50 | -+ long optval = strtol(optarg, NULL, 0); | ||
| 51 | -+ if (errno || optval < INT_MIN || optval > INT_MAX) { | ||
| 52 | - retval = -1; | ||
| 53 | - fprintf(stderr, "Error converting %s\n", | ||
| 54 | - optarg); | ||
| 55 | - } | ||
| 56 | -+ event_session_id = optval; | ||
| 57 | - c++; | ||
| 58 | - } else { | ||
| 59 | - fprintf(stderr, | ||
| 60 | --- | ||
| 61 | -2.33.0 | ||
| 62 | - | ||
| @@ -1,214 +0,0 @@ | |||
| 1 | -From 38572e7eead76015b388723038f03e2ef0b1e3c1 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <sgrubb@redhat.com> | ||
| 3 | -Date: Fri, 25 Aug 2023 10:41:20 -0400 | ||
| 4 | -Subject: [PATCH] Rewrite legacy service functions in terms of systemctl | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/38572e7eead76015b388723038f03e2ef0b1e3c1 | ||
| 7 | -Conflict:init.d/Makefile.am,ChangeLog | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - init.d/Makefile.am | 3 +-- | ||
| 11 | - init.d/audit-functions | 52 --------------------------------------- | ||
| 12 | - init.d/auditd.condrestart | 7 +++--- | ||
| 13 | - init.d/auditd.reload | 6 +---- | ||
| 14 | - init.d/auditd.resume | 6 +---- | ||
| 15 | - init.d/auditd.rotate | 6 +---- | ||
| 16 | - init.d/auditd.state | 4 +-- | ||
| 17 | - init.d/auditd.stop | 3 +-- | ||
| 18 | - 8 files changed, 10 insertions(+), 77 deletions(-) | ||
| 19 | - delete mode 100644 init.d/audit-functions | ||
| 20 | - | ||
| 21 | -diff --git a/init.d/Makefile.am b/init.d/Makefile.am | ||
| 22 | -index fdbf81c..3a73697 100644 | ||
| 23 | ---- a/init.d/Makefile.am | ||
| 24 | -+++ b/init.d/Makefile.am | ||
| 25 | -@@ -26,7 +26,7 @@ EXTRA_DIST = auditd.init auditd.service auditd.sysconfig auditd.conf \ | ||
| 26 | - auditd.cron libaudit.conf auditd.condrestart \ | ||
| 27 | - auditd.reload auditd.restart auditd.resume \ | ||
| 28 | - auditd.rotate auditd.state auditd.stop \ | ||
| 29 | -- audit-stop.rules augenrules audit-functions | ||
| 30 | -+ audit-stop.rules augenrules | ||
| 31 | - libconfig = libaudit.conf | ||
| 32 | - if ENABLE_SYSTEMD | ||
| 33 | - initdir = /usr/lib/systemd/system | ||
| 34 | -@@ -61,7 +61,6 @@ if ENABLE_SYSTEMD | ||
| 35 | - $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.stop ${DESTDIR}${legacydir}/stop | ||
| 36 | - $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.restart ${DESTDIR}${legacydir}/restart | ||
| 37 | - $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.condrestart ${DESTDIR}${legacydir}/condrestart | ||
| 38 | -- $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/audit-functions ${DESTDIR}${libexecdir} | ||
| 39 | - else | ||
| 40 | - $(INSTALL_SCRIPT) -D ${srcdir}/auditd.init ${DESTDIR}${initdir}/auditd | ||
| 41 | - endif | ||
| 42 | -diff --git a/init.d/audit-functions b/init.d/audit-functions | ||
| 43 | -deleted file mode 100644 | ||
| 44 | -index 12f5023..0000000 | ||
| 45 | ---- a/init.d/audit-functions | ||
| 46 | -+++ /dev/null | ||
| 47 | -@@ -1,52 +0,0 @@ | ||
| 48 | --# -*-Shell-script-*- | ||
| 49 | -- | ||
| 50 | --# Make sure umask is sane | ||
| 51 | --umask 022 | ||
| 52 | -- | ||
| 53 | --#/usr/libexec/audit/audit-functions | ||
| 54 | -- | ||
| 55 | --# killproc {program} [-signal] | ||
| 56 | --killproc () | ||
| 57 | --{ | ||
| 58 | -- local daemon="$1" | ||
| 59 | -- local sig= | ||
| 60 | -- [ -n "${2:-}" ] && sig=$2 | ||
| 61 | -- | ||
| 62 | -- # This matches src/auditd.c | ||
| 63 | -- local pid_file="/var/run/auditd.pid" | ||
| 64 | -- local pid_dir=$(dirname $pid_file) | ||
| 65 | -- | ||
| 66 | -- if [ ! -d "$pid_dir" ] ; then | ||
| 67 | -- return 4 | ||
| 68 | -- fi | ||
| 69 | -- | ||
| 70 | -- local pid= | ||
| 71 | -- if [ -f "$pid_file" ] ; then | ||
| 72 | -- # pid file exists, use it | ||
| 73 | -- while : ; do | ||
| 74 | -- read line | ||
| 75 | -- [ -z "$line" ] && break | ||
| 76 | -- for p in $line ; do | ||
| 77 | -- # pid is numeric and corresponds to a process | ||
| 78 | -- if [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] ; then | ||
| 79 | -- d=$(cat "/proc/$p/comm") | ||
| 80 | -- if [ "$d" = "$daemon" ] ; then | ||
| 81 | -- pid="$p" | ||
| 82 | -- break | ||
| 83 | -- fi | ||
| 84 | -- fi | ||
| 85 | -- done | ||
| 86 | -- done < "$pid_file" | ||
| 87 | -- else | ||
| 88 | -- # need to search /proc | ||
| 89 | -- p=$(pidof "$daemon") | ||
| 90 | -- if [ -n "$p" ] ; then | ||
| 91 | -- pid="$p" | ||
| 92 | -- fi | ||
| 93 | -- fi | ||
| 94 | -- | ||
| 95 | -- # At this point we should have a pid or the process is dead | ||
| 96 | -- if [ -n "$pid" ] && [ -n "$sig" ] ; then | ||
| 97 | -- kill "$sig" "$pid" >/dev/null 2>&1 | ||
| 98 | -- fi | ||
| 99 | --} | ||
| 100 | -diff --git a/init.d/auditd.condrestart b/init.d/auditd.condrestart | ||
| 101 | -index d86e5e4..c5803ff 100644 | ||
| 102 | ---- a/init.d/auditd.condrestart | ||
| 103 | -+++ b/init.d/auditd.condrestart | ||
| 104 | -@@ -2,9 +2,10 @@ | ||
| 105 | - # Helper script to provide legacy auditd service options not | ||
| 106 | - # directly supported by systemd. | ||
| 107 | - | ||
| 108 | --state=`service auditd status | awk '/^ Active/ { print $2 }'` | ||
| 109 | --if [ $state = "active" ] ; then | ||
| 110 | -- /usr/libexec/initscripts/legacy-actions/auditd/restart | ||
| 111 | -+state=$(systemctl status auditd | awk '/Active:/ { print $2 }') | ||
| 112 | -+if [ "$state" = "active" ] ; then | ||
| 113 | -+ /usr/libexec/initscripts/legacy-actions/auditd/stop | ||
| 114 | -+ /bin/systemctl start auditd | ||
| 115 | - RETVAL="$?" | ||
| 116 | - exit $RETVAL | ||
| 117 | - fi | ||
| 118 | -diff --git a/init.d/auditd.reload b/init.d/auditd.reload | ||
| 119 | -index e689534..53ff2f4 100644 | ||
| 120 | ---- a/init.d/auditd.reload | ||
| 121 | -+++ b/init.d/auditd.reload | ||
| 122 | -@@ -5,13 +5,9 @@ | ||
| 123 | - # Check that we are root ... so non-root users stop here | ||
| 124 | - test $(id -u) = 0 || exit 4 | ||
| 125 | - | ||
| 126 | --PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 127 | --prog="auditd" | ||
| 128 | --. /usr/libexec/audit-functions | ||
| 129 | -- | ||
| 130 | - printf "Reconfiguring: " | ||
| 131 | - /sbin/augenrules --load | ||
| 132 | --killproc $prog -HUP | ||
| 133 | -+/sbin/auditctl --signal reload | ||
| 134 | - RETVAL=$? | ||
| 135 | - echo | ||
| 136 | - exit $RETVAL | ||
| 137 | -diff --git a/init.d/auditd.resume b/init.d/auditd.resume | ||
| 138 | -index 6852fd6..96189eb 100644 | ||
| 139 | ---- a/init.d/auditd.resume | ||
| 140 | -+++ b/init.d/auditd.resume | ||
| 141 | -@@ -5,12 +5,8 @@ | ||
| 142 | - # Check that we are root ... so non-root users stop here | ||
| 143 | - test $(id -u) = 0 || exit 4 | ||
| 144 | - | ||
| 145 | --PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 146 | --prog="auditd" | ||
| 147 | --. /usr/libexec/audit-functions | ||
| 148 | -- | ||
| 149 | - printf "Resuming logging: " | ||
| 150 | --killproc $prog -USR2 | ||
| 151 | -+/sbin/auditctl --signal resume | ||
| 152 | - RETVAL=$? | ||
| 153 | - echo | ||
| 154 | - exit $RETVAL | ||
| 155 | -diff --git a/init.d/auditd.rotate b/init.d/auditd.rotate | ||
| 156 | -index 643b935..dcb12c2 100644 | ||
| 157 | ---- a/init.d/auditd.rotate | ||
| 158 | -+++ b/init.d/auditd.rotate | ||
| 159 | -@@ -5,12 +5,8 @@ | ||
| 160 | - # Check that we are root ... so non-root users stop here | ||
| 161 | - test $(id -u) = 0 || exit 4 | ||
| 162 | - | ||
| 163 | --PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 164 | --prog="auditd" | ||
| 165 | --. /usr/libexec/audit-functions | ||
| 166 | -- | ||
| 167 | - printf "Rotating logs: " | ||
| 168 | --killproc $prog -USR1 | ||
| 169 | -+/sbin/auditctl --signal rotate | ||
| 170 | - RETVAL=$? | ||
| 171 | - echo | ||
| 172 | - exit $RETVAL | ||
| 173 | -diff --git a/init.d/auditd.state b/init.d/auditd.state | ||
| 174 | -index 4724c4f..6ae0845 100644 | ||
| 175 | ---- a/init.d/auditd.state | ||
| 176 | -+++ b/init.d/auditd.state | ||
| 177 | -@@ -6,12 +6,10 @@ | ||
| 178 | - test $(id -u) = 0 || exit 4 | ||
| 179 | - | ||
| 180 | - PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 181 | --prog="auditd" | ||
| 182 | - state_file="/var/run/auditd.state" | ||
| 183 | --. /usr/libexec/audit-functions | ||
| 184 | - | ||
| 185 | - printf "Getting auditd internal state: " | ||
| 186 | --killproc $prog -CONT | ||
| 187 | -+/sbin/auditctl --signal state | ||
| 188 | - RETVAL=$? | ||
| 189 | - echo -e "\n" | ||
| 190 | - sleep 1 | ||
| 191 | -diff --git a/init.d/auditd.stop b/init.d/auditd.stop | ||
| 192 | -index d3fbc79..5049285 100644 | ||
| 193 | ---- a/init.d/auditd.stop | ||
| 194 | -+++ b/init.d/auditd.stop | ||
| 195 | -@@ -7,7 +7,6 @@ test $(id -u) = 0 || exit 4 | ||
| 196 | - | ||
| 197 | - PATH=/sbin:/bin:/usr/bin:/usr/sbin | ||
| 198 | - prog="auditd" | ||
| 199 | --. /usr/libexec/audit-functions | ||
| 200 | - pid= | ||
| 201 | - p=$(pidof "$prog") | ||
| 202 | - if [ -n "$p" ] ; then | ||
| 203 | -@@ -15,7 +14,7 @@ if [ -n "$p" ] ; then | ||
| 204 | - fi | ||
| 205 | - | ||
| 206 | - printf "Stopping logging: " | ||
| 207 | --killproc $prog -TERM | ||
| 208 | -+/sbin/auditctl --signal stop | ||
| 209 | - RETVAL=$? | ||
| 210 | - if [ -n "$pid" ] ; then | ||
| 211 | - # Wait up to 20 seconds for auditd to shutdown | ||
| 212 | --- | ||
| 213 | -2.33.0 | ||
| 214 | - | ||
| @@ -1,62 +0,0 @@ | |||
| 1 | -From 0604569e79a5d1c76b32f15576e129e0b813659f Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Sun, 24 Mar 2024 13:06:59 -0400 | ||
| 4 | -Subject: [PATCH] Solve issue #363 by moving check to after load_config | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/0604569e79a5d1c76b32f15576e129e0b813659f | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/auditd.c | 29 +++++++++++++++-------------- | ||
| 11 | - 1 file changed, 15 insertions(+), 14 deletions(-) | ||
| 12 | - | ||
| 13 | -diff --git a/src/auditd.c b/src/auditd.c | ||
| 14 | -index e0fe9925..67ce06c0 100644 | ||
| 15 | ---- a/src/auditd.c | ||
| 16 | -+++ b/src/auditd.c | ||
| 17 | -@@ -676,20 +676,6 @@ int main(int argc, char *argv[]) | ||
| 18 | - } | ||
| 19 | - session = audit_get_session(); | ||
| 20 | - | ||
| 21 | --#ifndef DEBUG | ||
| 22 | -- /* Make sure we can do our job. Containers may not give you | ||
| 23 | -- * capabilities, so we revert to a uid check for that case. */ | ||
| 24 | -- if (!audit_can_control()) { | ||
| 25 | -- if (!config.local_events && geteuid() == 0) | ||
| 26 | -- ; | ||
| 27 | -- else { | ||
| 28 | -- fprintf(stderr, | ||
| 29 | -- "You must be root or have capabilities to run this program.\n"); | ||
| 30 | -- return 4; | ||
| 31 | -- } | ||
| 32 | -- } | ||
| 33 | --#endif | ||
| 34 | -- | ||
| 35 | - /* Register sighandlers */ | ||
| 36 | - sa.sa_flags = 0 ; | ||
| 37 | - sigemptyset( &sa.sa_mask ) ; | ||
| 38 | -@@ -717,6 +703,21 @@ int main(int argc, char *argv[]) | ||
| 39 | - free_config(&config); | ||
| 40 | - return 6; | ||
| 41 | - } | ||
| 42 | -+ | ||
| 43 | -+#ifndef DEBUG | ||
| 44 | -+ /* Make sure we can do our job. Containers may not give you | ||
| 45 | -+ * capabilities, so we revert to a uid check for that case. */ | ||
| 46 | -+ if (!audit_can_control()) { | ||
| 47 | -+ if (!config.local_events && geteuid() == 0) | ||
| 48 | -+ ; | ||
| 49 | -+ else { | ||
| 50 | -+ fprintf(stderr, | ||
| 51 | -+ "You must be root or have capabilities to run this program.\n"); | ||
| 52 | -+ return 4; | ||
| 53 | -+ } | ||
| 54 | -+ } | ||
| 55 | -+#endif | ||
| 56 | -+ | ||
| 57 | - if (config.daemonize == D_FOREGROUND) | ||
| 58 | - config.write_logs = 0; | ||
| 59 | - | ||
| 60 | --- | ||
| 61 | -2.33.0 | ||
| 62 | - | ||
| @@ -1,27 +0,0 @@ | |||
| 1 | -From 5eef876b3eb2fa3348be6cd31bd651a98b164deb Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Wed, 27 Mar 2024 17:34:33 +0300 | ||
| 4 | -Subject: [PATCH] adding the file descriptor closure | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/5eef876b3eb2fa3348be6cd31bd651a98b164deb | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/auditctl.c | 1 + | ||
| 11 | - 1 file changed, 1 insertion(+) | ||
| 12 | - | ||
| 13 | -diff --git a/src/auditctl.c b/src/auditctl.c | ||
| 14 | -index 503b4e2b..7949d95c 100644 | ||
| 15 | ---- a/src/auditctl.c | ||
| 16 | -+++ b/src/auditctl.c | ||
| 17 | -@@ -1393,6 +1393,7 @@ static int fileopt(const char *file) | ||
| 18 | - fields = malloc(nf * sizeof(char *)); | ||
| 19 | - if (fields == NULL) { | ||
| 20 | - audit_msg(LOG_ERR, "Out of memory. Check %s file, %d line", __FILE__, __LINE__); | ||
| 21 | -+ fclose(f); | ||
| 22 | - return 1; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | --- | ||
| 26 | -2.33.0 | ||
| 27 | - | ||
| @@ -1,41 +0,0 @@ | |||
| 1 | -From 4780cd1a790286213dda646f782fa7128fb092a9 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <77495782+Yugend@users.noreply.github.com> | ||
| 3 | -Date: Sat, 4 May 2024 00:39:36 +0300 | ||
| 4 | -Subject: [PATCH] avoiding of NULL pointers dereference (#366) | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/4780cd1a790286213dda646f782fa7128fb092a9 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/ausearch-parse.c | 8 ++++++++ | ||
| 11 | - 1 file changed, 8 insertions(+) | ||
| 12 | - | ||
| 13 | -diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c | ||
| 14 | -index 1a5b047f..be57606b 100644 | ||
| 15 | ---- a/src/ausearch-parse.c | ||
| 16 | -+++ b/src/ausearch-parse.c | ||
| 17 | -@@ -719,6 +719,10 @@ static int common_path_parser(search_items *s, char *path) | ||
| 18 | - // append | ||
| 19 | - snode sn; | ||
| 20 | - sn.str = strdup(path); | ||
| 21 | -+ if (sn.str == NULL) { | ||
| 22 | -+ fprintf(stderr, "Out of memory. Check %s file, %d line\n", __FILE__, __LINE__); | ||
| 23 | -+ return 8; | ||
| 24 | -+ } | ||
| 25 | - sn.key = NULL; | ||
| 26 | - sn.hits = 1; | ||
| 27 | - // Attempt to rebuild path if relative | ||
| 28 | -@@ -1217,6 +1221,10 @@ skip: | ||
| 29 | - saved = *term; | ||
| 30 | - *term = 0; | ||
| 31 | - s->hostname = strdup(str); | ||
| 32 | -+ if (s->hostname == NULL) { | ||
| 33 | -+ fprintf(stderr, "Out of memory. Check %s file, %d line\n", __FILE__, __LINE__); | ||
| 34 | -+ return 33; | ||
| 35 | -+ } | ||
| 36 | - *term = saved; | ||
| 37 | - | ||
| 38 | - // Lets see if there is something more | ||
| 39 | --- | ||
| 40 | -2.33.0 | ||
| 41 | - | ||
| @@ -1,28 +0,0 @@ | |||
| 1 | -From 3f3b3a2377ce1977dd4136aa653f2f65c3cd2fe0 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Wed, 27 Mar 2024 17:41:07 +0300 | ||
| 4 | -Subject: [PATCH] correcting memcmp args in check_rule_mismatch function | ||
| 5 | - | ||
| 6 | -Conflict:src/auditctl.c | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/3f3b3a2377ce1977dd4136aa653f2f65c3cd2fe0 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/auditctl.c | 2 +- | ||
| 11 | - 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | - | ||
| 13 | -diff --git a/src/auditctl.c b/src/auditctl.c | ||
| 14 | -index 7949d95c..acb1e518 100644 | ||
| 15 | ---- a/src/auditctl.c | ||
| 16 | -+++ b/src/auditctl.c | ||
| 17 | -@@ -392,7 +392,7 @@ static int check_rule_mismatch(int lineno, const char *option) | ||
| 18 | - audit_rule_syscallbyname_data(&tmprule, ptr); | ||
| 19 | - ptr = strtok_r(NULL, ",", &saved); | ||
| 20 | - } | ||
| 21 | -- if (memcmp(tmprule.mask, rule_new->mask, AUDIT_BITMASK_SIZE)) | ||
| 22 | -+ if (memcmp(tmprule.mask, rule_new->mask, AUDIT_BITMASK_SIZE * sizeof(tmprule.mask[0]))) | ||
| 23 | - rc = 1; | ||
| 24 | - free(tmp); | ||
| 25 | - | ||
| 26 | --- | ||
| 27 | -2.33.0 | ||
| 28 | - | ||
| @@ -1,147 +0,0 @@ | |||
| 1 | -From b046de44454fa2616dbb8899f1b41d65ce876e33 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Fri, 15 Mar 2024 17:08:16 +0300 | ||
| 4 | -Subject: [PATCH] first part of NULL pointer checks | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/b046de44454fa2616dbb8899f1b41d65ce876e33 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - audisp/audispd-llist.c | 3 +++ | ||
| 11 | - auparse/auparse.c | 7 +++++++ | ||
| 12 | - src/auditctl-llist.c | 3 +++ | ||
| 13 | - src/auditctl.c | 5 +++++ | ||
| 14 | - src/ausearch-avc.c | 3 +++ | ||
| 15 | - src/ausearch-int.c | 3 +++ | ||
| 16 | - src/ausearch-llist.c | 3 +++ | ||
| 17 | - tools/aulastlog/aulastlog-llist.c | 3 +++ | ||
| 18 | - 8 files changed, 30 insertions(+) | ||
| 19 | - | ||
| 20 | -diff --git a/audisp/audispd-llist.c b/audisp/audispd-llist.c | ||
| 21 | -index c562a72a..c338327d 100644 | ||
| 22 | ---- a/audisp/audispd-llist.c | ||
| 23 | -+++ b/audisp/audispd-llist.c | ||
| 24 | -@@ -74,6 +74,9 @@ void plist_append(conf_llist *l, plugin_conf_t *p) | ||
| 25 | - lnode* newnode; | ||
| 26 | - | ||
| 27 | - newnode = malloc(sizeof(lnode)); | ||
| 28 | -+ if (newnode == NULL) { | ||
| 29 | -+ return; | ||
| 30 | -+ } | ||
| 31 | - | ||
| 32 | - if (p) { | ||
| 33 | - void *pp = malloc(sizeof(struct plugin_conf)); | ||
| 34 | -diff --git a/auparse/auparse.c b/auparse/auparse.c | ||
| 35 | -index e196373b..516ee8f1 100644 | ||
| 36 | ---- a/auparse/auparse.c | ||
| 37 | -+++ b/auparse/auparse.c | ||
| 38 | -@@ -113,6 +113,11 @@ static int setup_log_file_array(auparse_state_t *au) | ||
| 39 | - } | ||
| 40 | - num--; | ||
| 41 | - tmp = malloc((num+2)*sizeof(char *)); | ||
| 42 | -+ if (!tmp) { | ||
| 43 | -+ fprintf(stderr, "No memory\n"); | ||
| 44 | -+ aup_free_config(&config); | ||
| 45 | -+ return 1; | ||
| 46 | -+ } | ||
| 47 | - | ||
| 48 | - /* Got it, now process logs from last to first */ | ||
| 49 | - if (num > 0) | ||
| 50 | -@@ -489,6 +494,8 @@ auparse_state_t *auparse_init(ausource_t source, const void *b) | ||
| 51 | - if (access_ok(b)) | ||
| 52 | - goto bad_exit; | ||
| 53 | - tmp = malloc(2*sizeof(char *)); | ||
| 54 | -+ if (tmp == NULL) | ||
| 55 | -+ goto bad_exit; | ||
| 56 | - tmp[0] = strdup(b); | ||
| 57 | - tmp[1] = NULL; | ||
| 58 | - au->source_list = tmp; | ||
| 59 | -diff --git a/src/auditctl-llist.c b/src/auditctl-llist.c | ||
| 60 | -index 182d88b5..0f81d4c8 100644 | ||
| 61 | ---- a/src/auditctl-llist.c | ||
| 62 | -+++ b/src/auditctl-llist.c | ||
| 63 | -@@ -64,6 +64,9 @@ void list_append(llist *l, const struct audit_rule_data *r, size_t sz) | ||
| 64 | - lnode* newnode; | ||
| 65 | - | ||
| 66 | - newnode = malloc(sizeof(lnode)); | ||
| 67 | -+ if (newnode == NULL) { | ||
| 68 | -+ return; | ||
| 69 | -+ } | ||
| 70 | - | ||
| 71 | - if (r) { | ||
| 72 | - void *rr = malloc(sz); | ||
| 73 | -diff --git a/src/auditctl.c b/src/auditctl.c | ||
| 74 | -index dac5118a..ee7e33c8 100644 | ||
| 75 | ---- a/src/auditctl.c | ||
| 76 | -+++ b/src/auditctl.c | ||
| 77 | -@@ -1391,6 +1391,11 @@ static int fileopt(const char *file) | ||
| 78 | - } | ||
| 79 | - i = 0; | ||
| 80 | - fields = malloc(nf * sizeof(char *)); | ||
| 81 | -+ if (fields == NULL) { | ||
| 82 | -+ audit_msg(LOG_ERR, "Memory allocation error"); | ||
| 83 | -+ return 1; | ||
| 84 | -+ } | ||
| 85 | -+ | ||
| 86 | - fields[i++] = "auditctl"; | ||
| 87 | - fields[i++] = ptr; | ||
| 88 | - while( (ptr=audit_strsplit(NULL)) && (i < nf-1)) { | ||
| 89 | -diff --git a/src/ausearch-avc.c b/src/ausearch-avc.c | ||
| 90 | -index 10d153f6..6aa98c70 100644 | ||
| 91 | ---- a/src/ausearch-avc.c | ||
| 92 | -+++ b/src/ausearch-avc.c | ||
| 93 | -@@ -67,6 +67,9 @@ void alist_append(alist *l, anode *node) | ||
| 94 | - anode* newnode; | ||
| 95 | - | ||
| 96 | - newnode = malloc(sizeof(anode)); | ||
| 97 | -+ if (newnode == NULL) { | ||
| 98 | -+ return; | ||
| 99 | -+ } | ||
| 100 | - | ||
| 101 | - if (node->scontext) | ||
| 102 | - newnode->scontext = node->scontext; | ||
| 103 | -diff --git a/src/ausearch-int.c b/src/ausearch-int.c | ||
| 104 | -index 718dacda..0e8b0ffe 100644 | ||
| 105 | ---- a/src/ausearch-int.c | ||
| 106 | -+++ b/src/ausearch-int.c | ||
| 107 | -@@ -46,6 +46,9 @@ void ilist_append(ilist *l, int num, unsigned int hits, int aux) | ||
| 108 | - int_node* newnode; | ||
| 109 | - | ||
| 110 | - newnode = malloc(sizeof(int_node)); | ||
| 111 | -+ if (newnode == NULL) { | ||
| 112 | -+ return; | ||
| 113 | -+ } | ||
| 114 | - | ||
| 115 | - newnode->num = num; | ||
| 116 | - newnode->hits = hits; | ||
| 117 | -diff --git a/src/ausearch-llist.c b/src/ausearch-llist.c | ||
| 118 | -index 0fa6f671..36fcae6d 100644 | ||
| 119 | ---- a/src/ausearch-llist.c | ||
| 120 | -+++ b/src/ausearch-llist.c | ||
| 121 | -@@ -107,6 +107,9 @@ void list_append(llist *l, lnode *node) | ||
| 122 | - lnode* newnode; | ||
| 123 | - | ||
| 124 | - newnode = malloc(sizeof(lnode)); | ||
| 125 | -+ if (newnode == NULL) { | ||
| 126 | -+ return; | ||
| 127 | -+ } | ||
| 128 | - | ||
| 129 | - if (node->message) | ||
| 130 | - newnode->message = node->message; | ||
| 131 | -diff --git a/tools/aulastlog/aulastlog-llist.c b/tools/aulastlog/aulastlog-llist.c | ||
| 132 | -index 84882ca8..779afb50 100644 | ||
| 133 | ---- a/tools/aulastlog/aulastlog-llist.c | ||
| 134 | -+++ b/tools/aulastlog/aulastlog-llist.c | ||
| 135 | -@@ -46,6 +46,9 @@ void list_append(llist *l, lnode *node) | ||
| 136 | - lnode* newnode; | ||
| 137 | - | ||
| 138 | - newnode = malloc(sizeof(lnode)); | ||
| 139 | -+ if (newnode == NULL) { | ||
| 140 | -+ return; | ||
| 141 | -+ } | ||
| 142 | - | ||
| 143 | - newnode->sec = node->sec; | ||
| 144 | - newnode->uid = node->uid; | ||
| 145 | --- | ||
| 146 | -2.33.0 | ||
| 147 | - | ||
| @@ -1,30 +0,0 @@ | |||
| 1 | -From 613ccbdd1011692c6724a11cc8798112dd26d202 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Tue, 21 May 2024 13:17:38 -0400 | ||
| 4 | -Subject: [PATCH] fix one more leak | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/613ccbdd1011692c6724a11cc8798112dd26d202 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - src/ausearch-lol.c | 4 +++- | ||
| 11 | - 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 12 | - | ||
| 13 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 14 | -index 784c58f6..d156ce42 100644 | ||
| 15 | ---- a/src/ausearch-lol.c | ||
| 16 | -+++ b/src/ausearch-lol.c | ||
| 17 | -@@ -371,7 +371,9 @@ int lol_add_record(lol *lo, char *buff) | ||
| 18 | - l = malloc(sizeof(llist)); | ||
| 19 | - if (l == NULL) { | ||
| 20 | - free((char *)e.node); | ||
| 21 | -- fprintf(stderr, "Out of memory. Check %s file, %d line", __FILE__, __LINE__); | ||
| 22 | -+ free(n.message); | ||
| 23 | -+ fprintf(stderr, "Out of memory. Check %s file, %d line", | ||
| 24 | -+ __FILE__, __LINE__); | ||
| 25 | - return 0; | ||
| 26 | - } | ||
| 27 | - list_create(l); | ||
| 28 | --- | ||
| 29 | -2.33.0 | ||
| 30 | - | ||
| @@ -1,401 +0,0 @@ | |||
| 1 | -From 149a3464ef35fbaa98c57e2775a7a4ab20c2ee75 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Steve Grubb <ausearch.1@gmail.com> | ||
| 3 | -Date: Sun, 5 Nov 2023 14:24:49 -0500 | ||
| 4 | -Subject: [PATCH] fix the use of isdigit everywhere | ||
| 5 | - | ||
| 6 | -Reference:https://github.com/linux-audit/audit-userspace/commit/149a3464ef35fbaa98c57e2775a7a4ab20c2ee75 | ||
| 7 | -Conflict:NA | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - audisp/plugins/af_unix/audisp-af_unix.c | 2 +- | ||
| 11 | - audisp/plugins/ids/ids_config.c | 2 +- | ||
| 12 | - audisp/plugins/remote/remote-config.c | 2 +- | ||
| 13 | - audisp/plugins/zos-remote/zos-remote-config.c | 6 ++-- | ||
| 14 | - auparse/auditd-config.c | 2 +- | ||
| 15 | - auparse/interpret.c | 6 ++-- | ||
| 16 | - src/auditctl.c | 6 ++-- | ||
| 17 | - src/aureport-options.c | 4 +-- | ||
| 18 | - src/aureport-output.c | 2 +- | ||
| 19 | - src/ausearch-options.c | 36 +++++++++---------- | ||
| 20 | - src/ausearch-parse.c | 2 +- | ||
| 21 | - tools/ausyscall/ausyscall.c | 4 +-- | ||
| 22 | - 12 files changed, 37 insertions(+), 37 deletions(-) | ||
| 23 | - | ||
| 24 | -diff --git a/audisp/plugins/af_unix/audisp-af_unix.c b/audisp/plugins/af_unix/audisp-af_unix.c | ||
| 25 | -index ffcc7603..ffbf2ac0 100644 | ||
| 26 | ---- a/audisp/plugins/af_unix/audisp-af_unix.c | ||
| 27 | -+++ b/audisp/plugins/af_unix/audisp-af_unix.c | ||
| 28 | -@@ -126,7 +126,7 @@ int setup_socket(int argc, char *argv[]) | ||
| 29 | - } else { | ||
| 30 | - int i; | ||
| 31 | - for (i=1; i < 3; i++) { | ||
| 32 | -- if (isdigit(argv[i][0])) { | ||
| 33 | -+ if (isdigit((unsigned char)argv[i][0])) { | ||
| 34 | - errno = 0; | ||
| 35 | - mode = strtoul(argv[i], NULL, 8); | ||
| 36 | - if (errno) { | ||
| 37 | -diff --git a/audisp/plugins/ids/ids_config.c b/audisp/plugins/ids/ids_config.c | ||
| 38 | -index 4da5ca93..f773794a 100644 | ||
| 39 | ---- a/audisp/plugins/ids/ids_config.c | ||
| 40 | -+++ b/audisp/plugins/ids/ids_config.c | ||
| 41 | -@@ -345,7 +345,7 @@ static int unsigned_int_parser(struct nv_pair *nv, int line, unsigned int *val) | ||
| 42 | - | ||
| 43 | - /* check that all chars are numbers */ | ||
| 44 | - for (i=0; ptr[i]; i++) { | ||
| 45 | -- if (!isdigit(ptr[i])) { | ||
| 46 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 47 | - syslog(LOG_ERR, | ||
| 48 | - "Value %s should only be numbers - line %d", | ||
| 49 | - nv->value, line); | ||
| 50 | -diff --git a/audisp/plugins/remote/remote-config.c b/audisp/plugins/remote/remote-config.c | ||
| 51 | -index 02b51337..8de7b27f 100644 | ||
| 52 | ---- a/audisp/plugins/remote/remote-config.c | ||
| 53 | -+++ b/audisp/plugins/remote/remote-config.c | ||
| 54 | -@@ -484,7 +484,7 @@ static int parse_uint (const struct nv_pair *nv, int line, unsigned int *valp, | ||
| 55 | - | ||
| 56 | - /* check that all chars are numbers */ | ||
| 57 | - for (i=0; ptr[i]; i++) { | ||
| 58 | -- if (!isdigit(ptr[i])) { | ||
| 59 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 60 | - syslog(LOG_ERR, | ||
| 61 | - "Value %s should only be numbers - line %d", | ||
| 62 | - nv->value, line); | ||
| 63 | -diff --git a/audisp/plugins/zos-remote/zos-remote-config.c b/audisp/plugins/zos-remote/zos-remote-config.c | ||
| 64 | -index b92dc778..2f7e42f5 100644 | ||
| 65 | ---- a/audisp/plugins/zos-remote/zos-remote-config.c | ||
| 66 | -+++ b/audisp/plugins/zos-remote/zos-remote-config.c | ||
| 67 | -@@ -301,7 +301,7 @@ static int port_parser(struct nv_pair *nv, int line, plugin_conf_t * c) | ||
| 68 | - | ||
| 69 | - /* check that all chars are numbers */ | ||
| 70 | - for (i = 0; ptr[i]; i++) { | ||
| 71 | -- if (!isdigit(ptr[i])) { | ||
| 72 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 73 | - log_err("Value %s should only be numbers - line %d", nv->value, line); | ||
| 74 | - return 1; | ||
| 75 | - } | ||
| 76 | -@@ -327,7 +327,7 @@ static int timeout_parser(struct nv_pair *nv, int line, plugin_conf_t * c) | ||
| 77 | - | ||
| 78 | - /* check that all chars are numbers */ | ||
| 79 | - for (i = 0; ptr[i]; i++) { | ||
| 80 | -- if (!isdigit(ptr[i])) { | ||
| 81 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 82 | - log_err("Value %s should only be numbers - line %d", nv->value, line); | ||
| 83 | - return 1; | ||
| 84 | - } | ||
| 85 | -@@ -376,7 +376,7 @@ static int q_depth_parser(struct nv_pair *nv, int line, plugin_conf_t * c) | ||
| 86 | - | ||
| 87 | - /* check that all chars are numbers */ | ||
| 88 | - for (i = 0; ptr[i]; i++) { | ||
| 89 | -- if (!isdigit(ptr[i])) { | ||
| 90 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 91 | - log_err("Value %s should only be numbers - line %d", nv->value, line); | ||
| 92 | - return 1; | ||
| 93 | - } | ||
| 94 | -diff --git a/auparse/auditd-config.c b/auparse/auditd-config.c | ||
| 95 | -index 9a6a6a71..6e5c86a8 100644 | ||
| 96 | ---- a/auparse/auditd-config.c | ||
| 97 | -+++ b/auparse/auditd-config.c | ||
| 98 | -@@ -340,7 +340,7 @@ static int eoe_timeout_parser(auparse_state_t *au, const char *val, int line, | ||
| 99 | - | ||
| 100 | - /* check that all chars are numbers */ | ||
| 101 | - for (i=0; ptr[i]; i++) { | ||
| 102 | -- if (!isdigit(ptr[i])) { | ||
| 103 | -+ if (!isdigit((unsigned char)ptr[i])) { | ||
| 104 | - audit_msg(au, LOG_ERR, | ||
| 105 | - "Value %s should only be numbers - line %d", | ||
| 106 | - val, line); | ||
| 107 | -diff --git a/auparse/interpret.c b/auparse/interpret.c | ||
| 108 | -index f13723b6..77c96468 100644 | ||
| 109 | ---- a/auparse/interpret.c | ||
| 110 | -+++ b/auparse/interpret.c | ||
| 111 | -@@ -325,7 +325,7 @@ static void key_escape(const char *orig, char *dest, auparse_esc_t escape_mode) | ||
| 112 | - static int is_int_string(const char *str) | ||
| 113 | - { | ||
| 114 | - while (*str) { | ||
| 115 | -- if (!isdigit(*str)) | ||
| 116 | -+ if (!isdigit((unsigned char)*str)) | ||
| 117 | - return 0; | ||
| 118 | - str++; | ||
| 119 | - } | ||
| 120 | -@@ -1485,7 +1485,7 @@ static const char *print_success(const char *val) | ||
| 121 | - { | ||
| 122 | - int res; | ||
| 123 | - | ||
| 124 | -- if (isdigit(*val)) { | ||
| 125 | -+ if (isdigit((unsigned char)*val)) { | ||
| 126 | - errno = 0; | ||
| 127 | - res = strtoul(val, NULL, 10); | ||
| 128 | - if (errno) { | ||
| 129 | -@@ -2319,7 +2319,7 @@ static const char *print_fanotify(const char *val) | ||
| 130 | - { | ||
| 131 | - int res; | ||
| 132 | - | ||
| 133 | -- if (isdigit(*val)) { | ||
| 134 | -+ if (isdigit((unsigned char)*val)) { | ||
| 135 | - errno = 0; | ||
| 136 | - res = strtoul(val, NULL, 10); | ||
| 137 | - if (errno) { | ||
| 138 | -diff --git a/src/auditctl.c b/src/auditctl.c | ||
| 139 | -index ccd62bc3..e1ca0f83 100644 | ||
| 140 | ---- a/src/auditctl.c | ||
| 141 | -+++ b/src/auditctl.c | ||
| 142 | -@@ -680,7 +680,7 @@ static int setopt(int count, int lineno, char *vars[]) | ||
| 143 | - } | ||
| 144 | - break; | ||
| 145 | - case 'r': | ||
| 146 | -- if (optarg && isdigit(optarg[0])) { | ||
| 147 | -+ if (optarg && isdigit((unsigned char)optarg[0])) { | ||
| 148 | - uint32_t rate; | ||
| 149 | - errno = 0; | ||
| 150 | - rate = strtoul(optarg,NULL,0); | ||
| 151 | -@@ -699,7 +699,7 @@ static int setopt(int count, int lineno, char *vars[]) | ||
| 152 | - } | ||
| 153 | - break; | ||
| 154 | - case 'b': | ||
| 155 | -- if (optarg && isdigit(optarg[0])) { | ||
| 156 | -+ if (optarg && isdigit((unsigned char)optarg[0])) { | ||
| 157 | - uint32_t limit; | ||
| 158 | - errno = 0; | ||
| 159 | - limit = strtoul(optarg,NULL,0); | ||
| 160 | -@@ -1134,7 +1134,7 @@ process_keys: | ||
| 161 | - case 2: | ||
| 162 | - #if HAVE_DECL_AUDIT_VERSION_BACKLOG_WAIT_TIME == 1 || \ | ||
| 163 | - HAVE_DECL_AUDIT_STATUS_BACKLOG_WAIT_TIME == 1 | ||
| 164 | -- if (optarg && isdigit(optarg[0])) { | ||
| 165 | -+ if (optarg && isdigit((unsigned char)optarg[0])) { | ||
| 166 | - uint32_t bwt; | ||
| 167 | - errno = 0; | ||
| 168 | - bwt = strtoul(optarg,NULL,0); | ||
| 169 | -diff --git a/src/aureport-options.c b/src/aureport-options.c | ||
| 170 | -index 203c3880..7480c8a9 100644 | ||
| 171 | ---- a/src/aureport-options.c | ||
| 172 | -+++ b/src/aureport-options.c | ||
| 173 | -@@ -385,7 +385,7 @@ int check_params(int count, char *vars[]) | ||
| 174 | - // } else { | ||
| 175 | - // UNIMPLEMENTED; | ||
| 176 | - // set_detail(D_SPECIFIC); | ||
| 177 | --// if (isdigit(optarg[0])) { | ||
| 178 | -+// if (isdigit((unsigned char)optarg[0])) { | ||
| 179 | - // errno = 0; | ||
| 180 | - // event_id = strtoul(optarg, | ||
| 181 | - // NULL, 10); | ||
| 182 | -@@ -764,7 +764,7 @@ int check_params(int count, char *vars[]) | ||
| 183 | - retval = -1; | ||
| 184 | - break; | ||
| 185 | - } | ||
| 186 | -- if (isdigit(optarg[0])) { | ||
| 187 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 188 | - errno = 0; | ||
| 189 | - arg_eoe_timeout = (time_t)strtoul(optarg, NULL, 10); | ||
| 190 | - if (errno || arg_eoe_timeout == 0) { | ||
| 191 | -diff --git a/src/aureport-output.c b/src/aureport-output.c | ||
| 192 | -index a635d536..27a2ce25 100644 | ||
| 193 | ---- a/src/aureport-output.c | ||
| 194 | -+++ b/src/aureport-output.c | ||
| 195 | -@@ -976,7 +976,7 @@ static void do_user_summary_output(slist *sptr) | ||
| 196 | - long uid; | ||
| 197 | - char name[64]; | ||
| 198 | - | ||
| 199 | -- if (sn->str[0] == '-' || isdigit(sn->str[0])) { | ||
| 200 | -+ if (sn->str[0] == '-' || isdigit((unsigned char)sn->str[0])) { | ||
| 201 | - uid = strtol(sn->str, NULL, 10); | ||
| 202 | - printf("%u ", sn->hits); | ||
| 203 | - safe_print_string(aulookup_uid(uid, name, | ||
| 204 | -diff --git a/src/ausearch-options.c b/src/ausearch-options.c | ||
| 205 | -index 53d0db64..1c653648 100644 | ||
| 206 | ---- a/src/ausearch-options.c | ||
| 207 | -+++ b/src/ausearch-options.c | ||
| 208 | -@@ -253,7 +253,7 @@ static int convert_str_to_msg(const char *optarg) | ||
| 209 | - { | ||
| 210 | - int tmp, retval = 0; | ||
| 211 | - | ||
| 212 | -- if (isdigit(optarg[0])) { | ||
| 213 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 214 | - errno = 0; | ||
| 215 | - tmp = strtoul(optarg, NULL, 10); | ||
| 216 | - if (errno) { | ||
| 217 | -@@ -335,7 +335,7 @@ int check_params(int count, char *vars[]) | ||
| 218 | - retval = -1; | ||
| 219 | - break; | ||
| 220 | - } | ||
| 221 | -- if (isdigit(optarg[0])) { | ||
| 222 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 223 | - errno = 0; | ||
| 224 | - event_id = strtoul(optarg, NULL, 10); | ||
| 225 | - if (errno) { | ||
| 226 | -@@ -357,7 +357,7 @@ int check_params(int count, char *vars[]) | ||
| 227 | - retval = -1; | ||
| 228 | - break; | ||
| 229 | - } | ||
| 230 | -- if (isdigit(optarg[0])) { | ||
| 231 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 232 | - errno = 0; | ||
| 233 | - arg_eoe_timeout = (time_t)strtoul(optarg, NULL, 10); | ||
| 234 | - if (errno || arg_eoe_timeout == 0) { | ||
| 235 | -@@ -463,7 +463,7 @@ int check_params(int count, char *vars[]) | ||
| 236 | - retval = -1; | ||
| 237 | - break; | ||
| 238 | - } | ||
| 239 | -- if (isdigit(optarg[0])) { | ||
| 240 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 241 | - errno = 0; | ||
| 242 | - event_gid = strtoul(optarg,NULL,10); | ||
| 243 | - if (errno) { | ||
| 244 | -@@ -497,7 +497,7 @@ int check_params(int count, char *vars[]) | ||
| 245 | - retval = -1; | ||
| 246 | - break; | ||
| 247 | - } | ||
| 248 | -- if (isdigit(optarg[0])) { | ||
| 249 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 250 | - errno = 0; | ||
| 251 | - event_egid = strtoul(optarg,NULL,10); | ||
| 252 | - if (errno) { | ||
| 253 | -@@ -529,7 +529,7 @@ int check_params(int count, char *vars[]) | ||
| 254 | - retval = -1; | ||
| 255 | - break; | ||
| 256 | - } | ||
| 257 | -- if (isdigit(optarg[0])) { | ||
| 258 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 259 | - errno = 0; | ||
| 260 | - event_gid = strtoul(optarg,NULL,10); | ||
| 261 | - if (errno) { | ||
| 262 | -@@ -655,7 +655,7 @@ int check_params(int count, char *vars[]) | ||
| 263 | - retval = -1; | ||
| 264 | - break; | ||
| 265 | - } | ||
| 266 | -- if (isdigit(optarg[0])) { | ||
| 267 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 268 | - errno = 0; | ||
| 269 | - event_ppid = strtol(optarg,NULL,10); | ||
| 270 | - if (errno) | ||
| 271 | -@@ -676,7 +676,7 @@ int check_params(int count, char *vars[]) | ||
| 272 | - retval = -1; | ||
| 273 | - break; | ||
| 274 | - } | ||
| 275 | -- if (isdigit(optarg[0])) { | ||
| 276 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 277 | - errno = 0; | ||
| 278 | - event_pid = strtol(optarg,NULL,10); | ||
| 279 | - if (errno) | ||
| 280 | -@@ -794,7 +794,7 @@ int check_params(int count, char *vars[]) | ||
| 281 | - retval = -1; | ||
| 282 | - break; | ||
| 283 | - } | ||
| 284 | -- if (isdigit(optarg[0])) { | ||
| 285 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 286 | - errno = 0; | ||
| 287 | - event_syscall = (int)strtoul(optarg, NULL, 10); | ||
| 288 | - if (errno) { | ||
| 289 | -@@ -893,7 +893,7 @@ int check_params(int count, char *vars[]) | ||
| 290 | - } | ||
| 291 | - { | ||
| 292 | - size_t len = strlen(optarg); | ||
| 293 | -- if (isdigit(optarg[0])) { | ||
| 294 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 295 | - errno = 0; | ||
| 296 | - unsigned long optval = strtoul(optarg,NULL,10); | ||
| 297 | - if (errno || optval >= (1ul << 32)) | ||
| 298 | -@@ -901,7 +901,7 @@ int check_params(int count, char *vars[]) | ||
| 299 | - event_session_id = optval; | ||
| 300 | - c++; | ||
| 301 | - } else if (len >= 2 && *(optarg)=='-' && | ||
| 302 | -- (isdigit(optarg[1]))) { | ||
| 303 | -+ (isdigit((unsigned char)optarg[1]))) { | ||
| 304 | - errno = 0; | ||
| 305 | - long optval = strtol(optarg, NULL, 0); | ||
| 306 | - if (errno || optval < INT_MIN || optval > INT_MAX) { | ||
| 307 | -@@ -933,7 +933,7 @@ int check_params(int count, char *vars[]) | ||
| 308 | - } | ||
| 309 | - { | ||
| 310 | - size_t len = strlen(optarg); | ||
| 311 | -- if (isdigit(optarg[0])) { | ||
| 312 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 313 | - errno = 0; | ||
| 314 | - event_exit = strtoll(optarg, NULL, 0); | ||
| 315 | - if (errno) { | ||
| 316 | -@@ -942,7 +942,7 @@ int check_params(int count, char *vars[]) | ||
| 317 | - optarg); | ||
| 318 | - } | ||
| 319 | - } else if (len >= 2 && *(optarg)=='-' && | ||
| 320 | -- (isdigit(optarg[1]))) { | ||
| 321 | -+ (isdigit((unsigned char)optarg[1]))) { | ||
| 322 | - errno = 0; | ||
| 323 | - event_exit = strtoll(optarg, NULL, 0); | ||
| 324 | - if (errno) { | ||
| 325 | -@@ -1074,7 +1074,7 @@ int check_params(int count, char *vars[]) | ||
| 326 | - retval = -1; | ||
| 327 | - break; | ||
| 328 | - } | ||
| 329 | -- if (isdigit(optarg[0])) { | ||
| 330 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 331 | - errno = 0; | ||
| 332 | - event_uid = strtoul(optarg,NULL,10); | ||
| 333 | - if (errno) { | ||
| 334 | -@@ -1107,7 +1107,7 @@ int check_params(int count, char *vars[]) | ||
| 335 | - retval = -1; | ||
| 336 | - break; | ||
| 337 | - } | ||
| 338 | -- if (isdigit(optarg[0])) { | ||
| 339 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 340 | - errno = 0; | ||
| 341 | - event_euid = strtoul(optarg,NULL,10); | ||
| 342 | - if (errno) { | ||
| 343 | -@@ -1140,7 +1140,7 @@ int check_params(int count, char *vars[]) | ||
| 344 | - retval = -1; | ||
| 345 | - break; | ||
| 346 | - } | ||
| 347 | -- if (isdigit(optarg[0])) { | ||
| 348 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 349 | - errno = 0; | ||
| 350 | - event_uid = strtoul(optarg,NULL,10); | ||
| 351 | - if (errno) { | ||
| 352 | -@@ -1184,7 +1184,7 @@ int check_params(int count, char *vars[]) | ||
| 353 | - } | ||
| 354 | - { | ||
| 355 | - size_t len = strlen(optarg); | ||
| 356 | -- if (isdigit(optarg[0])) { | ||
| 357 | -+ if (isdigit((unsigned char)optarg[0])) { | ||
| 358 | - errno = 0; | ||
| 359 | - event_loginuid = strtoul(optarg,NULL,10); | ||
| 360 | - if (errno) { | ||
| 361 | -@@ -1194,7 +1194,7 @@ int check_params(int count, char *vars[]) | ||
| 362 | - retval = -1; | ||
| 363 | - } | ||
| 364 | - } else if (len >= 2 && *(optarg)=='-' && | ||
| 365 | -- (isdigit(optarg[1]))) { | ||
| 366 | -+ (isdigit((unsigned char)optarg[1]))) { | ||
| 367 | - errno = 0; | ||
| 368 | - event_loginuid = strtol(optarg, NULL, 0); | ||
| 369 | - if (errno) { | ||
| 370 | -diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c | ||
| 371 | -index e6868c6e..1a5b047f 100644 | ||
| 372 | ---- a/src/ausearch-parse.c | ||
| 373 | -+++ b/src/ausearch-parse.c | ||
| 374 | -@@ -1128,7 +1128,7 @@ try_again: | ||
| 375 | - return 25; | ||
| 376 | - ptr = str + 4; | ||
| 377 | - term = ptr; | ||
| 378 | -- while (isdigit(*term)) | ||
| 379 | -+ while (isdigit((unsigned char)*term)) | ||
| 380 | - term++; | ||
| 381 | - if (term == ptr) | ||
| 382 | - return 14; | ||
| 383 | -diff --git a/tools/ausyscall/ausyscall.c b/tools/ausyscall/ausyscall.c | ||
| 384 | -index bf751f17..489b1095 100644 | ||
| 385 | ---- a/tools/ausyscall/ausyscall.c | ||
| 386 | -+++ b/tools/ausyscall/ausyscall.c | ||
| 387 | -@@ -47,9 +47,9 @@ int main(int argc, char *argv[]) | ||
| 388 | - usage(); | ||
| 389 | - } else if (argc < 2) | ||
| 390 | - usage(); | ||
| 391 | -- | ||
| 392 | -+ | ||
| 393 | - for (i=1; i<argc; i++) { | ||
| 394 | -- if (isdigit(argv[i][0])) { | ||
| 395 | -+ if (isdigit((unsigned char)argv[i][0])) { | ||
| 396 | - if (syscall_num != -1) { | ||
| 397 | - fputs("Two syscall numbers not allowed\n", | ||
| 398 | - stderr); | ||
| 399 | --- | ||
| 400 | -2.33.0 | ||
| 401 | - | ||
| @@ -1,45 +0,0 @@ | |||
| 1 | -From 97f3c78b6b31126c1128927d9c85bb794a1efa17 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Fri, 15 Mar 2024 18:13:36 +0300 | ||
| 4 | -Subject: [PATCH] last part of NULL pointer checks | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/97f3c78b6b31126c1128927d9c85bb794a1efa17 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - auparse/interpret.c | 3 +++ | ||
| 11 | - src/ausearch-lookup.c | 4 ++++ | ||
| 12 | - 2 files changed, 7 insertions(+) | ||
| 13 | - | ||
| 14 | -diff --git a/auparse/interpret.c b/auparse/interpret.c | ||
| 15 | -index 12ae35e2..f6f39449 100644 | ||
| 16 | ---- a/auparse/interpret.c | ||
| 17 | -+++ b/auparse/interpret.c | ||
| 18 | -@@ -420,6 +420,9 @@ int load_interpretation_list(const char *buffer) | ||
| 19 | - il.cnt = 0; | ||
| 20 | - | ||
| 21 | - il.record = buf = strdup(buffer); | ||
| 22 | -+ if (buf == NULL) { | ||
| 23 | -+ goto err_out; | ||
| 24 | -+ } | ||
| 25 | - if (strncmp(buf, "SADDR=", 6) == 0) { | ||
| 26 | - // We have SOCKADDR record. It has no other values. | ||
| 27 | - // Handle it by itself. | ||
| 28 | -diff --git a/src/ausearch-lookup.c b/src/ausearch-lookup.c | ||
| 29 | -index bdcd7aaf..86239f39 100644 | ||
| 30 | ---- a/src/ausearch-lookup.c | ||
| 31 | -+++ b/src/ausearch-lookup.c | ||
| 32 | -@@ -302,6 +302,10 @@ char *unescape(const char *buf) | ||
| 33 | - return NULL; | ||
| 34 | - | ||
| 35 | - str = strndup(buf, ptr - buf); | ||
| 36 | -+ if (str == NULL) { | ||
| 37 | -+ fprintf(stderr, "Memory alocation error"); | ||
| 38 | -+ return NULL; | ||
| 39 | -+ } | ||
| 40 | - | ||
| 41 | - if (*buf == '(') | ||
| 42 | - return str; | ||
| 43 | --- | ||
| 44 | -2.33.0 | ||
| 45 | - | ||
| @@ -1,42 +0,0 @@ | |||
| 1 | -From f5c35d7d5e064af5ad31d22f900d148d932ad9b1 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: cgzones <cgzones@googlemail.com> | ||
| 3 | -Date: Mon, 15 Jan 2024 21:44:04 +0100 | ||
| 4 | -Subject: [PATCH] lib: avoid UB on sequence wrap-around (#347) | ||
| 5 | - | ||
| 6 | -Signed integer overflow is undefined, allowing compilers to optimize the | ||
| 7 | -condition `++sequence < 0` away. | ||
| 8 | - | ||
| 9 | -Reference:https://github.com/linux-audit/audit-userspace/commit/f5c35d7d5e064af5ad31d22f900d148d932ad9b1 | ||
| 10 | -Conflict:NA | ||
| 11 | - | ||
| 12 | ---- | ||
| 13 | - lib/netlink.c | 5 ++++- | ||
| 14 | - 1 file changed, 4 insertions(+), 1 deletion(-) | ||
| 15 | - | ||
| 16 | -diff --git a/lib/netlink.c b/lib/netlink.c | ||
| 17 | -index 3381651a..4a6bd54d 100644 | ||
| 18 | ---- a/lib/netlink.c | ||
| 19 | -+++ b/lib/netlink.c | ||
| 20 | -@@ -26,6 +26,7 @@ | ||
| 21 | - #include <string.h> | ||
| 22 | - #include <errno.h> | ||
| 23 | - #include <fcntl.h> | ||
| 24 | -+#include <limits.h> | ||
| 25 | - #include <time.h> | ||
| 26 | - #include <sys/poll.h> | ||
| 27 | - #include "libaudit.h" | ||
| 28 | -@@ -204,8 +205,10 @@ int __audit_send(int fd, int type, const void *data, unsigned int size, int *seq | ||
| 29 | - return -errno; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | -- if (++sequence < 0) | ||
| 33 | -+ if (sequence == INT_MAX) | ||
| 34 | - sequence = 1; | ||
| 35 | -+ else | ||
| 36 | -+ sequence++; | ||
| 37 | - *seq = sequence; | ||
| 38 | - | ||
| 39 | - memset(&req, 0, sizeof(req)); | ||
| 40 | --- | ||
| 41 | -2.33.0 | ||
| 42 | - | ||
| @@ -1,165 +0,0 @@ | |||
| 1 | -From 3aa3ccb2bb1c8804fbf43b260c93b65e831242c1 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: cgzones <cgzones@googlemail.com> | ||
| 3 | -Date: Thu, 2 Nov 2023 21:20:40 +0100 | ||
| 4 | -Subject: [PATCH] lib: cast to unsigned char for character test functions | ||
| 5 | - (#338) | ||
| 6 | - | ||
| 7 | -Passing a value not representable by unsigned char is undefined | ||
| 8 | -behavior. | ||
| 9 | - | ||
| 10 | -Reference:https://github.com/linux-audit/audit-userspace/commit/3aa3ccb2bb1c8804fbf43b260c93b65e831242c1 | ||
| 11 | -Conflict:NA | ||
| 12 | - | ||
| 13 | ---- | ||
| 14 | - lib/libaudit.c | 32 ++++++++++++++++---------------- | ||
| 15 | - lib/lookup_table.c | 2 +- | ||
| 16 | - 2 files changed, 17 insertions(+), 17 deletions(-) | ||
| 17 | - | ||
| 18 | -diff --git a/lib/libaudit.c b/lib/libaudit.c | ||
| 19 | -index 960525a..abcdf4a 100644 | ||
| 20 | ---- a/lib/libaudit.c | ||
| 21 | -+++ b/lib/libaudit.c | ||
| 22 | -@@ -1031,7 +1031,7 @@ int audit_rule_syscallbyname_data(struct audit_rule_data *rule, | ||
| 23 | - return -2; | ||
| 24 | - nr = audit_name_to_syscall(scall, machine); | ||
| 25 | - if (nr < 0) { | ||
| 26 | -- if (isdigit(scall[0])) | ||
| 27 | -+ if (isdigit((unsigned char)scall[0])) | ||
| 28 | - nr = strtol(scall, NULL, 0); | ||
| 29 | - } | ||
| 30 | - if (nr >= 0) | ||
| 31 | -@@ -1056,7 +1056,7 @@ int audit_rule_io_uringbyname_data(struct audit_rule_data *rule, | ||
| 32 | - } | ||
| 33 | - nr = audit_name_to_uringop(scall); | ||
| 34 | - if (nr < 0) { | ||
| 35 | -- if (isdigit(scall[0])) | ||
| 36 | -+ if (isdigit((unsigned char)scall[0])) | ||
| 37 | - nr = strtol(scall, NULL, 0); | ||
| 38 | - } | ||
| 39 | - if (nr >= 0) | ||
| 40 | -@@ -1585,11 +1585,11 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 41 | - case AUDIT_OBJ_UID: | ||
| 42 | - // Do positive & negative separate for 32 bit systems | ||
| 43 | - vlen = strlen(v); | ||
| 44 | -- if (isdigit((char)*(v))) | ||
| 45 | -+ if (isdigit((unsigned char)*(v))) | ||
| 46 | - rule->values[rule->field_count] = | ||
| 47 | - strtoul(v, NULL, 0); | ||
| 48 | - else if (vlen >= 2 && *(v)=='-' && | ||
| 49 | -- (isdigit((char)*(v+1)))) | ||
| 50 | -+ (isdigit((unsigned char)*(v+1)))) | ||
| 51 | - rule->values[rule->field_count] = | ||
| 52 | - strtol(v, NULL, 0); | ||
| 53 | - else { | ||
| 54 | -@@ -1609,7 +1609,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 55 | - case AUDIT_SGID: | ||
| 56 | - case AUDIT_FSGID: | ||
| 57 | - case AUDIT_OBJ_GID: | ||
| 58 | -- if (isdigit((char)*(v))) | ||
| 59 | -+ if (isdigit((unsigned char)*(v))) | ||
| 60 | - rule->values[rule->field_count] = | ||
| 61 | - strtol(v, NULL, 0); | ||
| 62 | - else { | ||
| 63 | -@@ -1625,11 +1625,11 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 64 | - if (flags != AUDIT_FILTER_EXIT) | ||
| 65 | - return -EAU_EXITONLY; | ||
| 66 | - vlen = strlen(v); | ||
| 67 | -- if (isdigit((char)*(v))) | ||
| 68 | -+ if (isdigit((unsigned char)*(v))) | ||
| 69 | - rule->values[rule->field_count] = | ||
| 70 | - strtol(v, NULL, 0); | ||
| 71 | - else if (vlen >= 2 && *(v)=='-' && | ||
| 72 | -- (isdigit((char)*(v+1)))) | ||
| 73 | -+ (isdigit((unsigned char)*(v+1)))) | ||
| 74 | - rule->values[rule->field_count] = | ||
| 75 | - strtol(v, NULL, 0); | ||
| 76 | - else { | ||
| 77 | -@@ -1644,7 +1644,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 78 | - flags != AUDIT_FILTER_USER) | ||
| 79 | - return -EAU_MSGTYPEEXCLUDEUSER; | ||
| 80 | - | ||
| 81 | -- if (isdigit((char)*(v))) | ||
| 82 | -+ if (isdigit((unsigned char)*(v))) | ||
| 83 | - rule->values[rule->field_count] = | ||
| 84 | - strtol(v, NULL, 0); | ||
| 85 | - else | ||
| 86 | -@@ -1715,7 +1715,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 87 | - return -EAU_ARCHMISPLACED; | ||
| 88 | - if (!(op == AUDIT_NOT_EQUAL || op == AUDIT_EQUAL)) | ||
| 89 | - return -EAU_OPEQNOTEQ; | ||
| 90 | -- if (isdigit((char)*(v))) { | ||
| 91 | -+ if (isdigit((unsigned char)*(v))) { | ||
| 92 | - int machine; | ||
| 93 | - | ||
| 94 | - errno = 0; | ||
| 95 | -@@ -1757,7 +1757,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 96 | - return -EAU_STRTOOLONG; | ||
| 97 | - | ||
| 98 | - for (i = 0; i < len; i++) { | ||
| 99 | -- switch (tolower(v[i])) { | ||
| 100 | -+ switch (tolower((unsigned char)v[i])) { | ||
| 101 | - case 'r': | ||
| 102 | - val |= AUDIT_PERM_READ; | ||
| 103 | - break; | ||
| 104 | -@@ -1791,7 +1791,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 105 | - return -EAU_FIELDUNAVAIL; | ||
| 106 | - if (!(op == AUDIT_NOT_EQUAL || op == AUDIT_EQUAL)) | ||
| 107 | - return -EAU_OPEQNOTEQ; | ||
| 108 | -- if (isdigit((char)*(v))) | ||
| 109 | -+ if (isdigit((unsigned char)*(v))) | ||
| 110 | - rule->values[rule->field_count] = | ||
| 111 | - strtoul(v, NULL, 0); | ||
| 112 | - else | ||
| 113 | -@@ -1804,11 +1804,11 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 114 | - break; | ||
| 115 | - case AUDIT_ARG0...AUDIT_ARG3: | ||
| 116 | - vlen = strlen(v); | ||
| 117 | -- if (isdigit((char)*(v))) | ||
| 118 | -+ if (isdigit((unsigned char)*(v))) | ||
| 119 | - rule->values[rule->field_count] = | ||
| 120 | - strtoul(v, NULL, 0); | ||
| 121 | - else if (vlen >= 2 && *(v)=='-' && | ||
| 122 | -- (isdigit((char)*(v+1)))) | ||
| 123 | -+ (isdigit((unsigned char)*(v+1)))) | ||
| 124 | - rule->values[rule->field_count] = | ||
| 125 | - strtol(v, NULL, 0); | ||
| 126 | - else | ||
| 127 | -@@ -1824,11 +1824,11 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 128 | - return -EAU_FIELDNOFILTER; | ||
| 129 | - // Do positive & negative separate for 32 bit systems | ||
| 130 | - vlen = strlen(v); | ||
| 131 | -- if (isdigit((char)*(v))) | ||
| 132 | -+ if (isdigit((unsigned char)*(v))) | ||
| 133 | - rule->values[rule->field_count] = | ||
| 134 | - strtoul(v, NULL, 0); | ||
| 135 | - else if (vlen >= 2 && *(v)=='-' && | ||
| 136 | -- (isdigit((char)*(v+1)))) | ||
| 137 | -+ (isdigit((unsigned char)*(v+1)))) | ||
| 138 | - rule->values[rule->field_count] = | ||
| 139 | - strtol(v, NULL, 0); | ||
| 140 | - else if (strcmp(v, "unset") == 0) | ||
| 141 | -@@ -1854,7 +1854,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair, | ||
| 142 | - if (field == AUDIT_PPID && !(flags==AUDIT_FILTER_EXIT)) | ||
| 143 | - return -EAU_EXITONLY; | ||
| 144 | - | ||
| 145 | -- if (!isdigit((char)*(v))) | ||
| 146 | -+ if (!isdigit((unsigned char)*(v))) | ||
| 147 | - return -EAU_FIELDVALNUM; | ||
| 148 | - | ||
| 149 | - if (field == AUDIT_INODE) | ||
| 150 | -diff --git a/lib/lookup_table.c b/lib/lookup_table.c | ||
| 151 | -index 2f5e6cd..d839205 100644 | ||
| 152 | ---- a/lib/lookup_table.c | ||
| 153 | -+++ b/lib/lookup_table.c | ||
| 154 | -@@ -255,7 +255,7 @@ int audit_name_to_msg_type(const char *msg_type) | ||
| 155 | - strncpy(buf, msg_type + 8, len); | ||
| 156 | - errno = 0; | ||
| 157 | - return strtol(buf, NULL, 10); | ||
| 158 | -- } else if (isdigit(*msg_type)) { | ||
| 159 | -+ } else if (isdigit((unsigned char)*msg_type)) { | ||
| 160 | - errno = 0; | ||
| 161 | - return strtol(msg_type, NULL, 10); | ||
| 162 | - } | ||
| 163 | --- | ||
| 164 | -2.33.0 | ||
| 165 | - | ||
| @@ -1,35 +0,0 @@ | |||
| 1 | -From 3f928b21486369c495d9eaca46eb9d506ae576b3 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: cgzones <cgzones@googlemail.com> | ||
| 3 | -Date: Wed, 1 Nov 2023 20:35:40 +0100 | ||
| 4 | -Subject: [PATCH] lib: close audit socket in load_feature_bitmap() (#334) | ||
| 5 | - | ||
| 6 | - | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/3f928b21486369c495d9eaca46eb9d506ae576b3 | ||
| 8 | -Conflict:NA | ||
| 9 | - | ||
| 10 | ---- | ||
| 11 | - lib/libaudit.c | 2 ++ | ||
| 12 | - 1 file changed, 2 insertions(+) | ||
| 13 | - | ||
| 14 | -diff --git a/lib/libaudit.c b/lib/libaudit.c | ||
| 15 | -index ded3ab47..4c317c87 100644 | ||
| 16 | ---- a/lib/libaudit.c | ||
| 17 | -+++ b/lib/libaudit.c | ||
| 18 | -@@ -657,12 +657,14 @@ static void load_feature_bitmap(void) | ||
| 19 | - | ||
| 20 | - /* Found it... */ | ||
| 21 | - features_bitmap = rep.status->feature_bitmap; | ||
| 22 | -+ audit_close(fd); | ||
| 23 | - return; | ||
| 24 | - } | ||
| 25 | - } | ||
| 26 | - } | ||
| 27 | - #endif | ||
| 28 | - features_bitmap = AUDIT_FEATURES_UNSUPPORTED; | ||
| 29 | -+ audit_close(fd); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - uint32_t audit_get_features(void) | ||
| 33 | --- | ||
| 34 | -2.33.0 | ||
| 35 | - | ||
| @@ -1,29 +0,0 @@ | |||
| 1 | -From e97c79260a2e7bdbf02c5162b0c40451c9555111 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> | ||
| 3 | -Date: Tue, 31 Oct 2023 16:49:10 +0100 | ||
| 4 | -Subject: [PATCH] lib: enclose macro to avoid precedence issues | ||
| 5 | - | ||
| 6 | - | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/e97c79260a2e7bdbf02c5162b0c40451c9555111 | ||
| 8 | -Conflict:NA | ||
| 9 | - | ||
| 10 | ---- | ||
| 11 | - lib/audit_logging.c | 2 +- | ||
| 12 | - 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 13 | - | ||
| 14 | -diff --git a/lib/audit_logging.c b/lib/audit_logging.c | ||
| 15 | -index 8b8b6207..e8b79d3e 100644 | ||
| 16 | ---- a/lib/audit_logging.c | ||
| 17 | -+++ b/lib/audit_logging.c | ||
| 18 | -@@ -38,7 +38,7 @@ | ||
| 19 | - #include "private.h" | ||
| 20 | - | ||
| 21 | - #define TTY_PATH 32 | ||
| 22 | --#define MAX_USER (UT_NAMESIZE * 2) + 8 | ||
| 23 | -+#define MAX_USER ((UT_NAMESIZE * 2) + 8) | ||
| 24 | - | ||
| 25 | - // NOTE: The kernel fills in pid, uid, and loginuid of sender. Therefore, | ||
| 26 | - // these routines do not need to send them. | ||
| 27 | --- | ||
| 28 | -2.33.0 | ||
| 29 | - | ||
| @@ -1,56 +0,0 @@ | |||
| 1 | -From b92027ac9e29659483a5e920e548fe74126f72af Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: cgzones <cgzones@googlemail.com> | ||
| 3 | -Date: Wed, 1 Nov 2023 22:15:40 +0100 | ||
| 4 | -Subject: [PATCH] memory allocation updates (#341) | ||
| 5 | - | ||
| 6 | -* Check memory allocation | ||
| 7 | - | ||
| 8 | -Avoid later NULL dereference. | ||
| 9 | - | ||
| 10 | -* Check memory allocation and merge zeroing | ||
| 11 | - | ||
| 12 | -Avoid later NULL dereference. | ||
| 13 | - | ||
| 14 | -Reference:https://github.com/linux-audit/audit-userspace/commit/b92027ac9e29659483a5e920e548fe74126f72af | ||
| 15 | -Conflict:NA | ||
| 16 | - | ||
| 17 | ---- | ||
| 18 | - auparse/interpret.c | 2 ++ | ||
| 19 | - lib/libaudit.c | 7 +++++-- | ||
| 20 | - 2 files changed, 7 insertions(+), 2 deletions(-) | ||
| 21 | - | ||
| 22 | -diff --git a/auparse/interpret.c b/auparse/interpret.c | ||
| 23 | -index ecde07ae..76ca2814 100644 | ||
| 24 | ---- a/auparse/interpret.c | ||
| 25 | -+++ b/auparse/interpret.c | ||
| 26 | -@@ -366,6 +366,8 @@ char *au_unescape(char *buf) | ||
| 27 | - // strlen(buf) / 2. | ||
| 28 | - olen = strlen(buf); | ||
| 29 | - str = malloc(olen+1); | ||
| 30 | -+ if (!str) | ||
| 31 | -+ return NULL; | ||
| 32 | - | ||
| 33 | - saved = *ptr; | ||
| 34 | - *ptr = 0; | ||
| 35 | -diff --git a/lib/libaudit.c b/lib/libaudit.c | ||
| 36 | -index 6a42871b..d90d83b8 100644 | ||
| 37 | ---- a/lib/libaudit.c | ||
| 38 | -+++ b/lib/libaudit.c | ||
| 39 | -@@ -891,9 +891,12 @@ int audit_make_equivalent(int fd, const char *mount_point, | ||
| 40 | - struct { | ||
| 41 | - uint32_t sizes[2]; | ||
| 42 | - unsigned char buf[]; | ||
| 43 | -- } *cmd = malloc(sizeof(*cmd) + len1 + len2); | ||
| 44 | -+ } *cmd = calloc(1, sizeof(*cmd) + len1 + len2); | ||
| 45 | - | ||
| 46 | -- memset(cmd, 0, sizeof(*cmd) + len1 + len2); | ||
| 47 | -+ if (!cmd) { | ||
| 48 | -+ audit_msg(LOG_ERR, "Cannot allocate memory!"); | ||
| 49 | -+ return -ENOMEM; | ||
| 50 | -+ } | ||
| 51 | - | ||
| 52 | - cmd->sizes[0] = len1; | ||
| 53 | - cmd->sizes[1] = len2; | ||
| 54 | --- | ||
| 55 | -2.33.0 | ||
| 56 | - | ||
| @@ -1,188 +0,0 @@ | |||
| 1 | -From 15d29a145ebe67cae52316871fcdedb5a19ce628 Mon Sep 17 00:00:00 2001 | ||
| 2 | -From: Yugend <jugendd@mail.ru> | ||
| 3 | -Date: Fri, 15 Mar 2024 18:00:54 +0300 | ||
| 4 | -Subject: [PATCH] second part of NULL pointer checks | ||
| 5 | - | ||
| 6 | -Conflict:NA | ||
| 7 | -Reference:https://github.com/linux-audit/audit-userspace/commit/15d29a145ebe67cae52316871fcdedb5a19ce628 | ||
| 8 | - | ||
| 9 | ---- | ||
| 10 | - audisp/plugins/zos-remote/zos-remote-queue.c | 5 +++++ | ||
| 11 | - audisp/queue.c | 5 +++++ | ||
| 12 | - auparse/normalize-llist.c | 3 +++ | ||
| 13 | - auparse/normalize.c | 9 +++++++++ | ||
| 14 | - lib/gen_tables.c | 10 ++++++++-- | ||
| 15 | - src/ausearch-lol.c | 12 ++++++++++++ | ||
| 16 | - src/ausearch-nvpair.c | 3 +++ | ||
| 17 | - src/ausearch-string.c | 3 +++ | ||
| 18 | - 8 files changed, 48 insertions(+), 2 deletions(-) | ||
| 19 | - | ||
| 20 | -diff --git a/audisp/plugins/zos-remote/zos-remote-queue.c b/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 21 | -index 37d91bd8..47dd006e 100644 | ||
| 22 | ---- a/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 23 | -+++ b/audisp/plugins/zos-remote/zos-remote-queue.c | ||
| 24 | -@@ -130,6 +130,11 @@ void increase_queue_depth(unsigned int size) | ||
| 25 | - void *tmp_q; | ||
| 26 | - | ||
| 27 | - tmp_q = realloc(q, size * sizeof(BerElement *)); | ||
| 28 | -+ if (tmp_q == NULL) { | ||
| 29 | -+ log_err("Memory allocation error");; | ||
| 30 | -+ pthread_mutex_unlock(&queue_lock); | ||
| 31 | -+ return; | ||
| 32 | -+ } | ||
| 33 | - q = tmp_q; | ||
| 34 | - for (i=q_depth; i<size; i++) | ||
| 35 | - q[i] = NULL; | ||
| 36 | -diff --git a/audisp/queue.c b/audisp/queue.c | ||
| 37 | -index 6898d09f..76b62593 100644 | ||
| 38 | ---- a/audisp/queue.c | ||
| 39 | -+++ b/audisp/queue.c | ||
| 40 | -@@ -229,6 +229,11 @@ void increase_queue_depth(unsigned int size) | ||
| 41 | - void *tmp_q; | ||
| 42 | - | ||
| 43 | - tmp_q = realloc(q, size * sizeof(event_t *)); | ||
| 44 | -+ if (tmp_q == NULL) { | ||
| 45 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 46 | -+ pthread_mutex_unlock(&queue_lock); | ||
| 47 | -+ return; | ||
| 48 | -+ } | ||
| 49 | - q = tmp_q; | ||
| 50 | - for (i=q_depth; i<size; i++) | ||
| 51 | - q[i] = NULL; | ||
| 52 | -diff --git a/auparse/normalize-llist.c b/auparse/normalize-llist.c | ||
| 53 | -index fd9d6cc8..32d5f124 100644 | ||
| 54 | ---- a/auparse/normalize-llist.c | ||
| 55 | -+++ b/auparse/normalize-llist.c | ||
| 56 | -@@ -66,6 +66,9 @@ void cllist_append(cllist *l, uint32_t num, void *data) | ||
| 57 | - data_node *newnode; | ||
| 58 | - | ||
| 59 | - newnode = malloc(sizeof(data_node)); | ||
| 60 | -+ if (newnode == NULL) { | ||
| 61 | -+ return; | ||
| 62 | -+ } | ||
| 63 | - | ||
| 64 | - newnode->num = num; | ||
| 65 | - newnode->data = data; | ||
| 66 | -diff --git a/auparse/normalize.c b/auparse/normalize.c | ||
| 67 | -index ae6e3d2d..58d28213 100644 | ||
| 68 | ---- a/auparse/normalize.c | ||
| 69 | -+++ b/auparse/normalize.c | ||
| 70 | -@@ -1191,6 +1191,11 @@ static int normalize_compound(auparse_state_t *au) | ||
| 71 | - if (f) { | ||
| 72 | - const char *exe = auparse_interpret_field(au); | ||
| 73 | - D.how = strdup(exe); | ||
| 74 | -+ if (D.how == NULL) { | ||
| 75 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 76 | -+ free((void *)syscall); | ||
| 77 | -+ return 1; | ||
| 78 | -+ } | ||
| 79 | - if ((strncmp(D.how, "/usr/bin/python", 15) == 0) || | ||
| 80 | - (strncmp(D.how, "/usr/bin/sh", 11) == 0) || | ||
| 81 | - (strncmp(D.how, "/usr/bin/bash", 13) == 0) || | ||
| 82 | -@@ -1999,6 +2004,10 @@ map: | ||
| 83 | - if (f) { | ||
| 84 | - const char *exe = auparse_interpret_field(au); | ||
| 85 | - D.how = strdup(exe); | ||
| 86 | -+ if (D.how == NULL) { | ||
| 87 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 88 | -+ return 1; | ||
| 89 | -+ } | ||
| 90 | - if ((strncmp(D.how, "/usr/bin/python", 15) == 0) || | ||
| 91 | - (strncmp(D.how, "/usr/bin/sh", 11) == 0) || | ||
| 92 | - (strncmp(D.how, "/usr/bin/bash", 13) == 0) || | ||
| 93 | -diff --git a/lib/gen_tables.c b/lib/gen_tables.c | ||
| 94 | -index 3326759d..4ff233d0 100644 | ||
| 95 | ---- a/lib/gen_tables.c | ||
| 96 | -+++ b/lib/gen_tables.c | ||
| 97 | -@@ -271,7 +271,10 @@ output_i2s(const char *prefix) | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - unique_values = malloc(NUM_VALUES * sizeof(*unique_values)); | ||
| 101 | -- assert(unique_values != NULL); | ||
| 102 | -+ if (unique_values == NULL) { | ||
| 103 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 104 | -+ abort(); | ||
| 105 | -+ } | ||
| 106 | - n = 0; | ||
| 107 | - for (i = 0; i < NUM_VALUES; i++) { | ||
| 108 | - if (n == 0 || unique_values[n - 1].val != values[i].val) { | ||
| 109 | -@@ -351,7 +354,10 @@ output_i2s_transtab(const char *prefix) | ||
| 110 | - printf("{%d,%zu},", values[i].val, values[i].s_offset); | ||
| 111 | - } | ||
| 112 | - uc_prefix = strdup(prefix); | ||
| 113 | -- assert(uc_prefix != NULL); | ||
| 114 | -+ if (uc_prefix == NULL) { | ||
| 115 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 116 | -+ abort(); | ||
| 117 | -+ } | ||
| 118 | - for (i = 0; uc_prefix[i] != '\0'; i++) | ||
| 119 | - uc_prefix[i] = toupper((unsigned char)uc_prefix[i]); | ||
| 120 | - printf("\n" | ||
| 121 | -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
| 122 | -index bcfb9ad8..c2140b7e 100644 | ||
| 123 | ---- a/src/ausearch-lol.c | ||
| 124 | -+++ b/src/ausearch-lol.c | ||
| 125 | -@@ -47,6 +47,10 @@ void lol_create(lol *lo) | ||
| 126 | - lo->maxi = -1; | ||
| 127 | - lo->limit = ARRAY_LIMIT; | ||
| 128 | - lo->array = (lolnode *)malloc(size); | ||
| 129 | -+ if (lo->array == NULL) { | ||
| 130 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 131 | -+ return; | ||
| 132 | -+ } | ||
| 133 | - memset(lo->array, 0, size); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | -@@ -305,6 +309,10 @@ int lol_add_record(lol *lo, char *buff) | ||
| 137 | - n.a1 = 0L; | ||
| 138 | - n.type = e.type; | ||
| 139 | - n.message = strdup(buff); | ||
| 140 | -+ if(n.message == NULL) { | ||
| 141 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 142 | -+ return 0; | ||
| 143 | -+ } | ||
| 144 | - ptr = strchr(n.message, AUDIT_INTERP_SEPARATOR); | ||
| 145 | - if (ptr) { | ||
| 146 | - n.mlen = ptr - n.message; | ||
| 147 | -@@ -359,6 +367,10 @@ int lol_add_record(lol *lo, char *buff) | ||
| 148 | - | ||
| 149 | - // Create new event and fill it in | ||
| 150 | - l = malloc(sizeof(llist)); | ||
| 151 | -+ if (l == NULL) { | ||
| 152 | -+ fprintf(stderr, "Memory allocation error"); | ||
| 153 | -+ return 0; | ||
| 154 | -+ } | ||
| 155 | - list_create(l); | ||
| 156 | - l->e.milli = e.milli; | ||
| 157 | - l->e.sec = e.sec; | ||
| 158 | -diff --git a/src/ausearch-nvpair.c b/src/ausearch-nvpair.c | ||
| 159 | -index 8d0088e5..c344c27c 100644 | ||
| 160 | ---- a/src/ausearch-nvpair.c | ||
| 161 | -+++ b/src/ausearch-nvpair.c | ||
| 162 | -@@ -37,6 +37,9 @@ void search_list_create(nvlist *l) | ||
| 163 | - void search_list_append(nvlist *l, nvnode *node) | ||
| 164 | - { | ||
| 165 | - nvnode* newnode = malloc(sizeof(nvnode)); | ||
| 166 | -+ if (newnode == NULL) { | ||
| 167 | -+ return; | ||
| 168 | -+ } | ||
| 169 | - | ||
| 170 | - newnode->name = node->name; | ||
| 171 | - newnode->val = node->val; | ||
| 172 | -diff --git a/src/ausearch-string.c b/src/ausearch-string.c | ||
| 173 | -index fbbacd77..f875bb2c 100644 | ||
| 174 | ---- a/src/ausearch-string.c | ||
| 175 | -+++ b/src/ausearch-string.c | ||
| 176 | -@@ -49,6 +49,9 @@ void slist_append(slist *l, const snode *node) | ||
| 177 | - snode* newnode; | ||
| 178 | - | ||
| 179 | - newnode = malloc(sizeof(snode)); | ||
| 180 | -+ if (newnode == NULL) { | ||
| 181 | -+ return; | ||
| 182 | -+ } | ||
| 183 | - | ||
| 184 | - if (node->str) | ||
| 185 | - newnode->str = node->str; | ||
| 186 | --- | ||
| 187 | -2.33.0 | ||
| 188 | - | ||