Change the method to get DBUS addres when changing user with "su -" command. 16/115216/1
authorINSUN PYO <insun.pyo@ubuntu1604.playinsun.pe.kr>
Fri, 17 Feb 2017 02:19:31 +0000 (11:19 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Fri, 17 Feb 2017 02:52:09 +0000 (18:52 -0800)
The adbd's privilege has been changed form "System::Privileged" to "User::Shell".
So, pgrep does not work with smack errors when accessing /proc.
If it fails to find DBUS address, the fixed address is used.

Signed-off-by: INSUN PYO <insun.pyo@ubuntu1604.playinsun.pe.kr>
Change-Id: I4f9e0bc0939de2ecd7b866df8a2f266b4258338b
(cherry picked from commit 4f11f164f44d78ec6a54892e5d4095ca52e7117d)

packaging/dbus.sh

index d9b0a5d..def8586 100644 (file)
@@ -10,3 +10,12 @@ if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
    fi
 fi
 
+
+# The adbd's privilege has been changed form "System::Privileged" to "User::Shell".
+# So, pgrep does not work with smack errors when accessing /proc.
+# If it fails to find DBUS address, the fixed address is used.
+
+if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then
+   [[ "$UID" != "0" ]] && export DBUS_SESSION_BUS_ADDRESS="kernel:path=/sys/fs/kdbus/${UID}-user/bus;unix:path=/run/user/${UID}/dbus/user_bus_socket"
+fi
+