From daedde0d3831ee65e5982a9343d573c00b530d1b Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Thu, 17 Oct 2013 15:00:39 +0300 Subject: [PATCH] daemon: aul & pkgmgr-info dependent code enabled aul: Support for getting application id from pid of the connected client. pkgmgr-info: Validating webapp client signatures in case of trusted ports. --- configure.ac | 4 ++-- daemon/dbus-manager.c | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index af11ca1..a2c7b8f 100644 --- a/configure.ac +++ b/configure.ac @@ -27,11 +27,11 @@ PKG_CHECK_MODULES([GIOUNIX],[gio-unix-2.0]) AC_SUBST(GIOUNIX_CFLAGS) AC_SUBST(GIOUINX_LIBS) -#PKG_CHECK_MODULES([AUL], [aul]) +PKG_CHECK_MODULES([AUL], [aul]) AC_SUBST(AUL_CFLAGS) AC_SUBST(AUL_LIBS) -#PKG_CHECK_MODULES([PKGMGRINFO], [pkgmgr-info]) +PKG_CHECK_MODULES([PKGMGRINFO], [pkgmgr-info]) AC_SUBST(PKGMGRINFO_CFLAGS) AC_SUBST(PKGMGRINFO_LIBS) diff --git a/daemon/dbus-manager.c b/daemon/dbus-manager.c index e34f541..d6abf05 100644 --- a/daemon/dbus-manager.c +++ b/daemon/dbus-manager.c @@ -31,6 +31,9 @@ #include "manager.h" #include "utils.h" +#include +#include + G_DEFINE_TYPE (MsgPortDbusManager, msgport_dbus_manager, G_TYPE_OBJECT) #define MSGPORT_DBUS_MANAGER_GET_PRIV(obj) \ @@ -237,13 +240,14 @@ _get_app_id_from_connection (GDBusConnection *connection) return NULL; } -#if 0 - char buffer[255]; - if ((res = aul_app_get_appid_bypid (peer_pid, &buffer, sizeof(buffer))) != AUL_R_OK) { +#if 1 + char app_id[255]; + aul_return_val res; + if ((res = aul_app_get_appid_bypid (peer_pid, app_id, sizeof(app_id))) != AUL_R_OK) { WARN ("Fail to get appid of peer pid '%d', error : %d", peer_pid, res); return NULL; } - else g_strdup (buffer); + else g_strdup (app_id); #else return g_strdup_printf ("%d", peer_pid); #endif @@ -307,8 +311,8 @@ msgport_dbus_manager_get_app_id (MsgPortDbusManager *dbus_manager) gboolean msgport_dbus_manager_validate_peer_certificate (MsgPortDbusManager *dbus_manager, const gchar *peer_app_id) { - //int res ; - //pkgmgrinfo_cert_compare_result_type_e compare_result; + int res ; + pkgmgrinfo_cert_compare_result_type_e compare_result; gboolean is_valid_cert = FALSE; /* check if the source application has no certificate info */ @@ -318,13 +322,14 @@ msgport_dbus_manager_validate_peer_certificate (MsgPortDbusManager *dbus_manager /* check if we have cached status */ if (g_hash_table_contains (dbus_manager->priv->peer_certs, peer_app_id)) return ((gboolean)(glong)g_hash_table_lookup (dbus_manager->priv->peer_certs, peer_app_id)); -#if 0 + if ((res = pkgmgrinfo_pkginfo_compare_app_cert_info (dbus_manager->priv->app_id, - peer_app_id, &compare_result)) != PACKAGE_MANAGER_ERROR_NONE) { + peer_app_id, &compare_result)) != PMINFO_R_OK) { WARN ("Fail to compare certificates of applications('%s', '%s') : error %d", dbus_manager->priv->app_id, peer_app_id, res); return FALSE; } + if (compare_result == PMINFO_CERT_COMPARE_LHS_NO_CERT) { dbus_manager->priv->is_null_cert = TRUE; return TRUE; @@ -332,7 +337,6 @@ msgport_dbus_manager_validate_peer_certificate (MsgPortDbusManager *dbus_manager is_valid_cert = (compare_result == PMINFO_CERT_COMPARE_MATCH) ; g_hash_table_insert (dbus_manager->priv->peer_certs, g_strdup (peer_app_id), (gpointer)is_valid_cert); -#endif return is_valid_cert; } -- 2.7.4