about using privileged (KAuth) helpers: system dbus daemon on OS X?
René J.V. Bertin <[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm still trying to get around platform-limitations on OS X to get privileged helpers to work in the KF5 KAuth framework. I had hoped that it would only be a matter of a fallback obtaining the session bus address when running under sudo or setuid (see the attached patch, against v1.10.8), but after getting the privileged helper to leave messages where I can read them it turns out it is being started by the system dbus daemon. I can only presume this is the case on Linux too, but how then can it connect to the user's session bus there? FWIW: running %> sudo launchctl setenv DBUS_LAUNCHD_SESSION_BUS_SOCKET $DBUS_LAUNCHD_SESSION_BUS_SOCKET appears to give allow privileged helpers to work with the patched dbus. Thanks, René _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus
patch-allow-setuid.diff
(text/x-patch, 1.6 KB)
--- dbus/orig.dbus-sysdeps-unix.c 2016-09-15 22:15:03.000000000 +0200
+++ dbus/dbus-sysdeps-unix.c 2016-09-17 20:38:57.000000000 +0200
@@ -3836,12 +3836,12 @@
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- if (_dbus_check_setuid ())
- {
- dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
- "Unable to find launchd socket when setuid");
- return FALSE;
- }
+// if (_dbus_check_setuid ())
+// {
+// dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+// "Unable to find launchd socket when setuid");
+// return FALSE;
+// }
i = 0;
argv[i] = "launchctl";
@@ -3857,7 +3857,15 @@
if (!_read_subprocess_line_argv(argv[0], TRUE, argv, socket_path, error))
{
- return FALSE;
+ const char *c = _dbus_getenv (launchd_env_var);
+ if (*c)
+ {
+ _dbus_string_init_const (&socket_path, c);
+ }
+ else
+ {
+ return FALSE;
+ }
}
/* no error, but no result either */
@@ -3883,12 +3891,12 @@
dbus_bool_t valid_socket;
DBusString socket_path;
- if (_dbus_check_setuid ())
- {
- dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
- "Unable to find launchd socket when setuid");
- return FALSE;
- }
+// if (_dbus_check_setuid ())
+// {
+// dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+// "Unable to find launchd socket when setuid");
+// return FALSE;
+// }
if (!_dbus_string_init (&socket_path))
{