diff --git a/debian/changelog b/debian/changelog index 62d9d12..3e54bf8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +audit (1:3.1.2-2deepin1) unstable; urgency=medium + + * add usec-audit-mac-patches.patch + + -- Liang Bo Wed, 04 Sep 2024 14:54:26 +0800 + audit (1:3.1.2-2) unstable; urgency=medium [ Chris Hofstaedtler ] diff --git a/debian/patches/series b/debian/patches/series index 2c3bfe8..4497be0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 01-no-refusemanualstop.patch 02-restorecon-path.patch 03-Set-log_group-adm.patch +usec-audit-mac-patches.patch diff --git a/debian/patches/usec-audit-mac-patches.patch b/debian/patches/usec-audit-mac-patches.patch new file mode 100644 index 0000000..ffe7d84 --- /dev/null +++ b/debian/patches/usec-audit-mac-patches.patch @@ -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) {