25 #include "dbus-internals.h"
26 #include "dbus-server-unix.h"
27 #include "dbus-server-socket.h"
28 #include "dbus-server-launchd.h"
29 #include "dbus-transport-unix.h"
30 #include "dbus-connection-internal.h"
31 #include "dbus-sysdeps-unix.h"
32 #include "dbus-string.h"
53 DBusServerListenResult
64 if (strcmp (method,
"unix") == 0)
71 int mutually_exclusive_modes = 0;
73 mutually_exclusive_modes = (path !=
NULL) + (tmpdir !=
NULL) +
76 if (mutually_exclusive_modes < 1)
79 "path or tmpdir or abstract or runtime or dir",
81 return DBUS_SERVER_LISTEN_BAD_ADDRESS;
84 if (mutually_exclusive_modes > 1)
87 "cannot specify two of \"path\", \"tmpdir\", \"abstract\", \"runtime\" and \"dir\" at the same time");
88 return DBUS_SERVER_LISTEN_BAD_ADDRESS;
95 const char *runtimedir;
97 if (strcmp (runtime,
"yes") != 0)
100 "if given, the only value allowed for \"runtime\" is \"yes\"");
101 return DBUS_SERVER_LISTEN_BAD_ADDRESS;
106 if (runtimedir ==
NULL)
110 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
117 _DBUS_SET_OOM (error);
118 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
125 _DBUS_SET_OOM (error);
126 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
138 else if (tmpdir !=
NULL || dir !=
NULL)
159 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
166 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
174 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
181 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
190 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
209 if (*server_p !=
NULL)
211 _DBUS_ASSERT_ERROR_IS_CLEAR(error);
212 return DBUS_SERVER_LISTEN_OK;
216 _DBUS_ASSERT_ERROR_IS_SET(error);
217 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
220 else if (strcmp (method,
"systemd") == 0)
229 _DBUS_ASSERT_ERROR_IS_SET (error);
230 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
236 for (i = 0; i < n; i++)
248 if (*server_p ==
NULL)
254 return DBUS_SERVER_LISTEN_OK;
257 _DBUS_SET_OOM (error);
259 for (i = 0; i < n; i++)
266 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
268 #ifdef DBUS_ENABLE_LAUNCHD
269 else if (strcmp (method,
"launchd") == 0)
272 if (launchd_env_var ==
NULL)
275 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
279 if (*server_p !=
NULL)
281 _DBUS_ASSERT_ERROR_IS_CLEAR(error);
282 return DBUS_SERVER_LISTEN_OK;
286 _DBUS_ASSERT_ERROR_IS_SET(error);
287 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
296 _DBUS_ASSERT_ERROR_IS_CLEAR(error);
297 return DBUS_SERVER_LISTEN_NOT_HANDLED;
320 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
346 if (path_copy ==
NULL)
355 if (listen_fd.fd < 0)
357 _DBUS_ASSERT_ERROR_IS_SET (error);
367 if (path_copy !=
NULL)