diff --git a/SOURCES/usbguard-notifier-icon-injection.patch b/SOURCES/usbguard-notifier-icon-injection.patch new file mode 100644 index 0000000..daf5411 --- /dev/null +++ b/SOURCES/usbguard-notifier-icon-injection.patch @@ -0,0 +1,82 @@ +diff --color -ru a/usbguard-notifier-0.0.6/Makefile.am b/usbguard-notifier-0.0.6/Makefile.am +--- a/usbguard-notifier-0.0.6/Makefile.am 2021-11-18 11:38:43.704876330 +0100 ++++ b/usbguard-notifier-0.0.6/Makefile.am 2021-11-18 11:35:39.108500175 +0100 +@@ -35,6 +35,7 @@ + src/ThirdParty/Catch2/single_include/catch2 + + usbguard_notifier_SOURCES = \ ++ src/usbguard-icon.hpp \ + src/Notifier.hpp \ + src/NotifyWrapper.hpp \ + src/Serializer.hpp \ +@@ -43,8 +44,7 @@ + src/Notifier.cpp \ + src/NotifyWrapper.cpp \ + src/Serializer.cpp \ +- src/Log.cpp \ +- icons/usbguard-icon.svg ++ src/Log.cpp + + usbguard_notifier_LDFLAGS = \ + @rsvg_LIBS@ \ +@@ -65,7 +65,8 @@ + endif + + BUILT_SOURCES = \ +- src/BuildConfig.h ++ src/BuildConfig.h \ ++ src/usbguard-icon.hpp + + usbguard_notifier_cli_SOURCES = \ + src/Serializer.hpp \ +@@ -109,8 +110,16 @@ + # + # usbguard icon + # +-.svg.o: +- $(LD) -r -b binary -o $@ $< ++EXTRA_DIST += \ ++ $(top_builddir)/icons/usbguard-icon.svg ++ ++$(top_builddir)/src/usbguard-icon.hpp: $(top_builddir)/icons/usbguard-icon.svg ++ echo -e "#ifndef ICON_HPP\n#define ICON_HPP\nnamespace notify {\nconst char *icon =" > $@ ++ $(SED) 's/"/\\"/g' $^ | $(SED) 's/^/"/' | $(SED) 's/$$/\\n"/' >> $@ ++ echo -e ";\n}\n#endif" >> $@ ++ ++CLEANFILES += \ ++ $(top_builddir)/src/usbguard-icon.hpp + + # + # unit file +diff --color -ru a/usbguard-notifier-0.0.6/src/NotifyWrapper.cpp b/usbguard-notifier-0.0.6/src/NotifyWrapper.cpp +--- a/usbguard-notifier-0.0.6/src/NotifyWrapper.cpp 2020-03-02 11:55:25.932999263 +0100 ++++ b/usbguard-notifier-0.0.6/src/NotifyWrapper.cpp 2021-11-18 11:29:52.825157237 +0100 +@@ -18,14 +18,13 @@ + */ + + #include "NotifyWrapper.hpp" ++#include "usbguard-icon.hpp" + ++#include + #include + + #include + +-extern char _binary_icons_usbguard_icon_svg_start[]; +-extern char _binary_icons_usbguard_icon_svg_end[]; +- + namespace notify + { + +@@ -54,10 +53,7 @@ + Notification::Notification(const std::string& summary, const std::string& body) + : _n(notify_notification_new(summary.c_str(), body.c_str(), nullptr)) + { +- RsvgHandle* handle = rsvg_handle_new_from_data( +- (const guint8*)(_binary_icons_usbguard_icon_svg_start), +- _binary_icons_usbguard_icon_svg_end - _binary_icons_usbguard_icon_svg_start, +- nullptr); ++ RsvgHandle* handle = rsvg_handle_new_from_data((const guint8*)icon, std::strlen(icon), nullptr); + if (!handle) { + throw std::runtime_error("Failed to obtain rsvg handle"); + } diff --git a/SPECS/usbguard.spec b/SPECS/usbguard.spec index c7863cf..bf9d29d 100644 --- a/SPECS/usbguard.spec +++ b/SPECS/usbguard.spec @@ -8,7 +8,7 @@ Name: usbguard Version: 1.0.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A tool for implementing USB device usage policy Group: System Environment/Daemons License: GPLv2+ @@ -60,6 +60,7 @@ Patch7: usbguard-ipaddressdeny.patch Patch8: usbguard-ipc-override-fix.patch Patch9: usbguard-validate-acl.patch Patch10: usbguard-notifier-decrease-spam.patch +Patch11: usbguard-notifier-icon-injection.patch %description The USBGuard software framework helps to protect your computer against rogue USB @@ -146,6 +147,7 @@ rm -rf src/ThirdParty/{Catch,PEGTL} %patch8 -p1 -b .ipc-override-fix %patch9 -p1 -b .validate-acl %patch10 -p1 -b .notifier-decrease-spam +%patch11 -p1 -b .notifier-icon-injection %build mkdir -p ./m4 @@ -310,7 +312,8 @@ fi %changelog -* Thu Oct 21 2021 Zoltan Fridrich - 1.0.0-6 +* Mon Nov 22 2021 Zoltan Fridrich - 1.0.0-7 +- change usbguard icon injection - fix DSP module definition in spec file Resolves: rhbz#2014441 - add execstack to spec