30#include "dbus-internals.h"
31#include "dbus-connection-internal.h"
32#include "dbus-transport-unix.h"
33#include "dbus-transport-socket.h"
34#include "dbus-transport-protected.h"
35#include "dbus-watch.h"
36#include "dbus-sysdeps-unix.h"
59_dbus_transport_new_for_exec (
const char *path,
69 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
96 for (i = 0; argv[i]; i++)
119 if (!_dbus_socket_is_valid (fd))
121 _DBUS_ASSERT_ERROR_IS_SET (error);
125 _dbus_verbose (
"Successfully connected to process %s\n",
129 if (transport ==
NULL)
140 if (_dbus_socket_is_valid (fd))
148DBusTransportOpenResult
158 if (strcmp (method,
"unixexec") == 0)
168 "No process path specified");
169 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
177 snprintf (t,
sizeof(t),
"argv%u", i);
188 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
197 snprintf (t,
sizeof(t),
"argv%u", i);
214 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
218 *transport_p = _dbus_transport_new_for_exec (path, argv, error);
221 if (*transport_p ==
NULL)
223 _DBUS_ASSERT_ERROR_IS_SET (error);
224 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
228 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
229 return DBUS_TRANSPORT_OPEN_OK;
234 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
235 return DBUS_TRANSPORT_OPEN_NOT_HANDLED;
247DBusTransportOpenResult
252#ifdef DBUS_ENABLE_LAUNCHD
258 if (strcmp (method,
"launchd") == 0)
262 const char *launchd_socket;
264 dbus_bool_t valid_socket;
268 _DBUS_SET_OOM (error);
272 if (launchd_env_var ==
NULL)
275 return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
283 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
289 "launchd's env var %s does not exist", launchd_env_var);
292 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
298 if (*transport_p ==
NULL)
300 _DBUS_ASSERT_ERROR_IS_SET (error);
301 return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
305 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
306 return DBUS_TRANSPORT_OPEN_OK;
312 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
313 return DBUS_TRANSPORT_OPEN_NOT_HANDLED;
void _dbus_set_bad_address(DBusError *error, const char *address_problem_type, const char *address_problem_field, const char *address_problem_other)
Sets DBUS_ERROR_BAD_ADDRESS.
const char * dbus_address_entry_get_method(DBusAddressEntry *entry)
Returns the method string of an address entry.
char * dbus_address_escape_value(const char *value)
Escapes the given string as a value in a key=value pair for a D-Bus address.
const char * dbus_address_entry_get_value(DBusAddressEntry *entry, const char *key)
Returns a value from a key of an entry.
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
void dbus_move_error(DBusError *src, DBusError *dest)
Moves an error src into dest, freeing src and overwriting dest.
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
char * _dbus_strdup(const char *str)
Duplicates a string.
#define NULL
A null pointer, defined appropriately for C or C++.
#define FALSE
Expands to "0".
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0().
void dbus_free_string_array(char **str_array)
Frees a NULL-terminated array of strings.
#define DBUS_ERROR_BAD_ADDRESS
A D-Bus bus address was malformed.
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as _DBUS_STRING_IN...
dbus_bool_t _dbus_string_append_printf(DBusString *str, const char *format,...)
Appends a printf-style formatted string to the DBusString.
const char * _dbus_string_get_const_data(const DBusString *str)
Gets the raw character buffer from a const string.
dbus_bool_t _dbus_lookup_launchd_socket(DBusString *socket_path, const char *launchd_env_var, DBusError *error)
quries launchd for a specific env var which holds the socket path.
dbus_bool_t _dbus_close_socket(DBusSocket *fd, DBusError *error)
Closes a socket and invalidates it.
DBusSocket _dbus_connect_exec(const char *path, char *const argv[], DBusError *error)
Creates a UNIX domain socket and connects it to the specified process to execute.
DBusTransport * _dbus_transport_new_for_socket(DBusSocket fd, const DBusString *server_guid, const DBusString *address)
Creates a new transport for the given socket file descriptor.
DBusTransport * _dbus_transport_new_for_domain_socket(const char *path, dbus_bool_t abstract, DBusError *error)
Creates a new transport for the given Unix domain socket path.
DBusTransportOpenResult _dbus_transport_open_platform_specific(DBusAddressEntry *entry, DBusTransport **transport_p, DBusError *error)
Opens platform specific transport types.
Internals of DBusAddressEntry.
Object representing an exception.
Object representing a transport such as a socket.