Increase MAX_LOG_COUNT to 15
[platform/upstream/connman.git] / src / dbus.c
old mode 100644 (file)
new mode 100755 (executable)
index 4fa0b36..7172830
@@ -524,6 +524,35 @@ err:
        return err;
 }
 
+int connman_dbus_get_connection_unix_user_sync(DBusConnection *connection,
+                                               const char *bus_name,
+                                               unsigned int *user_id)
+{
+#if defined TIZEN_EXT
+       *user_id = 0;
+#else
+       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;
+#endif
+
+       return 0;
+}
+
 static unsigned char *parse_context(DBusMessage *msg)
 {
        DBusMessageIter iter, array;
@@ -653,6 +682,38 @@ err:
        return err;
 }
 
+void connman_dbus_reply_pending(DBusMessage *pending,
+                                       int error, const char *path)
+{
+       if (pending) {
+               if (error > 0) {
+                       DBusMessage *reply;
+
+                       reply = __connman_error_failed(pending, error);
+                       if (reply)
+                               g_dbus_send_message(connection, reply);
+               } else {
+                       const char *sender;
+
+                       sender = dbus_message_get_interface(pending);
+                       if (!path)
+                               path = dbus_message_get_path(pending);
+
+                       DBG("sender %s path %s", sender, path);
+
+                       if (g_strcmp0(sender, CONNMAN_MANAGER_INTERFACE) == 0)
+                               g_dbus_send_reply(connection, pending,
+                                       DBUS_TYPE_OBJECT_PATH, &path,
+                                                       DBUS_TYPE_INVALID);
+                       else
+                               g_dbus_send_reply(connection, pending,
+                                                       DBUS_TYPE_INVALID);
+               }
+
+               dbus_message_unref(pending);
+       }
+}
+
 DBusConnection *connman_dbus_get_connection(void)
 {
        if (!connection)