From 60f3937061a138bb6f07709433b8e7707516a7ec Mon Sep 17 00:00:00 2001
From: Esben Haabendal <esben@geanix.com>
Date: Mon, 8 May 2023 11:25:41 +0200
Subject: [PATCH] WIP: openharmony-standard: Disable GRAPHIC_PERMISSION_CHECK

This causes appspawn to not change uid and gid, and drop all privileges when
spawning new applications.

Without this, applications are unable to connect to system dbus, and
NetworkManager communcation is thus not possible, breaking our NetworkManager
based wifi implementation.
---
 .../appspawn-dbus-debug.patch                       | 13 +++++++++++++
 .../openharmony/openharmony-standard_3.0.bb         |  2 ++
 2 files changed, 15 insertions(+)
 create mode 100644 recipes-openharmony/openharmony/openharmony-standard-3.0/appspawn-dbus-debug.patch

diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/appspawn-dbus-debug.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/appspawn-dbus-debug.patch
new file mode 100644
index 00000000..589a9fb9
--- /dev/null
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/appspawn-dbus-debug.patch
@@ -0,0 +1,13 @@
+diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp
+index 5e2addf99909..7e431cae76d2 100644
+--- a/src/appspawn_server.cpp
++++ b/src/appspawn_server.cpp
+@@ -33,7 +33,7 @@
+ #include <dirent.h>
+ #include <dlfcn.h>
+ 
+-#define GRAPHIC_PERMISSION_CHECK
++#undef GRAPHIC_PERMISSION_CHECK
+ constexpr static size_t ERR_STRING_SZ = 64;
+ 
+ namespace OHOS {
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
index b4592c70..b744ff86 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
@@ -78,6 +78,8 @@ SRC_URI += "file://param-paths.patch;patchdir=${S}/base/startup/init_lite"
 SRC_URI += "file://init_lite-log-to-stderr.patch;patchdir=${S}/base/startup/init_lite"
 SRC_URI += "file://param_service-Add-to-startup-l2-part.patch;patchdir=${S}/base/startup/appspawn_standard"
 
+SRC_URI += "file://appspawn-dbus-debug.patch;patchdir=${S}/base/startup/appspawn_standard"
+
 SRC_URI += "file://samgr-sd-notify.patch;patchdir=${S}/foundation/distributedschedule/samgr"
 SRC_URI += "file://safwk-sd-notify.patch;patchdir=${S}/foundation/distributedschedule/safwk"
 SRC_URI += "file://installs-sd-notify.patch;patchdir=${S}/foundation/appexecfwk/standard"
-- 
GitLab