summaryrefslogtreecommitdiff
path: root/dbus/dbus-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r--dbus/dbus-connection.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index ee33b6cc..5f3a459f 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -45,6 +45,8 @@
#include "dbus-bus.h"
#include "dbus-marshal-basic.h"
+#include <sys/socket.h>
+
#ifdef DBUS_DISABLE_CHECKS
#define TOOK_LOCK_CHECK(connection)
#define RELEASING_LOCK_CHECK(connection)
@@ -2054,9 +2056,15 @@ _dbus_connection_send_preallocated_and_unlock (DBusConnection *connection,
dbus_uint32_t *client_serial)
{
DBusDispatchStatus status;
+ const char *sender;
HAVE_LOCK_CHECK (connection);
-
+
+ /* Set the sender field */
+ sender = dbus_bus_get_unique_name (connection);
+ if (sender)
+ dbus_message_set_sender (message, sender);
+
_dbus_connection_send_preallocated_unlocked_no_update (connection,
preallocated,
message, client_serial);
@@ -3359,6 +3367,7 @@ dbus_connection_send_with_reply (DBusConnection *connection,
DBusPendingCall *pending;
dbus_int32_t serial = -1;
DBusDispatchStatus status;
+ const char *sender;
_dbus_return_val_if_fail (connection != NULL, FALSE);
_dbus_return_val_if_fail (message != NULL, FALSE);
@@ -3401,6 +3410,11 @@ dbus_connection_send_with_reply (DBusConnection *connection,
return FALSE;
}
+ /* Set the sender field */
+ sender = dbus_bus_get_unique_name (connection);
+ if (sender)
+ dbus_message_set_sender (message, sender);
+
/* Assign a serial to the message */
serial = dbus_message_get_serial (message);
if (serial == 0)
@@ -5439,6 +5453,27 @@ dbus_connection_set_route_peer_messages (DBusConnection *connection,
CONNECTION_UNLOCK (connection);
}
+dbus_bool_t
+dbus_connection_get_peer_address (DBusConnection *connection,
+ void *addr,
+ long *len)
+{
+ dbus_bool_t res;
+ int fd;
+ socklen_t _len = *len;
+
+ _dbus_return_val_if_fail (connection != NULL, FALSE);
+
+ res = _dbus_transport_get_socket_fd (connection->transport, &fd);
+ if (!res)
+ return res;
+
+ res = getpeername(fd, (struct sockaddr *) addr, &_len) == 0;
+ if (res)
+ *len = _len;
+ return res;
+}
+
/**
* Adds a message filter. Filters are handlers that are run on all
* incoming messages, prior to the objects registered with