From 689e8aff13396ef1892c6265723688b25e48d148 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Fri, 5 Apr 2024 14:38:44 +0100 Subject: [PATCH 1/2] Allow `authorise-without-apparmor` when `aa_getpeercon()` returns `ENOPROTOOPT` --- src/frame_main.cpp | 1 + src/snap_name_of.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frame_main.cpp b/src/frame_main.cpp index 2d99c72..66c9e97 100644 --- a/src/frame_main.cpp +++ b/src/frame_main.cpp @@ -59,6 +59,7 @@ int main(int argc, char const* argv[]) ConfigurationOption{[&](auto& option) { background_client.set_crash_background_colour(option);}, "diagnostic-background", "Colour of diagnostic screen background RGB", "0x380c24"}, ConfigurationOption{[&](auto& option) { background_client.set_crash_text_colour(option);}, + "diagnostic-text", "Colour of diagnostic screen text RGB", "0xffffff"}, ConfigurationOption{[&] (auto& option) { background_client.set_diagnostic_path(option);}, "diagnostic-path", "Path (including filename) of diagnostic file", ""}, diff --git a/src/snap_name_of.cpp b/src/snap_name_of.cpp index 6815623..44b1f9c 100644 --- a/src/snap_name_of.cpp +++ b/src/snap_name_of.cpp @@ -41,7 +41,9 @@ auto snap_name_of(miral::Application const& app, bool fallback_without_apparmor, { mir::log_info("aa_getpeercon() failed for process %d: %s", miral::pid_of(app), strerror(errno)); - if ((errno == EINVAL) && fallback_without_apparmor) // EINVAL is what is returned when AppArmor isn't setup + // EINVAL is what is returned when AppArmor isn't setup + // ENOPROTOOPT is what is returned when AppArmor doesn't have some Ubuntu patches (yet) + if (((errno == EINVAL)|| errno == ENOPROTOOPT) && fallback_without_apparmor) { mir::log_info("Fall back (without AppArmor): Identify client via /proc/%%d/cmdline"); From ef59c812f99562fe43822ae1cec74660dc53113a Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Fri, 12 Apr 2024 10:07:02 +0100 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MichaƂ Sawicz --- src/frame_main.cpp | 1 - src/snap_name_of.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/frame_main.cpp b/src/frame_main.cpp index 66c9e97..2d99c72 100644 --- a/src/frame_main.cpp +++ b/src/frame_main.cpp @@ -59,7 +59,6 @@ int main(int argc, char const* argv[]) ConfigurationOption{[&](auto& option) { background_client.set_crash_background_colour(option);}, "diagnostic-background", "Colour of diagnostic screen background RGB", "0x380c24"}, ConfigurationOption{[&](auto& option) { background_client.set_crash_text_colour(option);}, - "diagnostic-text", "Colour of diagnostic screen text RGB", "0xffffff"}, ConfigurationOption{[&] (auto& option) { background_client.set_diagnostic_path(option);}, "diagnostic-path", "Path (including filename) of diagnostic file", ""}, diff --git a/src/snap_name_of.cpp b/src/snap_name_of.cpp index 44b1f9c..13a24ee 100644 --- a/src/snap_name_of.cpp +++ b/src/snap_name_of.cpp @@ -43,7 +43,7 @@ auto snap_name_of(miral::Application const& app, bool fallback_without_apparmor, // EINVAL is what is returned when AppArmor isn't setup // ENOPROTOOPT is what is returned when AppArmor doesn't have some Ubuntu patches (yet) - if (((errno == EINVAL)|| errno == ENOPROTOOPT) && fallback_without_apparmor) + if (((errno == EINVAL) || errno == ENOPROTOOPT) && fallback_without_apparmor) { mir::log_info("Fall back (without AppArmor): Identify client via /proc/%%d/cmdline");