Changed obex system dbus to session bus, so that obex can startup on IVI 47/1547/1 submit/trunk/20120821.103500
authorWu Zheng <wu.zheng@intel.com>
Tue, 21 Aug 2012 10:33:09 +0000 (18:33 +0800)
committerWu Zheng <wu.zheng@intel.com>
Tue, 21 Aug 2012 10:33:09 +0000 (18:33 +0800)
client/ftp.c
client/main.c
client/manager.c
client/map.c
client/pbap.c
client/session.c
client/sync.c
client/transfer.c
packaging/obexd.changes
src/manager.c

index 20d363d..336fc26 100644 (file)
@@ -515,11 +515,7 @@ int ftp_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 9ca7656..80f9413 100644 (file)
 #include <glib.h>
 #include <gdbus.h>
 
-#ifdef TIZEN_PATCH
-#include <sys/types.h>
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#endif
 #include "log.h"
 #include "manager.h"
 
@@ -91,49 +85,6 @@ int main(int argc, char *argv[])
 
        g_option_context_free(context);
 
-#ifdef TIZEN_PATCH
-       if (getuid() == 0) {
-               /* current user is 'root' */
-               #define INHOUSE_USER "app"
-               #define INHOUSE_GROUP "app"
-               #define BUFFER_SIZE 200
-
-               char buffer[BUFFER_SIZE] = {0};
-
-               struct group gr;
-               struct group *gr_result;
-               struct passwd pw;
-               struct passwd *pw_result;
-
-               if (getpwnam_r(INHOUSE_USER, &pw, buffer, BUFFER_SIZE, &pw_result) != 0) {
-                   DBG("Failed to find user '%s'.", INHOUSE_USER);
-               }
-
-               memset(buffer, 0x00, BUFFER_SIZE);
-
-               if (getgrnam_r(INHOUSE_GROUP, &gr, buffer, BUFFER_SIZE, &gr_result) != 0) {
-                   DBG("Failed to find group '%s'.", INHOUSE_GROUP);
-               }
-
-               if (pw_result && gr_result) {
-                       DBG("Found user '%s' (UID %lu) and group '%s' (GID %lu).",
-                                   INHOUSE_USER, (unsigned long) pw.pw_uid,
-                                   INHOUSE_GROUP, (unsigned long) gr.gr_gid);
-
-                       if (pw.pw_gid != gr.gr_gid)
-                           DBG("GID of user '%s' and of group '%s' don't match.", INHOUSE_USER, INHOUSE_GROUP);
-
-                       if (initgroups(INHOUSE_USER, gr.gr_gid) != 0)
-                           DBG("Failed to change group list");
-
-                       if(setgid(gr.gr_gid) != 0)
-                               DBG("[ERR] fail to execute setgid().\n");
-
-                       if(setuid(pw.pw_uid) != 0)
-                               DBG("[ERR] fail to execute setuid().\n");
-               }
-       }
-#endif
        event_loop = g_main_loop_new(NULL, FALSE);
 
        __obex_log_init("obex-client", option_debug, !option_stderr);
index 88b0d5c..54fea72 100644 (file)
@@ -632,11 +632,7 @@ int manager_init(void)
 
        dbus_error_init(&derr);
 
-#ifdef TIZEN_PATCH
-       conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, CLIENT_SERVICE, &derr);
-#else
        conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &derr);
-#endif
        if (dbus_error_is_set(&derr) == TRUE) {
                error("%s: %s", derr.name, derr.message);
                dbus_error_free(&derr);
index 5c8deb7..cdd2725 100644 (file)
@@ -248,11 +248,7 @@ int map_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 580f30c..fc19ac8 100644 (file)
@@ -1106,11 +1106,7 @@ int pbap_init(void)
        int err;
 
        DBG("");
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index e9f8d03..395829a 100644 (file)
@@ -806,11 +806,7 @@ struct obc_session *obc_session_create(const char *source,
 
        session->refcount = 1;
        session->channel = channel;
-#ifdef TIZEN_PATCH
-       session->conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        session->conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (session->conn == NULL) {
                session_free(session);
                return NULL;
index 85f792d..7675b23 100644 (file)
@@ -222,11 +222,7 @@ int sync_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 4388529..bd9870d 100644 (file)
@@ -140,7 +140,6 @@ static void obc_transfer_abort(struct obc_transfer *transfer)
        g_obex_cancel_transfer(transfer->xfer);
        transfer->xfer = 0;
 
-#ifndef TIZEN_PATCH
        if (callback) {
                GError *err;
 
@@ -150,7 +149,6 @@ static void obc_transfer_abort(struct obc_transfer *transfer)
                                                        callback->data);
                g_error_free(err);
        }
-#endif
 }
 
 static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
@@ -241,11 +239,7 @@ struct obc_transfer *obc_transfer_register(DBusConnection *conn,
 
        transfer->path = g_strdup_printf("%s/transfer%ju",
                        TRANSFER_BASEPATH, counter++);
-#ifdef TIZEN_PATCH
-       transfer->conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        transfer->conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (transfer->conn == NULL) {
                obc_transfer_free(transfer);
                return NULL;
index 84f9d7f..bb78f09 100644 (file)
@@ -1,3 +1,6 @@
+* Tue Aug 21 2012 - wu zheng <wu.zheng@intel.con> - 0.44
+- Changed system dbus to session bus, so that obex can run on IVI.
+
 * Wed May 30 03:17:39 UTC 2012 - Lin Yang <lin.a.yang@intel.con> - 0.44
 - Clean up spec file for packaging
 
index 3c6bba5..90ccbe2 100644 (file)
@@ -466,12 +466,8 @@ gboolean manager_init(void)
        DBG("");
 
        dbus_error_init(&err);
-#ifdef TIZEN_PATCH
-       connection = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OPENOBEX_SERVICE, &err);
-#else
        connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OPENOBEX_SERVICE,
                                                                        &err);
-#endif
        if (connection == NULL) {
                if (dbus_error_is_set(&err) == TRUE) {
                        fprintf(stderr, "%s\n", err.message);