From 89ac4084ff2da817f0702310da59978dfdc52ab6 Mon Sep 17 00:00:00 2001 From: jchzhou Date: Tue, 26 Aug 2025 12:07:42 +0800 Subject: [PATCH] backport patches for fixing Wimplicit-function-declaration, Wbuiltin-declaration-mismatch when building with newer compilers (cherry picked from commit bbdf9e5acaaa586c6078cb1fae9d30525cd33c44) --- audit.spec | 11 +- backport-Implicit-builtin-functions.patch | 654 +++++++++ ...stification-deadcode-removal-lower-s.patch | 1196 +++++++++++++++++ ...rt-make-slist_last-a-static-function.patch | 58 + 4 files changed, 1918 insertions(+), 1 deletion(-) create mode 100644 backport-Implicit-builtin-functions.patch create mode 100644 backport-code-cleanup-constification-deadcode-removal-lower-s.patch create mode 100644 backport-make-slist_last-a-static-function.patch diff --git a/audit.spec b/audit.spec index cf7ae27..8a286e4 100644 --- a/audit.spec +++ b/audit.spec @@ -2,7 +2,7 @@ Summary: User space tools for kernel auditing Name: audit Epoch: 1 Version: 3.1.2 -Release: 11 +Release: 12 License: GPLv2+ and LGPLv2+ URL: https://people.redhat.com/sgrubb/audit/ Source0: https://people.redhat.com/sgrubb/audit/%{name}-%{version}.tar.gz @@ -59,6 +59,12 @@ Patch47: backport-Update-_get_hostname-436.patch Patch48: backport-If-we-are-checkpointing-decide-if-we-output-this-eve.patch Patch49: backport-Fix-filename-lookup-for-AUSOURCE_FILE_POINTER-in-aup.patch Patch50: backport-add-some-error-checking-around-timer-services.patch +# https://github.com/linux-audit/audit-userspace/commit/b6d376d9f6a5593e7d8029fca1094f16d724bfe7 +Patch51: backport-make-slist_last-a-static-function.patch +# https://github.com/linux-audit/audit-userspace/commit/0ed54fc841e4deeeb07ece3ec5933320623ad209 +Patch52: backport-code-cleanup-constification-deadcode-removal-lower-s.patch +# https://github.com/linux-audit/audit-userspace/commit/8c7eaa7ead6c70486623674c19d649f3831578ad +Patch53: backport-Implicit-builtin-functions.patch BuildRequires: gcc swig libtool systemd kernel-headers >= 2.6.29 BuildRequires: openldap-devel krb5-devel libcap-ng-devel @@ -400,6 +406,9 @@ fi %attr(644,root,root) %{_mandir}/man8/*.8.gz %changelog +* Tue Aug 26 2025 jchzhou - 1:3.1.2-12 +- backport patches for fixing Wimplicit-function-declaration, Wbuiltin-declaration-mismatch when building with newer compilers + * Tue Aug 19 2025 yanglongkang - 1:3.1.2-11 - backport patches to fix bugs diff --git a/backport-Implicit-builtin-functions.patch b/backport-Implicit-builtin-functions.patch new file mode 100644 index 0000000..8f091ef --- /dev/null +++ b/backport-Implicit-builtin-functions.patch @@ -0,0 +1,654 @@ +From 8c7eaa7ead6c70486623674c19d649f3831578ad Mon Sep 17 00:00:00 2001 +From: Steve Grubb +Date: Fri, 3 May 2024 17:33:39 -0400 +Subject: [PATCH] Implicit builtin functions + +Correct a number of places where printf is being used without a prototype. +All cases are in libraries which should not be using printf. Change them +to return an error rather than communicate the problem. +--- + audisp/audispd-llist.c | 10 +++++----- + audisp/audispd-llist.h | 4 ++-- + auparse/normalize-llist.c | 12 ++++++------ + auparse/normalize-llist.h | 4 ++-- + auparse/normalize.c | 14 +++++++++----- + src/auditctl-llist.c | 18 +++++++++--------- + src/auditctl-llist.h | 4 ++-- + src/ausearch-avc.c | 16 ++++++++-------- + src/ausearch-avc.h | 4 ++-- + src/ausearch-int.c | 12 ++++++------ + src/ausearch-int.h | 4 ++-- + src/ausearch-llist.c | 14 +++++++------- + src/ausearch-llist.h | 2 +- + src/ausearch-nvpair.c | 12 ++++++------ + src/ausearch-nvpair.h | 4 ++-- + src/ausearch-string.c | 10 +++++----- + src/ausearch-string.h | 2 +- + tools/aulastlog/aulastlog-llist.c | 18 +++++++++--------- + tools/aulastlog/aulastlog-llist.h | 4 ++-- + 19 files changed, 86 insertions(+), 82 deletions(-) + +diff --git a/audisp/audispd-llist.c b/audisp/audispd-llist.c +index 30d7f03..15ec038 100644 +--- a/audisp/audispd-llist.c ++++ b/audisp/audispd-llist.c +@@ -69,15 +69,13 @@ unsigned int plist_count_active(const conf_llist *l) + return cnt; + } + +-void plist_append(conf_llist *l, plugin_conf_t *p) ++int plist_append(conf_llist *l, plugin_conf_t *p) + { + lnode* newnode; + + newnode = malloc(sizeof(lnode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + if (p) { + void *pp = malloc(sizeof(struct plugin_conf)); +@@ -98,6 +96,8 @@ void plist_append(conf_llist *l, plugin_conf_t *p) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + void plist_clear(conf_llist* l) +diff --git a/audisp/audispd-llist.h b/audisp/audispd-llist.h +index 7c5279b..fb30f12 100644 +--- a/audisp/audispd-llist.h ++++ b/audisp/audispd-llist.h +@@ -1,6 +1,6 @@ + /* + * audispd-llist.h - Header file for ausearch-conf_llist.c +-* Copyright (c) 2007,2013 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2007,2013 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -51,7 +51,7 @@ unsigned int plist_count_active(const conf_llist *l); + void plist_last(conf_llist *l); + lnode *plist_next(conf_llist *l); + static inline lnode *plist_get_cur(conf_llist *l) { return l->cur; } +-void plist_append(conf_llist *l, plugin_conf_t *p); ++int plist_append(conf_llist *l, plugin_conf_t *p); + void plist_clear(conf_llist* l); + void plist_mark_all_unchecked(conf_llist* l); + lnode *plist_find_unchecked(conf_llist* l); +diff --git a/auparse/normalize-llist.c b/auparse/normalize-llist.c +index 253c5e5..18e901e 100644 +--- a/auparse/normalize-llist.c ++++ b/auparse/normalize-llist.c +@@ -1,6 +1,6 @@ + /* + * normalize-llist.c - Minimal linked list library +- * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina. ++ * Copyright (c) 2016-17 Red Hat Inc. + * All Rights Reserved. + * + * This library is free software; you can redistribute it and/or +@@ -63,15 +63,14 @@ data_node *cllist_next(cllist *l) + return l->cur; + } + +-void cllist_append(cllist *l, uint32_t num, void *data) ++// Returns 0 on success and 1 on error ++int cllist_append(cllist *l, uint32_t num, void *data) + { + data_node *newnode; + + newnode = malloc(sizeof(data_node)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + newnode->num = num; + newnode->data = data; +@@ -87,5 +86,6 @@ void cllist_append(cllist *l, uint32_t num, void *data) + l->tail = newnode; + l->cur = newnode; + l->cnt++; ++ return 0; + } + +diff --git a/auparse/normalize-llist.h b/auparse/normalize-llist.h +index 6e3a8d5..24caafc 100644 +--- a/auparse/normalize-llist.h ++++ b/auparse/normalize-llist.h +@@ -1,6 +1,6 @@ + /* + * normalize-llist.h - Header file for normalize-llist.c +- * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina. ++ * Copyright (c) 2016-17 Red Hat Inc. + * All Rights Reserved. + * + * This library is free software; you can redistribute it and/or +@@ -54,7 +54,7 @@ AUDIT_HIDDEN_START + void cllist_create(cllist *l, void (*cleanup)(void *)); + void cllist_clear(cllist* l); + data_node *cllist_next(cllist *l); +-void cllist_append(cllist *l, uint32_t num, void *data); ++int cllist_append(cllist *l, uint32_t num, void *data); + + AUDIT_HIDDEN_END + +diff --git a/auparse/normalize.c b/auparse/normalize.c +index c68dba4..038328d 100644 +--- a/auparse/normalize.c ++++ b/auparse/normalize.c +@@ -179,7 +179,8 @@ static unsigned int add_subj_attr(auparse_state_t *au, const char *str, + if ((auparse_find_field(au, str))) { + attr = set_record(0, rnum); + attr = set_field(attr, auparse_get_field_num(au)); +- cllist_append(&D.actor.attr, attr, NULL); ++ if (cllist_append(&D.actor.attr, attr, NULL)) ++ return 1; + return 0; + } else + auparse_goto_record_num(au, rnum); +@@ -224,7 +225,8 @@ static unsigned int add_obj_attr(auparse_state_t *au, const char *str, + if ((auparse_find_field(au, str))) { + attr = set_record(0, rnum); + attr = set_field(attr, auparse_get_field_num(au)); +- cllist_append(&D.thing.attr, attr, NULL); ++ if (cllist_append(&D.thing.attr, attr, NULL)) ++ return 1; + return 0; + } else + auparse_goto_record_num(au, rnum); +@@ -360,21 +362,23 @@ static void collect_id_obj2(auparse_state_t *au, const char *syscall) + } + } + +-static void collect_path_attrs(auparse_state_t *au) ++static int collect_path_attrs(auparse_state_t *au) + { + value_t attr; + unsigned int rnum = auparse_get_record_num(au); + + auparse_first_field(au); + if (add_obj_attr(au, "mode", rnum)) +- return; // Failed opens don't have anything else ++ return 1; // Failed opens don't have anything else + + // All the rest of the fields matter + while ((auparse_next_field(au))) { + attr = set_record(0, rnum); + attr = set_field(attr, auparse_get_field_num(au)); +- cllist_append(&D.thing.attr, attr, NULL); ++ if (cllist_append(&D.thing.attr, attr, NULL)) ++ return 1; + } ++ return 0; + } + + static void collect_cwd_attrs(auparse_state_t *au) +diff --git a/src/auditctl-llist.c b/src/auditctl-llist.c +index 5282ee3..de5c38d 100644 +--- a/src/auditctl-llist.c ++++ b/src/auditctl-llist.c +@@ -1,7 +1,7 @@ + /* + * ausearch-llist.c - Minimal linked list library +-* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina. +-* All Rights Reserved. ++* Copyright (c) 2005 Red Hat Inc. ++* All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the + * terms of the GNU General Public License as published by the Free +@@ -15,7 +15,7 @@ + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to the +-* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor ++* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1335, USA. + * + * Authors: +@@ -59,19 +59,17 @@ lnode *list_next(llist *l) + return l->cur; + } + +-void list_append(llist *l, const struct audit_rule_data *r, size_t sz) ++int list_append(llist *l, const struct audit_rule_data *r, size_t sz) + { + lnode* newnode; + + newnode = malloc(sizeof(lnode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + if (r) { + void *rr = malloc(sz); +- if (rr) ++ if (rr) + memcpy(rr, r, sz); + newnode->r = rr; + } else +@@ -89,6 +87,8 @@ void list_append(llist *l, const struct audit_rule_data *r, size_t sz) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + void list_clear(llist* l) +diff --git a/src/auditctl-llist.h b/src/auditctl-llist.h +index c8f60df..55456a1 100644 +--- a/src/auditctl-llist.h ++++ b/src/auditctl-llist.h +@@ -1,6 +1,6 @@ + /* + * auditctl-llist.h - Header file for ausearch-llist.c +-* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -50,7 +50,7 @@ void list_first(llist *l); + void list_last(llist *l); + lnode *list_next(llist *l); + static inline lnode *list_get_cur(const llist *l) { return l->cur; } +-void list_append(llist *l, const struct audit_rule_data *r, size_t sz); ++int list_append(llist *l, const struct audit_rule_data *r, size_t sz); + void list_clear(llist* l); + + #endif +diff --git a/src/ausearch-avc.c b/src/ausearch-avc.c +index 3857656..36d9832 100644 +--- a/src/ausearch-avc.c ++++ b/src/ausearch-avc.c +@@ -1,7 +1,7 @@ + /* + * ausearch-avc.c - Minimal linked list library for avcs +-* Copyright (c) 2006,2008,2014 Red Hat Inc., Durham, North Carolina. +-* All Rights Reserved. ++* Copyright (c) 2006,2008,2014 Red Hat Inc. ++* All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the + * terms of the GNU General Public License as published by the Free +@@ -15,7 +15,7 @@ + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to the +-* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor ++* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1335, USA. + * + * Authors: +@@ -62,15 +62,13 @@ static void alist_last(alist *l) + l->cur = cur; + } + +-void alist_append(alist *l, anode *node) ++int alist_append(alist *l, anode *node) + { + anode* newnode; + + newnode = malloc(sizeof(anode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + if (node->scontext) + newnode->scontext = node->scontext; +@@ -108,6 +106,8 @@ void alist_append(alist *l, anode *node) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + int alist_find_subj(alist *l) +diff --git a/src/ausearch-avc.h b/src/ausearch-avc.h +index 3796ed4..59a7174 100644 +--- a/src/ausearch-avc.h ++++ b/src/ausearch-avc.h +@@ -1,6 +1,6 @@ + /* + * ausearch-avc.h - Header file for ausearch-string.c +-* Copyright (c) 2006,2008 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2006,2008 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -54,7 +54,7 @@ void alist_create(alist *l); + static inline void alist_first(alist *l) { l->cur = l->head; } + anode *alist_next(alist *l); + static inline anode *alist_get_cur(const alist *l) { return l->cur; } +-void alist_append(alist *l, anode *node); ++int alist_append(alist *l, anode *node); + void anode_init(anode *an); + void anode_clear(anode *an); + void alist_clear(alist* l); +diff --git a/src/ausearch-int.c b/src/ausearch-int.c +index 5f57b05..d2288bf 100644 +--- a/src/ausearch-int.c ++++ b/src/ausearch-int.c +@@ -1,6 +1,6 @@ + /* + * ausearch-int.c - Minimal linked list library for integers +-* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005,2008 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -41,15 +41,13 @@ int_node *ilist_next(ilist *l) + return l->cur; + } + +-void ilist_append(ilist *l, int num, unsigned int hits, int aux) ++int ilist_append(ilist *l, int num, unsigned int hits, int aux) + { + int_node* newnode; + + newnode = malloc(sizeof(int_node)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + newnode->num = num; + newnode->hits = hits; +@@ -65,6 +63,8 @@ void ilist_append(ilist *l, int num, unsigned int hits, int aux) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + void ilist_clear(ilist* l) +diff --git a/src/ausearch-int.h b/src/ausearch-int.h +index d7fc740..31fc5d6 100644 +--- a/src/ausearch-int.h ++++ b/src/ausearch-int.h +@@ -1,6 +1,6 @@ + /* + * ausearch-int.h - Header file for ausearch-int.c +-* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005,2008 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -48,7 +48,7 @@ void ilist_create(ilist *l); + static inline void ilist_first(ilist *l) { l->cur = l->head; } + int_node *ilist_next(ilist *l); + static inline int_node *ilist_get_cur(const ilist *l) { return l->cur; } +-void ilist_append(ilist *l, int num, unsigned int hits, int aux); ++int ilist_append(ilist *l, int num, unsigned int hits, int aux); + void ilist_clear(ilist* l); + + /* append a number if its not already on the list */ +diff --git a/src/ausearch-llist.c b/src/ausearch-llist.c +index 7926980..ec04904 100644 +--- a/src/ausearch-llist.c ++++ b/src/ausearch-llist.c +@@ -1,6 +1,6 @@ + /* + * ausearch-llist.c - Minimal linked list library +-* Copyright (c) 2005-2008,2011,2016 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005-2008,2011,2016 Red Hat Inc. + * Copyright (c) 2011 IBM Corp. + * All Rights Reserved. + * +@@ -102,15 +102,13 @@ lnode *list_prev(llist *l) + return l->cur; + } + +-void list_append(llist *l, lnode *node) ++int list_append(llist *l, lnode *node) + { + lnode* newnode; + + newnode = malloc(sizeof(lnode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + if (node->message) + newnode->message = node->message; +@@ -123,7 +121,7 @@ void list_append(llist *l, lnode *node) + newnode->type = node->type; + newnode->a0 = node->a0; + newnode->a1 = node->a1; +- newnode->item = l->cnt; ++ newnode->item = l->cnt; + newnode->next = NULL; + + // if we are at top, fix this up +@@ -135,6 +133,8 @@ void list_append(llist *l, lnode *node) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + int list_find_item(llist *l, unsigned int i) +diff --git a/src/ausearch-llist.h b/src/ausearch-llist.h +index 13ae2a0..338b7cd 100644 +--- a/src/ausearch-llist.h ++++ b/src/ausearch-llist.h +@@ -107,7 +107,7 @@ void list_last(llist *l); + lnode *list_next(llist *l); + lnode *list_prev(llist *l); + static inline lnode *list_get_cur(llist *l) { return l->cur; } +-void list_append(llist *l, lnode *node); ++int list_append(llist *l, lnode *node); + void list_clear(llist* l); + int list_get_event(llist* l, event *e); + +diff --git a/src/ausearch-nvpair.c b/src/ausearch-nvpair.c +index 3a1b27d..817c97e 100644 +--- a/src/ausearch-nvpair.c ++++ b/src/ausearch-nvpair.c +@@ -1,6 +1,6 @@ + /* + * ausearch-nvpair.c - Minimal linked list library for name-value pairs +-* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2006-08 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -34,13 +34,11 @@ void search_list_create(nvlist *l) + l->cnt = 0; + } + +-void search_list_append(nvlist *l, nvnode *node) ++int search_list_append(nvlist *l, nvnode *node) + { + nvnode* newnode = malloc(sizeof(nvnode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + newnode->name = node->name; + newnode->val = node->val; +@@ -58,6 +56,8 @@ void search_list_append(nvlist *l, nvnode *node) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + int search_list_find_val(nvlist *l, long val) +diff --git a/src/ausearch-nvpair.h b/src/ausearch-nvpair.h +index 244dca7..19749e3 100644 +--- a/src/ausearch-nvpair.h ++++ b/src/ausearch-nvpair.h +@@ -1,6 +1,6 @@ + /* + * ausearch-nvpair.h - Header file for ausearch-nvpair.c +-* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2006-08 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -46,7 +46,7 @@ typedef struct { + + void search_list_create(nvlist *l); + static inline nvnode *search_list_get_cur(nvlist *l) { return l->cur; } +-void search_list_append(nvlist *l, nvnode *node); ++int search_list_append(nvlist *l, nvnode *node); + void search_list_clear(nvlist* l); + + /* Given a numeric index, find that record. */ +diff --git a/src/ausearch-string.c b/src/ausearch-string.c +index 86b8a78..abddc04 100644 +--- a/src/ausearch-string.c ++++ b/src/ausearch-string.c +@@ -61,15 +61,13 @@ snode *slist_next(slist *l) + return l->cur; + } + +-void slist_append(slist *l, const snode *node) ++int slist_append(slist *l, const snode *node) + { + snode* newnode; + + newnode = malloc(sizeof(snode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + if (node->str) + newnode->str = node->str; +@@ -96,6 +94,8 @@ void slist_append(slist *l, const snode *node) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + void slist_clear(slist* l) +diff --git a/src/ausearch-string.h b/src/ausearch-string.h +index ed4a05b..99fe31b 100644 +--- a/src/ausearch-string.h ++++ b/src/ausearch-string.h +@@ -48,7 +48,7 @@ void slist_create(slist *l); + static inline void slist_first(slist *l) { l->cur = l->head; } + snode *slist_next(slist *l); + static inline snode *slist_get_cur(const slist *l) { return l->cur; } +-void slist_append(slist *l, const snode *node); ++int slist_append(slist *l, const snode *node); + void slist_clear(slist* l); + + /* append a string if its not already on the list */ +diff --git a/tools/aulastlog/aulastlog-llist.c b/tools/aulastlog/aulastlog-llist.c +index 0b89be6..2a8aa14 100644 +--- a/tools/aulastlog/aulastlog-llist.c ++++ b/tools/aulastlog/aulastlog-llist.c +@@ -1,7 +1,7 @@ + /* + * aulastlog-llist.c - Minimal linked list library +-* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina. +-* All Rights Reserved. ++* Copyright (c) 2008 Red Hat Inc.. ++* All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the + * terms of the GNU General Public License as published by the Free +@@ -15,7 +15,7 @@ + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to the +-* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor ++* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1335, USA. + * + * Authors: +@@ -41,15 +41,13 @@ lnode *list_next(llist *l) + return l->cur; + } + +-void list_append(llist *l, lnode *node) ++int list_append(llist *l, lnode *node) + { + lnode* newnode; + + newnode = malloc(sizeof(lnode)); +- if (newnode == NULL) { +- printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__); +- return; +- } ++ if (newnode == NULL) ++ return 1; + + newnode->sec = node->sec; + newnode->uid = node->uid; +@@ -62,7 +60,7 @@ void list_append(llist *l, lnode *node) + newnode->term = strdup(node->term); + else + newnode->term = NULL; +- newnode->item = l->cnt; ++ newnode->item = l->cnt; + newnode->next = NULL; + + // if we are at top, fix this up +@@ -74,6 +72,8 @@ void list_append(llist *l, lnode *node) + // make newnode current + l->cur = newnode; + l->cnt++; ++ ++ return 0; + } + + void list_clear(llist* l) +diff --git a/tools/aulastlog/aulastlog-llist.h b/tools/aulastlog/aulastlog-llist.h +index 1b43a7f..79e23b4 100644 +--- a/tools/aulastlog/aulastlog-llist.h ++++ b/tools/aulastlog/aulastlog-llist.h +@@ -1,6 +1,6 @@ + /* + * aulastlog-llist.h - Header file for aulastlog-llist.c +-* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2008 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -53,7 +53,7 @@ static inline void list_first(llist *l) { l->cur = l->head; } + lnode *list_next(llist *l); + static inline lnode *list_get_cur(llist *l) { return l->cur; } + static inline unsigned int list_get_cnt(llist *l) { return l->cnt; } +-void list_append(llist *l, lnode *node); ++int list_append(llist *l, lnode *node); + void list_clear(llist* l); + int list_update_login(llist* l, time_t t); + int list_update_host(llist* l, const char *h); +-- +2.50.1 + diff --git a/backport-code-cleanup-constification-deadcode-removal-lower-s.patch b/backport-code-cleanup-constification-deadcode-removal-lower-s.patch new file mode 100644 index 0000000..c3c7def --- /dev/null +++ b/backport-code-cleanup-constification-deadcode-removal-lower-s.patch @@ -0,0 +1,1196 @@ +From 0ed54fc841e4deeeb07ece3ec5933320623ad209 Mon Sep 17 00:00:00 2001 +From: Steve Grubb +Date: Sat, 4 Nov 2023 15:46:35 -0400 +Subject: [PATCH] code cleanup - constification, deadcode removal, lower scopes + +--- + src/auditctl-listing.c | 2 +- + src/auditctl-listing.h | 2 +- + src/auditctl-llist.c | 2 +- + src/auditctl-llist.h | 4 +- + src/auditctl.c | 12 +-- + src/auditd-config.c | 199 +++++++++++++++++++---------------------- + src/auditd-config.h | 4 - + src/auditd-dispatch.h | 1 - + src/auditd-event.c | 5 +- + src/auditd-event.h | 5 +- + src/auditd-listen.c | 11 ++- + src/auditd-listen.h | 2 +- + src/auditd-reconfig.c | 5 -- + src/aureport-options.c | 4 +- + src/aureport-options.h | 2 - + src/aureport-scan.c | 4 +- + src/ausearch-avc.h | 2 +- + src/ausearch-int.h | 2 +- + src/ausearch-lol.h | 1 - + src/ausearch-lookup.c | 6 +- + src/ausearch-lookup.h | 1 - + src/ausearch-nvpair.c | 8 -- + src/ausearch-nvpair.h | 2 - + src/ausearch-options.c | 2 +- + src/ausearch-parse.c | 2 +- + src/ausearch-string.c | 2 +- + src/ausearch-string.h | 4 +- + src/ausearch-time.c | 2 +- + 28 files changed, 131 insertions(+), 167 deletions(-) + +diff --git a/src/auditctl-listing.c b/src/auditctl-listing.c +index d9a3da2..9c32267 100644 +--- a/src/auditctl-listing.c ++++ b/src/auditctl-listing.c +@@ -562,7 +562,7 @@ static const char *get_failure(unsigned f) + * 0 if no more should be read and 1 to indicate that more messages of this + * type may need to be read. + */ +-int audit_print_reply(struct audit_reply *rep, int fd) ++int audit_print_reply(const struct audit_reply *rep, int fd) + { + _audit_elf = 0; + +diff --git a/src/auditctl-listing.h b/src/auditctl-listing.h +index 9bc28f0..f8b77db 100644 +--- a/src/auditctl-listing.h ++++ b/src/auditctl-listing.h +@@ -29,7 +29,7 @@ + #include "libaudit.h" + + void audit_print_init(void); +-int audit_print_reply(struct audit_reply *rep, int fd); ++int audit_print_reply(const struct audit_reply *rep, int fd); + int key_match(const struct audit_rule_data *r); + + #endif +diff --git a/src/auditctl-llist.c b/src/auditctl-llist.c +index 481502d..5282ee3 100644 +--- a/src/auditctl-llist.c ++++ b/src/auditctl-llist.c +@@ -59,7 +59,7 @@ lnode *list_next(llist *l) + return l->cur; + } + +-void list_append(llist *l, struct audit_rule_data *r, size_t sz) ++void list_append(llist *l, const struct audit_rule_data *r, size_t sz) + { + lnode* newnode; + +diff --git a/src/auditctl-llist.h b/src/auditctl-llist.h +index 630be08..c8f60df 100644 +--- a/src/auditctl-llist.h ++++ b/src/auditctl-llist.h +@@ -49,8 +49,8 @@ void list_create(llist *l); + void list_first(llist *l); + void list_last(llist *l); + lnode *list_next(llist *l); +-static inline lnode *list_get_cur(llist *l) { return l->cur; } +-void list_append(llist *l, struct audit_rule_data *r, size_t sz); ++static inline lnode *list_get_cur(const llist *l) { return l->cur; } ++void list_append(llist *l, const struct audit_rule_data *r, size_t sz); + void list_clear(llist* l); + + #endif +diff --git a/src/auditctl.c b/src/auditctl.c +index 74fd714..088e64e 100644 +--- a/src/auditctl.c ++++ b/src/auditctl.c +@@ -295,7 +295,7 @@ static int audit_setup_watch_name(struct audit_rule_data **rulep, char *path) + * Setup a watch permissions. + * Returns a 1 on success & -1 on failure. + */ +-static int audit_setup_perms(struct audit_rule_data *rule, const char *opt) ++static int audit_setup_perms(const char *opt) + { + unsigned int i, len, val = 0; + +@@ -543,10 +543,10 @@ static int parse_syscall(const char *optarg) + static int parse_io_uring(const char *optarg) + { + if (strchr(optarg, ',')) { +- int retval; ++ int retval = -1; + char *saved, *ptr, *tmp = strdup(optarg); + if (tmp == NULL) +- return -1; ++ return retval; + ptr = strtok_r(tmp, ",", &saved); + while (ptr) { + retval = audit_rule_io_uringbyname_data(rule_new, ptr); +@@ -561,7 +561,7 @@ static int parse_io_uring(const char *optarg) + } + #endif + +-static struct option long_opts[] = ++static const struct option long_opts[] = + { + #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1 + {"loginuid-immutable", 0, NULL, 1}, +@@ -1071,7 +1071,7 @@ process_keys: + audit_msg(LOG_ERR, "permission option needs a filter"); + retval = -1; + } else +- retval = audit_setup_perms(rule_new, optarg); ++ retval = audit_setup_perms(optarg); + break; + case 'q': + if (_audit_syscalladded) { +@@ -1263,7 +1263,7 @@ static void preprocess(char *buf) + } + + +-void postprocess(char *buf) ++static void postprocess(char *buf) + { + char *str = strdup(buf); + char *pos1 = str; +diff --git a/src/auditd-config.c b/src/auditd-config.c +index 2d43e34..6a860fa 100644 +--- a/src/auditd-config.c ++++ b/src/auditd-config.c +@@ -67,83 +67,83 @@ static char *get_line(FILE *f, char *buf, unsigned size, int *lineno, + const char *file); + static int nv_split(char *buf, struct nv_pair *nv); + static const struct kw_pair *kw_lookup(const char *val); +-static int local_events_parser(struct nv_pair *nv, int line, ++static int local_events_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int write_logs_parser(struct nv_pair *nv, int line, ++static int write_logs_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int log_file_parser(struct nv_pair *nv, int line, ++static int log_file_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int num_logs_parser(struct nv_pair *nv, int line, ++static int num_logs_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int log_group_parser(struct nv_pair *nv, int line, ++static int log_group_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int qos_parser(struct nv_pair *nv, int line, ++static int qos_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int dispatch_parser(struct nv_pair *nv, int line, ++static int dispatch_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int name_format_parser(struct nv_pair *nv, int line, ++static int name_format_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int name_parser(struct nv_pair *nv, int line, ++static int name_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int max_log_size_parser(struct nv_pair *nv, int line, ++static int max_log_size_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int max_log_size_action_parser(struct nv_pair *nv, int line, ++static int max_log_size_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int log_format_parser(struct nv_pair *nv, int line, ++static int log_format_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int flush_parser(struct nv_pair *nv, int line, ++static int flush_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int freq_parser(struct nv_pair *nv, int line, ++static int freq_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int space_left_parser(struct nv_pair *nv, int line, ++static int space_left_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int space_action_parser(struct nv_pair *nv, int line, ++static int space_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int action_mail_acct_parser(struct nv_pair *nv, int line, ++static int action_mail_acct_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int verify_email_parser(struct nv_pair *nv, int line, ++static int verify_email_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int admin_space_left_parser(struct nv_pair *nv, int line, ++static int admin_space_left_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int admin_space_left_action_parser(struct nv_pair *nv, int line, ++static int admin_space_left_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int disk_full_action_parser(struct nv_pair *nv, int line, ++static int disk_full_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int disk_error_action_parser(struct nv_pair *nv, int line, ++static int disk_error_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int priority_boost_parser(struct nv_pair *nv, int line, ++static int priority_boost_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int tcp_listen_port_parser(struct nv_pair *nv, int line, ++static int tcp_listen_port_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int tcp_listen_queue_parser(struct nv_pair *nv, int line, ++static int tcp_listen_queue_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int tcp_max_per_addr_parser(struct nv_pair *nv, int line, ++static int tcp_max_per_addr_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int use_libwrap_parser(struct nv_pair *nv, int line, ++static int use_libwrap_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int tcp_client_ports_parser(struct nv_pair *nv, int line, ++static int tcp_client_ports_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int tcp_client_max_idle_parser(struct nv_pair *nv, int line, ++static int tcp_client_max_idle_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int transport_parser(struct nv_pair *nv, int line, ++static int transport_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int enable_krb5_parser(struct nv_pair *nv, int line, ++static int enable_krb5_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int krb5_principal_parser(struct nv_pair *nv, int line, ++static int krb5_principal_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int krb5_key_file_parser(struct nv_pair *nv, int line, ++static int krb5_key_file_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int distribute_network_parser(struct nv_pair *nv, int line, ++static int distribute_network_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int q_depth_parser(struct nv_pair *nv, int line, ++static int q_depth_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int overflow_action_parser(struct nv_pair *nv, int line, ++static int overflow_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int max_restarts_parser(struct nv_pair *nv, int line, ++static int max_restarts_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int plugin_dir_parser(struct nv_pair *nv, int line, ++static int plugin_dir_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); +-static int eoe_timeout_parser(struct nv_pair *nv, int line, ++static int eoe_timeout_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config); + static int sanity_check(struct daemon_conf *config); + +@@ -274,7 +274,6 @@ static int allow_links = 0; + static const char *config_dir = NULL; + static char *config_file = NULL; + +- + void set_allow_links(int allow) + { + allow_links = allow; +@@ -290,16 +289,6 @@ int set_config_dir(const char *val) + return 0; + } + +-const char *get_config_dir(void) +-{ +- /* This function is used to determine if audispd is started with +- * a -c parameter followed by the config_dir location. If we are +- * using the standard location, do not pass back a location. */ +- if (config_file && strcmp(config_file, CONFIG_FILE) == 0) +- return NULL; +- return config_dir; +-} +- + /* + * Set everything to its default value + */ +@@ -578,7 +567,7 @@ static const struct kw_pair *kw_lookup(const char *val) + return &keywords[i]; + } + +-static int local_events_parser(struct nv_pair *nv, int line, ++static int local_events_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + unsigned long i; +@@ -596,7 +585,7 @@ static int local_events_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int write_logs_parser(struct nv_pair *nv, int line, ++static int write_logs_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + unsigned long i; +@@ -614,7 +603,7 @@ static int write_logs_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int log_file_parser(struct nv_pair *nv, int line, ++static int log_file_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + char *dir = NULL, *tdir; +@@ -695,7 +684,7 @@ finish_up: + return 0; + } + +-static int num_logs_parser(struct nv_pair *nv, int line, ++static int num_logs_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -705,7 +694,7 @@ static int num_logs_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -730,7 +719,7 @@ static int num_logs_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int qos_parser(struct nv_pair *nv, int line, ++static int qos_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_WARNING, "The disp_qos option is deprecated - line %d", +@@ -738,7 +727,7 @@ static int qos_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int dispatch_parser(struct nv_pair *nv, int line, ++static int dispatch_parser(const const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG, "dispatch_parser called with: %s", nv->value); +@@ -747,7 +736,7 @@ static int dispatch_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int name_format_parser(struct nv_pair *nv, int line, ++static int name_format_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -763,7 +752,7 @@ static int name_format_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int name_parser(struct nv_pair *nv, int line, ++static int name_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG, "name_parser called with: %s", nv->value); +@@ -774,7 +763,7 @@ static int name_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int max_log_size_parser(struct nv_pair *nv, int line, ++static int max_log_size_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -784,7 +773,7 @@ static int max_log_size_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -805,7 +794,7 @@ static int max_log_size_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int max_log_size_action_parser(struct nv_pair *nv, int line, ++static int max_log_size_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -822,7 +811,7 @@ static int max_log_size_action_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int log_format_parser(struct nv_pair *nv, int line, ++static int log_format_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -846,14 +835,14 @@ static int log_format_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int log_group_parser(struct nv_pair *nv, int line, ++static int log_group_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + gid_t gid = 0; + + audit_msg(LOG_DEBUG, "log_group_parser called with: %s", + nv->value); +- if (isdigit(nv->value[0])) { ++ if (isdigit((unsigned char)nv->value[0])) { + errno = 0; + gid = strtoul(nv->value,NULL,10); + if (errno) { +@@ -878,7 +867,7 @@ static int log_group_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int flush_parser(struct nv_pair *nv, int line, ++static int flush_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -894,7 +883,7 @@ static int flush_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int freq_parser(struct nv_pair *nv, int line, ++static int freq_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -904,7 +893,7 @@ static int freq_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -932,7 +921,7 @@ static int freq_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int space_left_parser(struct nv_pair *nv, int line, ++static int space_left_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + char *p, *ptr = (char *)nv->value; +@@ -944,7 +933,7 @@ static int space_left_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i]) && ptr[i] != '%') { ++ if (!isdigit((unsigned char)ptr[i]) && ptr[i] != '%') { + audit_msg(LOG_ERR, + "Value %c %s should only be numbers or percent - line %d", + ptr[i],nv->value, line); +@@ -1027,7 +1016,7 @@ static int check_exe_name(const char *val, int line) + return 0; + } + +-static int space_action_parser(struct nv_pair *nv, int line, ++static int space_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1121,7 +1110,7 @@ static int validate_email(const char *acct) + return 0; + } + +-static int action_mail_acct_parser(struct nv_pair *nv, int line, ++static int action_mail_acct_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + char *tmail; +@@ -1144,7 +1133,7 @@ static int action_mail_acct_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int verify_email_parser(struct nv_pair *nv, int line, ++static int verify_email_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + unsigned long i; +@@ -1162,7 +1151,7 @@ static int verify_email_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int admin_space_left_parser(struct nv_pair *nv, int line, ++static int admin_space_left_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + char *p, *ptr = (char *)nv->value; +@@ -1175,7 +1164,7 @@ static int admin_space_left_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i]) && ptr[i] != '%') { ++ if (!isdigit((unsigned char)ptr[i]) && ptr[i] != '%') { + audit_msg(LOG_ERR, + "Value %c %s should only be numbers or percent - line %d", + ptr[i],nv->value, line); +@@ -1212,7 +1201,7 @@ static int admin_space_left_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int admin_space_left_action_parser(struct nv_pair *nv, int line, ++static int admin_space_left_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1242,7 +1231,7 @@ static int admin_space_left_action_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int disk_full_action_parser(struct nv_pair *nv, int line, ++static int disk_full_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1269,7 +1258,7 @@ static int disk_full_action_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int disk_error_action_parser(struct nv_pair *nv, int line, ++static int disk_error_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1297,7 +1286,7 @@ static int disk_error_action_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int priority_boost_parser(struct nv_pair *nv, int line, ++static int priority_boost_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1308,7 +1297,7 @@ static int priority_boost_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1336,7 +1325,7 @@ static int priority_boost_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int tcp_listen_port_parser(struct nv_pair *nv, int line, ++static int tcp_listen_port_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1353,7 +1342,7 @@ static int tcp_listen_port_parser(struct nv_pair *nv, int line, + #else + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1388,7 +1377,7 @@ static int tcp_listen_port_parser(struct nv_pair *nv, int line, + #endif + } + +-static int tcp_listen_queue_parser(struct nv_pair *nv, int line, ++static int tcp_listen_queue_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1405,7 +1394,7 @@ static int tcp_listen_queue_parser(struct nv_pair *nv, int line, + #else + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1443,7 +1432,7 @@ static int tcp_listen_queue_parser(struct nv_pair *nv, int line, + } + + +-static int tcp_max_per_addr_parser(struct nv_pair *nv, int line, ++static int tcp_max_per_addr_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1460,7 +1449,7 @@ static int tcp_max_per_addr_parser(struct nv_pair *nv, int line, + #else + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1497,7 +1486,7 @@ static int tcp_max_per_addr_parser(struct nv_pair *nv, int line, + #endif + } + +-static int use_libwrap_parser(struct nv_pair *nv, int line, ++static int use_libwrap_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + unsigned long i; +@@ -1515,7 +1504,7 @@ static int use_libwrap_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int tcp_client_ports_parser(struct nv_pair *nv, int line, ++static int tcp_client_ports_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1537,7 +1526,7 @@ static int tcp_client_ports_parser(struct nv_pair *nv, int line, + saw_dash = ptr + i; + continue; + } +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers, or " + "two numbers separated by a dash - line %d", +@@ -1546,7 +1535,7 @@ static int tcp_client_ports_parser(struct nv_pair *nv, int line, + } + } + for (; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers, or " + "two numbers separated by a dash - line %d", +@@ -1598,7 +1587,7 @@ static int tcp_client_ports_parser(struct nv_pair *nv, int line, + #endif + } + +-static int tcp_client_max_idle_parser(struct nv_pair *nv, int line, ++static int tcp_client_max_idle_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1615,7 +1604,7 @@ static int tcp_client_max_idle_parser(struct nv_pair *nv, int line, + #else + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1646,7 +1635,7 @@ static int tcp_client_max_idle_parser(struct nv_pair *nv, int line, + #endif + } + +-static int transport_parser(struct nv_pair *nv, int line, ++static int transport_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1664,7 +1653,7 @@ static int transport_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int enable_krb5_parser(struct nv_pair *nv, int line, ++static int enable_krb5_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG, "enable_krb5_parser called with: %s", +@@ -1690,7 +1679,7 @@ static int enable_krb5_parser(struct nv_pair *nv, int line, + #endif + } + +-static int krb5_principal_parser(struct nv_pair *nv, int line, ++static int krb5_principal_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG,"krb5_principal_parser called with: %s",nv->value); +@@ -1704,7 +1693,7 @@ static int krb5_principal_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int krb5_key_file_parser(struct nv_pair *nv, int line, ++static int krb5_key_file_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG, "krb5_key_file_parser called with: %s", nv->value); +@@ -1718,7 +1707,7 @@ static int krb5_key_file_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int distribute_network_parser(struct nv_pair *nv, int line, ++static int distribute_network_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + unsigned long i; +@@ -1737,7 +1726,7 @@ static int distribute_network_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int q_depth_parser(struct nv_pair *nv, int line, ++static int q_depth_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1747,7 +1736,7 @@ static int q_depth_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1774,7 +1763,7 @@ static int q_depth_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int overflow_action_parser(struct nv_pair *nv, int line, ++static int overflow_action_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + int i; +@@ -1792,7 +1781,7 @@ static int overflow_action_parser(struct nv_pair *nv, int line, + return 1; + } + +-static int max_restarts_parser(struct nv_pair *nv, int line, ++static int max_restarts_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1803,7 +1792,7 @@ static int max_restarts_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +@@ -1830,7 +1819,7 @@ static int max_restarts_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int plugin_dir_parser(struct nv_pair *nv, int line, ++static int plugin_dir_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + audit_msg(LOG_DEBUG, "plugin_dir_parser called with: %s", nv->value); +@@ -1851,7 +1840,7 @@ static int plugin_dir_parser(struct nv_pair *nv, int line, + return 0; + } + +-static int eoe_timeout_parser(struct nv_pair *nv, int line, ++static int eoe_timeout_parser(const struct nv_pair *nv, int line, + struct daemon_conf *config) + { + const char *ptr = nv->value; +@@ -1861,7 +1850,7 @@ static int eoe_timeout_parser(struct nv_pair *nv, int line, + + /* check that all chars are numbers */ + for (i=0; ptr[i]; i++) { +- if (!isdigit(ptr[i])) { ++ if (!isdigit((unsigned char)ptr[i])) { + audit_msg(LOG_ERR, + "Value %s should only be numbers - line %d", + nv->value, line); +diff --git a/src/auditd-config.h b/src/auditd-config.h +index 0bd69d6..dae6a50 100644 +--- a/src/auditd-config.h ++++ b/src/auditd-config.h +@@ -99,10 +99,7 @@ struct daemon_conf + }; + + void set_allow_links(int allow); +- +-/* Return 0 on success. */ + int set_config_dir(const char *val); +-const char *get_config_dir(void); + + int load_config(struct daemon_conf *config, log_test_t lt); + void clear_config(struct daemon_conf *config); +@@ -115,7 +112,6 @@ void init_config_manager(void); + #ifdef AUDITD_EVENT_H + int start_config_manager(struct auditd_event *e); + #endif +-void shutdown_config(void); + void free_config(struct daemon_conf *config); + + #endif +diff --git a/src/auditd-dispatch.h b/src/auditd-dispatch.h +index 9dc2b2e..c5d63e1 100644 +--- a/src/auditd-dispatch.h ++++ b/src/auditd-dispatch.h +@@ -28,7 +28,6 @@ + + int dispatcher_pid(void); + void dispatcher_reaped(void); +-int make_dispatcher_fd_private(void); + int init_dispatcher(const struct daemon_conf *config); + void shutdown_dispatcher(void); + void reconfigure_dispatcher(const struct daemon_conf *config); +diff --git a/src/auditd-event.c b/src/auditd-event.c +index b2a4726..1a81471 100644 +--- a/src/auditd-event.c ++++ b/src/auditd-event.c +@@ -95,6 +95,9 @@ static auparse_state_t *au = NULL; + #define FORMAT_BUF_LEN (MAX_AUDIT_MESSAGE_LENGTH + _POSIX_HOST_NAME_MAX) + #define MIN_SPACE_LEFT 24 + ++static inline int from_network(const struct auditd_event *e) ++{ if (e && e->ack_func) return 1; return 0; } ++ + int dispatch_network_events(void) + { + return config->distribute_network_events; +@@ -539,7 +542,7 @@ void enqueue_event(struct auditd_event *e) + + /* This function allocates memory and fills the event fields with + passed arguments. Caller must free memory. */ +-struct auditd_event *create_event(char *msg, ack_func_type ack_func, ++struct auditd_event *create_event(const char *msg, ack_func_type ack_func, + void *ack_data, uint32_t sequence_id) + { + struct auditd_event *e; +diff --git a/src/auditd-event.h b/src/auditd-event.h +index dceff68..1f0b7ac 100644 +--- a/src/auditd-event.h ++++ b/src/auditd-event.h +@@ -37,9 +37,6 @@ struct auditd_event { + unsigned long sequence_id; + }; + +-static inline int from_network(const struct auditd_event *e) +-{ if (e && e->ack_func) return 1; return 0; } +- + #include "auditd-config.h" + + int dispatch_network_events(void); +@@ -51,7 +48,7 @@ void cleanup_event(struct auditd_event *e); + void format_event(struct auditd_event *e); + void enqueue_event(struct auditd_event *e); + void handle_event(struct auditd_event *e); +-struct auditd_event *create_event(char *msg, ack_func_type ack_func, ++struct auditd_event *create_event(const char *msg, ack_func_type ack_func, + void *ack_data, uint32_t sequence_id); + + #endif +diff --git a/src/auditd-listen.c b/src/auditd-listen.c +index 6dbbb8c..cf92f2b 100644 +--- a/src/auditd-listen.c ++++ b/src/auditd-listen.c +@@ -55,7 +55,6 @@ + + #include "ev.h" + +-extern volatile int stop; + extern int send_audit_event(int type, const char *str); + #define DEFAULT_BUF_SZ 192 + +@@ -91,7 +90,7 @@ static char *my_service_name, *my_gss_realm; + #define USE_GSS (transport == T_KRB5) + #endif + +-static char *sockaddr_to_string(struct sockaddr_storage *addr) ++static char *sockaddr_to_string(const struct sockaddr_storage *addr) + { + static char buf[INET6_ADDRSTRLEN]; + +@@ -103,7 +102,7 @@ static char *sockaddr_to_string(struct sockaddr_storage *addr) + return buf; + } + +-static unsigned int sockaddr_to_port(struct sockaddr_storage *addr) ++static unsigned int sockaddr_to_port(const struct sockaddr_storage *addr) + { + unsigned int rc; + +@@ -765,7 +764,7 @@ static int auditd_tcpd_check(int sock) + * a 1 if there are too many and a 0 otherwise. It assumes the incoming + * connection has not been added to the linked list yet. + */ +-static int check_num_connections(struct sockaddr_storage *aaddr) ++static int check_num_connections(const struct sockaddr_storage *aaddr) + { + int num = 0; + struct ev_tcp *client = client_chain; +@@ -1169,7 +1168,7 @@ void auditd_tcp_listen_uninit(struct ev_loop *loop, struct daemon_conf *config) + transport = T_TCP; + } + +-static void periodic_reconfigure(struct daemon_conf *config) ++static void periodic_reconfigure(const struct daemon_conf *config) + { + struct ev_loop *loop = ev_default_loop(EVFLAG_AUTO); + if (config->tcp_listen_port && config->tcp_client_max_idle) { +@@ -1181,7 +1180,7 @@ static void periodic_reconfigure(struct daemon_conf *config) + } + } + +-void auditd_tcp_listen_reconfigure(struct daemon_conf *nconf, ++void auditd_tcp_listen_reconfigure(const struct daemon_conf *nconf, + struct daemon_conf *oconf) + { + use_libwrap = nconf->use_libwrap; +diff --git a/src/auditd-listen.h b/src/auditd-listen.h +index 4fb9c37..ed91d3d 100644 +--- a/src/auditd-listen.h ++++ b/src/auditd-listen.h +@@ -32,7 +32,7 @@ + int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config ); + void auditd_tcp_listen_uninit ( struct ev_loop *loop, + struct daemon_conf *config ); +-void auditd_tcp_listen_reconfigure ( struct daemon_conf *nconf, ++void auditd_tcp_listen_reconfigure ( const struct daemon_conf *nconf, + struct daemon_conf *oconf ); + void write_connection_state(FILE *f); + #else +diff --git a/src/auditd-reconfig.c b/src/auditd-reconfig.c +index 80611aa..7e6c412 100644 +--- a/src/auditd-reconfig.c ++++ b/src/auditd-reconfig.c +@@ -78,11 +78,6 @@ int start_config_manager(struct auditd_event *e) + return rc; + } + +-void shutdown_config(void) +-{ +- pthread_cancel(config_thread); +-} +- + static void *config_thread_main(void *arg) + { + sigset_t sigs; +diff --git a/src/aureport-options.c b/src/aureport-options.c +index 2d9ccc8..7480c8a 100644 +--- a/src/aureport-options.c ++++ b/src/aureport-options.c +@@ -82,7 +82,7 @@ struct nv_pair { + const char *name; + }; + +-enum { R_INFILE, R_TIME_END, R_TIME_START, R_VERSION, R_SUMMARY, R_LOG_TIMES, ++enum { R_INFILE, R_TIME_END, R_TIME_START, R_VERSION, R_LOG_TIMES, + R_CONFIGS, R_LOGINS, R_USERS, R_TERMINALS, R_HOSTS, R_EXES, R_FILES, + R_AVCS, R_SYSCALLS, R_PIDS, R_EVENTS, R_ACCT_MODS, + R_INTERPRET, R_HELP, R_ANOMALY, R_RESPONSE, R_SUMMARY_DET, R_CRYPTO, +@@ -90,7 +90,7 @@ enum { R_INFILE, R_TIME_END, R_TIME_START, R_VERSION, R_SUMMARY, R_LOG_TIMES, + R_KEYS, R_TTY, R_NO_CONFIG, R_COMM, R_VIRT, R_INTEG, R_ESCAPE, + R_DEBUG, R_EOE_TMO }; + +-static struct nv_pair optiontab[] = { ++static const struct nv_pair optiontab[] = { + { R_AUTH, "-au" }, + { R_AUTH, "--auth" }, + { R_AVCS, "-a" }, +diff --git a/src/aureport-options.h b/src/aureport-options.h +index a559f64..9826398 100644 +--- a/src/aureport-options.h ++++ b/src/aureport-options.h +@@ -29,8 +29,6 @@ + #include "ausearch-common.h" + + /* Global variables that describe what search is to be performed */ +-extern const char *event_context; +- + typedef enum { RPT_UNSET, RPT_TIME, RPT_SUMMARY, RPT_AVC, RPT_MAC, + RPT_CONFIG, RPT_EVENT, RPT_FILE, RPT_HOST, RPT_LOGIN, + RPT_ACCT_MOD, RPT_PID, RPT_SYSCALL, RPT_TERM, RPT_USER, +diff --git a/src/aureport-scan.c b/src/aureport-scan.c +index 4095e86..93f03d6 100644 +--- a/src/aureport-scan.c ++++ b/src/aureport-scan.c +@@ -112,7 +112,7 @@ void destroy_counters(void) + } + + /* This function will return 0 on no match and 1 on match */ +-int classify_success(const llist *l) ++static int classify_success(const llist *l) + { + //printf("%d,succ=%d:%d\n", l->head->type, event_failed, l->s.success); + // If match only failed... +@@ -126,7 +126,7 @@ int classify_success(const llist *l) + } + + /* This function will return 0 on no match and 1 on match */ +-int classify_conf(const llist *l) ++static int classify_conf(const llist *l) + { + int rc = 1; + extern int no_config; +diff --git a/src/ausearch-avc.h b/src/ausearch-avc.h +index 6739ffe..3796ed4 100644 +--- a/src/ausearch-avc.h ++++ b/src/ausearch-avc.h +@@ -53,7 +53,7 @@ typedef struct { + void alist_create(alist *l); + static inline void alist_first(alist *l) { l->cur = l->head; } + anode *alist_next(alist *l); +-static inline anode *alist_get_cur(alist *l) { return l->cur; } ++static inline anode *alist_get_cur(const alist *l) { return l->cur; } + void alist_append(alist *l, anode *node); + void anode_init(anode *an); + void anode_clear(anode *an); +diff --git a/src/ausearch-int.h b/src/ausearch-int.h +index fea8499..d7fc740 100644 +--- a/src/ausearch-int.h ++++ b/src/ausearch-int.h +@@ -47,7 +47,7 @@ typedef struct { + void ilist_create(ilist *l); + static inline void ilist_first(ilist *l) { l->cur = l->head; } + int_node *ilist_next(ilist *l); +-static inline int_node *ilist_get_cur(ilist *l) { return l->cur; } ++static inline int_node *ilist_get_cur(const ilist *l) { return l->cur; } + void ilist_append(ilist *l, int num, unsigned int hits, int aux); + void ilist_clear(ilist* l); + +diff --git a/src/ausearch-lol.h b/src/ausearch-lol.h +index bab0c81..427d083 100644 +--- a/src/ausearch-lol.h ++++ b/src/ausearch-lol.h +@@ -53,7 +53,6 @@ void complete_all_events(lol *lo); + llist* get_ready_event(lol *lo); + + void lol_set_eoe_timeout(time_t new_eoe_tmo); +-void setup_userspace_configitems(); + + #endif + +diff --git a/src/ausearch-lookup.c b/src/ausearch-lookup.c +index 09385c9..8af3e66 100644 +--- a/src/ausearch-lookup.c ++++ b/src/ausearch-lookup.c +@@ -110,7 +110,7 @@ const char *aulookup_syscall(llist *l, char *buf, size_t size) + } + + // See include/linux/net.h +-static struct nv_pair socktab[] = { ++static const struct nv_pair socktab[] = { + {SYS_SOCKET, "socket"}, + {SYS_BIND, "bind"}, + {SYS_CONNECT, "connect"}, +@@ -163,7 +163,7 @@ static const char *aulookup_socketcall(long sc) + /* + * This table maps ipc calls to their text name + */ +-static struct nv_pair ipctab[] = { ++static const struct nv_pair ipctab[] = { + {SEMOP, "semop"}, + {SEMGET, "semget"}, + {SEMCTL, "semctl"}, +@@ -251,7 +251,7 @@ void aulookup_destroy_uid_list(void) + uid_list_created = 0; + } + +-int is_hex_string(const char *str) ++static int is_hex_string(const char *str) + { + int c=0; + while (*str) { +diff --git a/src/ausearch-lookup.h b/src/ausearch-lookup.h +index c5fc9f4..c80f782 100644 +--- a/src/ausearch-lookup.h ++++ b/src/ausearch-lookup.h +@@ -40,7 +40,6 @@ const char *aulookup_uid(uid_t uid, char *buf, size_t size) + __attr_access ((__write_only__, 2, 3)); + void aulookup_destroy_uid_list(void); + char *unescape(const char *buf); +-int is_hex_string(const char *str); + void print_tty_data(const char *val); + void safe_print_string_n(const char *s, unsigned int len, int ret) + __attr_access ((__read_only__, 1, 2)); +diff --git a/src/ausearch-nvpair.c b/src/ausearch-nvpair.c +index 7b00bef..3a1b27d 100644 +--- a/src/ausearch-nvpair.c ++++ b/src/ausearch-nvpair.c +@@ -34,14 +34,6 @@ void search_list_create(nvlist *l) + l->cnt = 0; + } + +-nvnode *search_list_next(nvlist *l) +-{ +- if (l->cur == NULL) +- return NULL; +- l->cur = l->cur->next; +- return l->cur; +-} +- + void search_list_append(nvlist *l, nvnode *node) + { + nvnode* newnode = malloc(sizeof(nvnode)); +diff --git a/src/ausearch-nvpair.h b/src/ausearch-nvpair.h +index 95b63fe..244dca7 100644 +--- a/src/ausearch-nvpair.h ++++ b/src/ausearch-nvpair.h +@@ -45,8 +45,6 @@ typedef struct { + } nvlist; + + void search_list_create(nvlist *l); +-static inline void search_list_first(nvlist *l) { l->cur = l->head; } +-nvnode *search_list_next(nvlist *l); + static inline nvnode *search_list_get_cur(nvlist *l) { return l->cur; } + void search_list_append(nvlist *l, nvnode *node); + void search_list_clear(nvlist* l); +diff --git a/src/ausearch-options.c b/src/ausearch-options.c +index 7d6a4f0..1c65364 100644 +--- a/src/ausearch-options.c ++++ b/src/ausearch-options.c +@@ -95,7 +95,7 @@ S_PPID, S_KEY, S_RAW, S_NODE, S_IN_LOGS, S_JUST_ONE, S_SESSION, S_EXIT, + S_LINEBUFFERED, S_UUID, S_VMNAME, S_DEBUG, S_CHECKPOINT, S_ARCH, S_FORMAT, + S_EXTRA_TIME, S_EXTRA_LABELS, S_EXTRA_KEYS, S_EXTRA_OBJ2, S_ESCAPE, S_EOE_TMO }; + +-static struct nv_pair optiontab[] = { ++static const struct nv_pair optiontab[] = { + { S_EVENT, "-a" }, + { S_ARCH, "--arch" }, + { S_EVENT, "--event" }, +diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c +index 1e51a67..13a1457 100644 +--- a/src/ausearch-parse.c ++++ b/src/ausearch-parse.c +@@ -1724,7 +1724,7 @@ static int parse_sockaddr(const lnode *n, search_items *s) + if (len != sizeof(saddr->sa_family) && + len < 4) { + fprintf(stderr, +- "sun_path len too short (%d)\n", ++ "sun_path len too short (%u)\n", + len); + return 4; + } +diff --git a/src/ausearch-string.c b/src/ausearch-string.c +index 4016a41..86b8a78 100644 +--- a/src/ausearch-string.c ++++ b/src/ausearch-string.c +@@ -61,7 +61,7 @@ snode *slist_next(slist *l) + return l->cur; + } + +-void slist_append(slist *l, snode *node) ++void slist_append(slist *l, const snode *node) + { + snode* newnode; + +diff --git a/src/ausearch-string.h b/src/ausearch-string.h +index 6d14737..ed4a05b 100644 +--- a/src/ausearch-string.h ++++ b/src/ausearch-string.h +@@ -47,8 +47,8 @@ typedef struct { + void slist_create(slist *l); + static inline void slist_first(slist *l) { l->cur = l->head; } + snode *slist_next(slist *l); +-static inline snode *slist_get_cur(slist *l) { return l->cur; } +-void slist_append(slist *l, snode *node); ++static inline snode *slist_get_cur(const slist *l) { return l->cur; } ++void slist_append(slist *l, const snode *node); + void slist_clear(slist* l); + + /* append a string if its not already on the list */ +diff --git a/src/ausearch-time.c b/src/ausearch-time.c +index edcd78d..d2409a2 100644 +--- a/src/ausearch-time.c ++++ b/src/ausearch-time.c +@@ -43,7 +43,7 @@ struct nv_pair { + const char *name; + }; + +-static struct nv_pair timetab[] = { ++static const struct nv_pair timetab[] = { + { T_NOW, "now" }, + { T_RECENT, "recent" }, + { T_THIS_HOUR, "this-hour" }, +-- +2.50.1 + diff --git a/backport-make-slist_last-a-static-function.patch b/backport-make-slist_last-a-static-function.patch new file mode 100644 index 0000000..e935950 --- /dev/null +++ b/backport-make-slist_last-a-static-function.patch @@ -0,0 +1,58 @@ +From b6d376d9f6a5593e7d8029fca1094f16d724bfe7 Mon Sep 17 00:00:00 2001 +From: Steve Grubb +Date: Fri, 1 Sep 2023 13:06:36 -0400 +Subject: [PATCH] make slist_last a static function + +--- + src/ausearch-string.c | 6 +++--- + src/ausearch-string.h | 3 +-- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/src/ausearch-string.c b/src/ausearch-string.c +index d723ac0..4016a41 100644 +--- a/src/ausearch-string.c ++++ b/src/ausearch-string.c +@@ -1,6 +1,6 @@ + /* + * ausearch-string.c - Minimal linked list library for strings +-* Copyright (c) 2005,2008,2014 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005,2008,2014 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -34,10 +34,10 @@ void slist_create(slist *l) + l->cnt = 0; + } + +-void slist_last(slist *l) ++static inline void slist_last(slist *l) + { + register snode* cur; +- ++ + if (l->head == NULL) + return; + +diff --git a/src/ausearch-string.h b/src/ausearch-string.h +index 1cfc4a6..6d14737 100644 +--- a/src/ausearch-string.h ++++ b/src/ausearch-string.h +@@ -1,6 +1,6 @@ + /* + * ausearch-string.h - Header file for ausearch-string.c +-* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina. ++* Copyright (c) 2005,2008 Red Hat Inc. + * All Rights Reserved. + * + * This software may be freely redistributed and/or modified under the +@@ -46,7 +46,6 @@ typedef struct { + + void slist_create(slist *l); + static inline void slist_first(slist *l) { l->cur = l->head; } +-void slist_last(slist *l); + snode *slist_next(slist *l); + static inline snode *slist_get_cur(slist *l) { return l->cur; } + void slist_append(slist *l, snode *node); +-- +2.50.1 + -- Gitee