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);
89 _DBUS_ASSERT_ERROR_IS_SET (error);
93 _dbus_verbose (
"Successfully connected to unix socket %s\n",
97 if (transport ==
NULL)
126 _dbus_transport_new_for_exec (
const char *path,
136 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
165 for (i = 0; argv[i]; i++)
190 _DBUS_ASSERT_ERROR_IS_SET (error);
194 _dbus_verbose (
"Successfully connected to process %s\n",
198 if (transport ==
NULL)
224 DBusTransportOpenResult
234 if (strcmp (method,
"unix") == 0)
243 "cannot use the \"tmpdir\" option for an address to connect to, only in an address to listen on");
244 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
247 if (path ==
NULL &&
abstract ==
NULL)
252 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
255 if (path !=
NULL &&
abstract !=
NULL)
258 "can't specify both \"path\" and \"abstract\" options in an address");
259 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
268 if (*transport_p ==
NULL)
270 _DBUS_ASSERT_ERROR_IS_SET (error);
271 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
275 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
276 return DBUS_TRANSPORT_OPEN_OK;
279 else if (strcmp (method,
"unixexec") == 0)
289 "No process path specified");
290 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
298 snprintf (t,
sizeof(t),
"argv%u", i);
309 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
318 snprintf (t,
sizeof(t),
"argv%u", i);
335 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
339 *transport_p = _dbus_transport_new_for_exec (path, argv, error);
342 if (*transport_p ==
NULL)
344 _DBUS_ASSERT_ERROR_IS_SET (error);
345 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
349 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
350 return DBUS_TRANSPORT_OPEN_OK;
353 #ifdef DBUS_ENABLE_LAUNCHD
354 else if (strcmp (method,
"launchd") == 0)
358 const char *launchd_socket;
364 _DBUS_SET_OOM (error);
368 if (launchd_env_var ==
NULL)
371 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
379 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
385 "launchd's env var %s does not exist", launchd_env_var);
388 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
391 launchd_socket = _dbus_string_get_const_data(&socket_path);
394 if (*transport_p ==
NULL)
396 _DBUS_ASSERT_ERROR_IS_SET (error);
397 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
401 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
402 return DBUS_TRANSPORT_OPEN_OK;
408 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
409 return DBUS_TRANSPORT_OPEN_NOT_HANDLED;
415 #ifdef DBUS_BUILD_TESTS
418 _dbus_transport_unix_test (
void)
431 address = _dbus_connection_get_address (c);
435 ret = strcmp (address,
"unixexec:path=/bin/false,argv0=false,argv1=foobar") == 0;