Skip to content

Commit

Permalink
feat: usec: add usec-audit-mac-patches.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
applyforprof authored and Zeno-sole committed Sep 5, 2024
1 parent 9adc4bd commit ad5660a
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
audit (1:3.1.2-2deepin1) unstable; urgency=medium

* add usec-audit-mac-patches.patch

-- Liang Bo <[email protected]> Wed, 04 Sep 2024 14:54:26 +0800

audit (1:3.1.2-2) unstable; urgency=medium

[ Chris Hofstaedtler ]
Expand Down
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
01-no-refusemanualstop.patch
02-restorecon-path.patch
03-Set-log_group-adm.patch
usec-audit-mac-patches.patch
72 changes: 72 additions & 0 deletions debian/patches/usec-audit-mac-patches.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
diff --git a/lib/audit_logging.c b/lib/audit_logging.c
index f89a13b..8e4c8bb 100644
--- a/lib/audit_logging.c
+++ b/lib/audit_logging.c
@@ -501,6 +501,30 @@ int audit_log_acct_message(int audit_fd, int type, const char *pgname,
tty ? tty : "?",
success
);
+ } else if (name) {
+ char user[MAX_USER];
+ const char *format;
+ size_t len;
+
+ user[0] = 0;
+ strncat(user, name, MAX_USER-1);
+ len = strnlen(user, UT_NAMESIZE);
+ user[len] = 0;
+ if (audit_value_needs_encoding(name, len)) {
+ audit_encode_value(user, name, len);
+ format =
+ "op=%s id=%u acct=%s exe=%s hostname=%s addr=%s terminal=%s res=%s";
+ } else
+ format =
+ "op=%s id=%u acct=\"%s\" exe=%s hostname=%s addr=%s terminal=%s res=%s";
+
+ snprintf(buf, sizeof(buf), format,
+ op, id, user, exename,
+ host ? host : "?",
+ addrbuf,
+ tty ? tty : "?",
+ success
+ );
} else
snprintf(buf, sizeof(buf),
"op=%s id=%u exe=%s hostname=%s addr=%s terminal=%s res=%s",
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 179debd..bc57493 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -1461,6 +1461,7 @@ int audit_determine_machine(const char *arch)
case MACH_PPC64: /* fallthrough */
case MACH_S390X: /* fallthrough */
case MACH_IO_URING:
+ case MACH_SUNWAY: /* fallthrough */
break;
case MACH_PPC64LE: /* 64 bit only */
if (bits && bits != __AUDIT_ARCH_64BIT)
diff --git a/lib/libaudit.h b/lib/libaudit.h
index f623f63..b344201 100644
--- a/lib/libaudit.h
+++ b/lib/libaudit.h
@@ -594,6 +594,7 @@ typedef enum {
MACH_S390X,
MACH_S390,
MACH_ALPHA, // Deprecated but has to stay
+ MACH_SUNWAY,
MACH_ARM,
MACH_AARCH64,
MACH_PPC64LE,
diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c
index f9aad63..b1d741c 100644
--- a/src/ausearch-parse.c
+++ b/src/ausearch-parse.c
@@ -722,7 +722,7 @@ static int common_path_parser(search_items *s, char *path)
sn.key = NULL;
sn.hits = 1;
// Attempt to rebuild path if relative
- if ((sn.str[0] == '.') && ((sn.str[1] == '.') ||
+ if (sn.str && (sn.str[0] == '.') && ((sn.str[1] == '.') ||
(sn.str[1] == '/')) && s->cwd) {
char *tmp = malloc(PATH_MAX);
if (tmp == NULL) {

0 comments on commit ad5660a

Please sign in to comment.