#include "dbus-marshal-basic.h"
#ifdef ENABLE_KDBUS_TRANSPORT
#include "dbus-transport-kdbus.h"
+#include "kdbus-common.h"
#include <stdlib.h>
#endif
return retval;
}
-
/**
* Gets the UNIX user ID of the connection if known. Returns #TRUE if
* the uid is filled in. Always returns #FALSE on non-UNIX platforms
CONNECTION_LOCK (connection);
- if (!_dbus_transport_try_to_authenticate (connection->transport))
- result = FALSE;
+#ifdef ENABLE_KDBUS_TRANSPORT
+ if (_dbus_connection_get_address (connection) != NULL)
+ {
+ if (!strncmp (_dbus_connection_get_address (connection), "kdbus:", strlen("kdbus:")))
+ result = kdbus_connection_get_unix_user (connection, dbus_bus_get_unique_name (connection), uid, NULL);
+ }
else
- result = _dbus_transport_get_unix_user (connection->transport,
- uid);
+#endif
+ {
+ if (!_dbus_transport_try_to_authenticate (connection->transport))
+ result = FALSE;
+ else
+ result = _dbus_transport_get_unix_user (connection->transport,
+ uid);
+ }
#ifdef DBUS_WIN
_dbus_assert (!result);
#endif
-
+
CONNECTION_UNLOCK (connection);
return result;
CONNECTION_LOCK (connection);
- if (!_dbus_transport_try_to_authenticate (connection->transport))
- result = FALSE;
+#ifdef ENABLE_KDBUS_TRANSPORT
+ if (_dbus_connection_get_address (connection) != NULL)
+ {
+ if (!strncmp (_dbus_connection_get_address (connection), "kdbus:", strlen("kdbus:")))
+ result = kdbus_connection_get_unix_process_id (connection, dbus_bus_get_unique_name (connection), pid, NULL);
+ }
else
- result = _dbus_transport_get_unix_process_id (connection->transport,
- pid);
+#endif
+ {
+ if (!_dbus_transport_try_to_authenticate (connection->transport))
+ result = FALSE;
+ else
+ result = _dbus_transport_get_unix_process_id (connection->transport,
+ pid);
+ }
CONNECTION_UNLOCK (connection);