summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-10-11 07:06:14 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-11-07 07:12:44 (GMT)
commit113ccd0ca92ab8fe8a6e6c2db190cbcbeebe912d (patch)
tree5fd4aa178c6ce5043aa31450eff91bf6c9418acc /src
parent58bd810c3a61593a3c7494f843fc5dfc1d411769 (diff)
downloadconnman-113ccd0ca92ab8fe8a6e6c2db190cbcbeebe912d.zip
connman-113ccd0ca92ab8fe8a6e6c2db190cbcbeebe912d.tar.gz
connman-113ccd0ca92ab8fe8a6e6c2db190cbcbeebe912d.tar.bz2
multi-user: Add function to get dbus user id synchronouslyrefs/changes/11/29711/3
Change-Id: Ic41643e5f8b6e1a28ce00e0456d961fe2de7a7fb
Diffstat (limited to 'src')
-rw-r--r--src/dbus.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/dbus.c b/src/dbus.c
index d80a46c..260cec6 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -524,6 +524,31 @@ err:
return err;
}
+int connman_dbus_get_connection_unix_user_sync(DBusConnection *connection,
+ const char *bus_name,
+ unsigned int *user_id)
+{
+ unsigned long uid;
+ DBusError err;
+
+ dbus_error_init(&err);
+
+ uid = dbus_bus_get_unix_user(connection, bus_name, &err);
+
+ if (uid == (unsigned long)-1) {
+ DBG("Can not get unix user ID!");
+ if (dbus_error_is_set(&err)) {
+ DBG("%s", err.message);
+ dbus_error_free(&err);
+ }
+ return -1;
+ }
+
+ *user_id = (unsigned int)uid;
+
+ return 0;
+}
+
static unsigned char *parse_context(DBusMessage *msg)
{
DBusMessageIter iter, array;