Fixed getting uid and pid when damoen is compiled with kdbus transport, but sockets are used as transport.
Change-Id: I038920b03a352c44639d09284baa07f336dfd216
Signed-off-by: Radoslaw Pajak <r.pajak@samsung.com>
#include "connection.h"
#include "activation.h"
#include "services.h"
+#include <dbus/dbus-connection.h>
#include <utils.h>
#include <stdlib.h>
_dbus_return_val_if_fail (connection != NULL, FALSE);
_dbus_return_val_if_fail (uid != NULL, FALSE);
- return kdbus_get_unix_user(connection, bus_connection_get_name(connection), uid, NULL);
+ if(bus_context_is_kdbus(bus_connection_get_context (connection)))
+ return kdbus_get_unix_user(connection, bus_connection_get_name(connection), uid, NULL);
+
+ return dbus_connection_get_unix_user_dbus(connection, uid);
}
/**
_dbus_return_val_if_fail (connection != NULL, FALSE);
_dbus_return_val_if_fail (pid != NULL, FALSE);
- return kdbus_get_connection_unix_process_id(connection, bus_connection_get_name(connection), pid, NULL);
+ if(bus_context_is_kdbus(bus_connection_get_context (connection)))
+ return kdbus_get_connection_unix_process_id(connection, bus_connection_get_name(connection), pid, NULL);
+
+ return dbus_connection_get_unix_process_id_dbus(connection, pid);
}
/*
return retval;
}
-#ifndef ENABLE_KDBUS_TRANSPORT
/**
* 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
* @param uid return location for the user ID
* @returns #TRUE if uid is filled in with a valid user ID
*/
+#ifdef ENABLE_KDBUS_TRANSPORT
+dbus_bool_t
+dbus_connection_get_unix_user_dbus (DBusConnection *connection,
+ unsigned long *uid)
+#else
dbus_bool_t
dbus_connection_get_unix_user (DBusConnection *connection,
unsigned long *uid)
+#endif
{
dbus_bool_t result;
* @param pid return location for the process ID
* @returns #TRUE if uid is filled in with a valid process ID
*/
+#ifdef ENABLE_KDBUS_TRANSPORT
+dbus_bool_t
+dbus_connection_get_unix_process_id_dbus (DBusConnection *connection,
+ unsigned long *pid)
+#else
dbus_bool_t
dbus_connection_get_unix_process_id (DBusConnection *connection,
unsigned long *pid)
+#endif
{
dbus_bool_t result;
return result;
}
-#endif
/**
* Gets the ADT audit data of the connection if any.
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
unsigned long *pid);
+#ifdef ENABLE_KDBUS_TRANSPORT
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_unix_user_dbus (DBusConnection *connection,
+ unsigned long *uid);
+DBUS_EXPORT
+dbus_bool_t dbus_connection_get_unix_process_id_dbus (DBusConnection *connection,
+ unsigned long *pid);
+#endif
DBUS_EXPORT
dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
void **data,