28 #include "dbus-internals.h"
29 #include "dbus-connection-internal.h"
30 #include "dbus-transport-unix.h"
31 #include "dbus-transport-socket.h"
32 #include "dbus-transport-protected.h"
33 #include "dbus-watch.h"
34 #include "dbus-sysdeps-unix.h"
35 #include "dbus-test.h"
66 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
87 _DBUS_ASSERT_ERROR_IS_SET (error);
91 _dbus_verbose (
"Successfully connected to unix socket %s\n",
95 if (transport ==
NULL)
124 _dbus_transport_new_for_exec (
const char *path,
134 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
161 for (i = 0; argv[i]; i++)
186 _DBUS_ASSERT_ERROR_IS_SET (error);
190 _dbus_verbose (
"Successfully connected to process %s\n",
194 if (transport ==
NULL)
220 DBusTransportOpenResult
230 if (strcmp (method,
"unix") == 0)
239 "cannot use the \"tmpdir\" option for an address to connect to, only in an address to listen on");
240 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
243 if (path ==
NULL &&
abstract ==
NULL)
248 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
251 if (path !=
NULL &&
abstract !=
NULL)
254 "can't specify both \"path\" and \"abstract\" options in an address");
255 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
264 if (*transport_p ==
NULL)
266 _DBUS_ASSERT_ERROR_IS_SET (error);
267 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
271 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
272 return DBUS_TRANSPORT_OPEN_OK;
275 else if (strcmp (method,
"unixexec") == 0)
285 "No process path specified");
286 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
294 snprintf (t,
sizeof(t),
"argv%u", i);
305 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
314 snprintf (t,
sizeof(t),
"argv%u", i);
331 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
335 *transport_p = _dbus_transport_new_for_exec (path, argv, error);
338 if (*transport_p ==
NULL)
340 _DBUS_ASSERT_ERROR_IS_SET (error);
341 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
345 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
346 return DBUS_TRANSPORT_OPEN_OK;
349 #ifdef DBUS_ENABLE_LAUNCHD
350 else if (strcmp (method,
"launchd") == 0)
354 const char *launchd_socket;
360 _DBUS_SET_OOM (error);
364 if (launchd_env_var ==
NULL)
367 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
375 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
381 "launchd's env var %s does not exist", launchd_env_var);
384 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
390 if (*transport_p ==
NULL)
392 _DBUS_ASSERT_ERROR_IS_SET (error);
393 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
397 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
398 return DBUS_TRANSPORT_OPEN_OK;
404 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
405 return DBUS_TRANSPORT_OPEN_NOT_HANDLED;
411 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
414 _dbus_transport_unix_test (
void)
427 address = _dbus_connection_get_address (c);
431 ret = strcmp (address,
"unixexec:path=/bin/false,argv0=false,argv1=foobar") == 0;