From b3bb74c33c237cdd3b9312cef157ea4cd3c4741e Mon Sep 17 00:00:00 2001 From: John Johansen Date: Thu, 1 Sep 2022 09:56:45 -0700 Subject: [PATCH] parser: convert valid_prefix and add_prefix to use const The prefix can passed as a parameter can be const so it should be. Signed-off-by: John Johansen --- parser/af_unix.h | 2 +- parser/dbus.h | 2 +- parser/mount.h | 2 +- parser/mqueue.h | 2 +- parser/ptrace.h | 2 +- parser/rule.h | 4 ++-- parser/signal.h | 2 +- parser/userns.h | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/parser/af_unix.h b/parser/af_unix.h index c7fcf2fcf..27cb662bb 100644 --- a/parser/af_unix.h +++ b/parser/af_unix.h @@ -46,7 +46,7 @@ public: free(peer_addr); }; - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = "owner prefix not allowed on unix rules"; return false; diff --git a/parser/dbus.h b/parser/dbus.h index a564ef8ae..f35797e9a 100644 --- a/parser/dbus.h +++ b/parser/dbus.h @@ -50,7 +50,7 @@ public: free(interface); free(member); }; - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = "owner prefix not allowed on dbus rules"; return false; diff --git a/parser/mount.h b/parser/mount.h index 86cd1d99d..8045ee966 100644 --- a/parser/mount.h +++ b/parser/mount.h @@ -156,7 +156,7 @@ public: free(trans); } - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = "owner prefix not allowed on mount rules"; return false; diff --git a/parser/mqueue.h b/parser/mqueue.h index b26a988a7..24265666c 100644 --- a/parser/mqueue.h +++ b/parser/mqueue.h @@ -95,7 +95,7 @@ public: free(label); }; - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { // not yet, but soon if (p.owner) { error = _("owner prefix not allowed on mqueue rules"); diff --git a/parser/ptrace.h b/parser/ptrace.h index 98454e952..89881de91 100644 --- a/parser/ptrace.h +++ b/parser/ptrace.h @@ -44,7 +44,7 @@ public: virtual int expand_variables(void); virtual int gen_policy_re(Profile &prof); - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = "owner prefix not allowed on ptrace rules"; return false; diff --git a/parser/rule.h b/parser/rule.h index 000098e5b..7337adc7f 100644 --- a/parser/rule.h +++ b/parser/rule.h @@ -135,9 +135,9 @@ public: owner = 0; }; - virtual bool valid_prefix(prefixes &p, const char *&error) = 0; + virtual bool valid_prefix(const prefixes &p, const char *&error) = 0; - virtual bool add_prefix(prefixes &p, const char *&error) { + virtual bool add_prefix(const prefixes &p, const char *&error) { if (!valid_prefix(p, error)) return false; if (p.audit != AUDIT_UNSPECIFIED && audit != p.audit) { diff --git a/parser/signal.h b/parser/signal.h index af8469cc9..391c8b34d 100644 --- a/parser/signal.h +++ b/parser/signal.h @@ -45,7 +45,7 @@ public: signals.clear(); free(peer_label); }; - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = "owner prefix not allowed on signal rules"; return false; diff --git a/parser/userns.h b/parser/userns.h index 624d53cbb..b72577124 100644 --- a/parser/userns.h +++ b/parser/userns.h @@ -31,7 +31,7 @@ public: { }; - virtual bool valid_prefix(prefixes &p, const char *&error) { + virtual bool valid_prefix(const prefixes &p, const char *&error) { if (p.owner) { error = _("owner prefix not allowed on userns rules"); return false;