diff --git bus/Makefile.am bus/Makefile.am
index 268c6f0..a50ce77 100644
|
|
CONFIG_IN_FILES= \ |
44 | 44 | legacy-config/session.conf.in \ |
45 | 45 | legacy-config/system.conf.in \ |
46 | 46 | org.freedesktop.dbus-session.plist.in \ |
| 47 | org.freedesktop.dbus-system.plist.in \ |
47 | 48 | example-system-enable-stats.conf.in \ |
48 | 49 | example-session-disable-stats.conf.in \ |
49 | 50 | $(NULL) |
… |
… |
examples_DATA = \ |
65 | 66 | if DBUS_ENABLE_LAUNCHD |
66 | 67 | agentdir=$(LAUNCHD_AGENT_DIR) |
67 | 68 | agent_DATA=org.freedesktop.dbus-session.plist |
| 69 | daemondir=$(LAUNCHD_DAEMON_DIR) |
| 70 | daemon_DATA=org.freedesktop.dbus-system.plist |
68 | 71 | endif |
69 | 72 | |
70 | 73 | XML_SOURCES=config-loader-expat.c |
diff --git bus/org.freedesktop.dbus-system.plist.in bus/org.freedesktop.dbus-system.plist.in
new file mode 100644
index 0000000..5af48b5
-
|
+
|
|
| 1 | <?xml version='1.0' encoding='UTF-8'?> |
| 2 | <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" |
| 3 | "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > |
| 4 | <plist version='1.0'> |
| 5 | <dict> |
| 6 | <key>Label</key> |
| 7 | <string>org.freedesktop.dbus-system</string> |
| 8 | <key>ProgramArguments</key> |
| 9 | <array> |
| 10 | <string>@DBUS_DAEMONDIR@/dbus-daemon</string> |
| 11 | <string>--system</string> |
| 12 | <string>--nofork</string> |
| 13 | </array> |
| 14 | <key>KeepAlive</key><true/> |
| 15 | <key>Disabled</key><true/> |
| 16 | <key>Sockets</key> |
| 17 | <dict> |
| 18 | <key>system_bus_socket</key> |
| 19 | <dict> |
| 20 | <key>SockPathName</key> |
| 21 | <string>@DBUS_SYSTEM_SOCKET@</string> |
| 22 | </dict> |
| 23 | </dict> |
| 24 | </dict> |
| 25 | </plist> |
diff --git configure.ac configure.ac
index 460b32b..4f748ca 100644
|
|
LT_LANG([Windows Resource]) |
93 | 93 | # Set some internal variables depending on the platform for later use. |
94 | 94 | dbus_win=no |
95 | 95 | dbus_cygwin=no |
| 96 | dbus_darwin=no |
96 | 97 | dbus_unix=no |
97 | 98 | case "${host}" in |
98 | 99 | *-mingw32ce*) |
… |
… |
case "${host}" in |
106 | 107 | dbus_cygwin=yes |
107 | 108 | dbus_unix=yes |
108 | 109 | ;; |
| 110 | *darwin*) |
| 111 | dbus_darwin=yes |
| 112 | dbus_unix=yes |
| 113 | ;; |
109 | 114 | *) |
110 | 115 | dbus_unix=yes |
111 | 116 | ;; |
… |
… |
fi |
139 | 144 | |
140 | 145 | # For best security, assume that all non-Windows platforms can do |
141 | 146 | # credentials-passing. |
142 | | AS_IF([test "$dbus_win" = yes], |
| 147 | AS_IF([test "$dbus_win" = yes || test "$dbus_darwin" = yes], |
143 | 148 | [DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL="<!--<auth>EXTERNAL</auth>-->"], |
144 | 149 | [DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL="<auth>EXTERNAL</auth>"]) |
145 | 150 | AC_SUBST([DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL]) |
… |
… |
AC_ARG_WITH(system-pid-file, AS_HELP_STRING([--with-system-pid-file=[pidfile]],[ |
196 | 201 | AC_ARG_WITH(system-socket, AS_HELP_STRING([--with-system-socket=[filename]],[UNIX domain socket for systemwide daemon])) |
197 | 202 | AC_ARG_WITH(console-auth-dir, AS_HELP_STRING([--with-console-auth-dir=[dirname]],[directory to check for console ownerhip])) |
198 | 203 | AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filename]],[file whose owner determines current console owner])) |
199 | | AC_ARG_WITH(launchd-agent-dir, AS_HELP_STRING([--with-launchd-agent-dir=[dirname]],[directory to put the launchd agent (default: /Library/LaunchAgents)])) |
| 204 | AC_ARG_WITH(launchd-agent-dir, AS_HELP_STRING([--with-launchd-agent-dir=[dirname]],[directory to put the launchd agent (session bus) (default: /Library/LaunchAgents)])) |
| 205 | AC_ARG_WITH(launchd-daemon-dir, AS_HELP_STRING([--with-launchd-daemon-dir=[dirname]],[directory to put the launchd daemon (system bus) (default: /Library/LaunchDaemons)])) |
200 | 206 | AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)])) |
201 | 207 | AC_ARG_WITH([test_user], |
202 | 208 | [AS_HELP_STRING([--with-test-user=<user>], |
… |
… |
fi |
1139 | 1145 | |
1140 | 1146 | AC_SUBST(LAUNCHD_AGENT_DIR) |
1141 | 1147 | |
| 1148 | #### Directory to place launchd daemon file |
| 1149 | if test "x$with_launchd_daemon_dir" = "x"; then |
| 1150 | LAUNCHD_DAEMON_DIR="/Library/LaunchDaemons" |
| 1151 | else |
| 1152 | LAUNCHD_DAEMON_DIR="$with_launchd_daemon_dir" |
| 1153 | fi |
| 1154 | |
| 1155 | AC_SUBST(LAUNCHD_DAEMON_DIR) |
| 1156 | |
1142 | 1157 | dnl console owner file |
1143 | 1158 | if test x$enable_console_owner_file = xno ; then |
1144 | 1159 | have_console_owner_file=no; |
… |
… |
bus/example-session-disable-stats.conf |
1849 | 1864 | bus/messagebus |
1850 | 1865 | bus/messagebus-config |
1851 | 1866 | bus/org.freedesktop.dbus-session.plist |
| 1867 | bus/org.freedesktop.dbus-system.plist |
1852 | 1868 | bus/rc.messagebus |
1853 | 1869 | bus/dbus.service |
1854 | 1870 | bus/dbus.socket |
… |
… |
echo " |
1938 | 1954 | " |
1939 | 1955 | if test x$have_launchd = xyes; then |
1940 | 1956 | echo " launchd agent dir: ${LAUNCHD_AGENT_DIR}" |
| 1957 | echo " launchd daemon dir: ${LAUNCHD_DAEMON_DIR}" |
1941 | 1958 | fi |
1942 | 1959 | echo |
1943 | 1960 | |
diff --git dbus/dbus-bus.c dbus/dbus-bus.c
index 0fd4831..83bbd0e 100644
|
|
out: |
518 | 524 | _DBUS_ASSERT_ERROR_IS_SET (error); |
519 | 525 | |
520 | 526 | _DBUS_UNLOCK (bus); |
| 527 | #ifdef DBUS_ENABLE_LAUNCHD |
| 528 | _dbus_verbose ("internal_bus_get(type=%d,private=%d) : found and registered connection to %s", |
| 529 | type, private, address); |
| 530 | #endif |
521 | 531 | return connection; |
522 | 532 | } |
523 | 533 | |
diff --git dbus/dbus-sysdeps-unix.c dbus/dbus-sysdeps-unix.c
index 1f964b5..5691c5a 100644
|
|
_dbus_lookup_launchd_socket (DBusString *socket_path, |
3928 | 3928 | |
3929 | 3929 | _DBUS_ASSERT_ERROR_IS_CLEAR (error); |
3930 | 3930 | |
| 3931 | const char *fromEnv = getenv (launchd_env_var); |
| 3932 | dbus_bool_t hasEnvVar = (fromEnv && *fromEnv); |
| 3933 | |
3931 | 3934 | if (_dbus_check_setuid ()) |
3932 | 3935 | { |
3933 | | dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED, |
3934 | | "Unable to find launchd socket when setuid"); |
3935 | | return FALSE; |
3936 | | } |
| 3936 | if (!hasEnvVar) |
| 3937 | { |
| 3938 | dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED, |
| 3939 | "Unable to find launchd socket when setuid"); |
| 3940 | return FALSE; |
| 3941 | } |
3937 | 3942 | |
3938 | | i = 0; |
3939 | | argv[i] = "launchctl"; |
3940 | | ++i; |
3941 | | argv[i] = "getenv"; |
3942 | | ++i; |
3943 | | argv[i] = (char*)launchd_env_var; |
3944 | | ++i; |
3945 | | argv[i] = NULL; |
3946 | | ++i; |
| 3943 | i = 0; |
| 3944 | argv[i] = "launchctl"; |
| 3945 | ++i; |
| 3946 | argv[i] = "getenv"; |
| 3947 | ++i; |
| 3948 | argv[i] = (char*)launchd_env_var; |
| 3949 | ++i; |
| 3950 | argv[i] = NULL; |
| 3951 | ++i; |
3947 | 3952 | |
3948 | | _dbus_assert (i == _DBUS_N_ELEMENTS (argv)); |
| 3953 | _dbus_assert (i == _DBUS_N_ELEMENTS (argv)); |
| 3954 | |
| 3955 | if (!_read_subprocess_line_argv(argv[0], TRUE, argv, socket_path, error) && !hasEnvVar) |
| 3956 | { |
| 3957 | return FALSE; |
| 3958 | } |
| 3959 | else |
| 3960 | { |
| 3961 | // prefer the value obtained from launchctl |
| 3962 | hasEnvVar = FALSE; |
| 3963 | } |
| 3964 | } |
3949 | 3965 | |
3950 | | if (!_read_subprocess_line_argv(argv[0], TRUE, argv, socket_path, error)) |
| 3966 | if (hasEnvVar) |
3951 | 3967 | { |
3952 | | return FALSE; |
| 3968 | _dbus_string_append (socket_path, fromEnv); |
| 3969 | return TRUE; |
3953 | 3970 | } |
3954 | 3971 | |
3955 | 3972 | /* no error, but no result either */ |
… |
… |
_dbus_lookup_session_address_launchd (DBusString *address, DBusError *error) |
3975 | 3992 | dbus_bool_t valid_socket; |
3976 | 3993 | DBusString socket_path; |
3977 | 3994 | |
3978 | | if (_dbus_check_setuid ()) |
3979 | | { |
3980 | | dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED, |
3981 | | "Unable to find launchd socket when setuid"); |
3982 | | return FALSE; |
3983 | | } |
3984 | | |
3985 | 3995 | if (!_dbus_string_init (&socket_path)) |
3986 | 3996 | { |
3987 | 3997 | _DBUS_SET_OOM (error); |