Sync with Tizen 2.4 89/41989/2
authorMu-Woong <muwoong.lee@samsung.com>
Fri, 19 Jun 2015 12:53:30 +0000 (21:53 +0900)
committerMu-Woong <muwoong.lee@samsung.com>
Fri, 19 Jun 2015 13:33:22 +0000 (22:33 +0900)
Change-Id: Ibafb888f85c3d7fe7f85f2baaaf0fa135b7e798d
Signed-off-by: Mu-Woong <muwoong.lee@samsung.com>
packaging/context-service.manifest
src/access_control/peer_creds.cpp
src/access_control/peer_creds.h
src/dbus_server_impl.cpp

index 9ee0705aa740ac2bf033747fb9815c5d306823a9..2e4fdb5e5143b04a170bafd233b54482f4a0a3e0 100644 (file)
                        <smack request="security-server::api-privilege-by-pid" type="w"/>
                        <smack request="vasum::manage" type="rw"/>
                        <smack request="sys-assert::core" type="rwxat"/>
-                       <smack request="system::vconf" type="rwxl"/>
-                       <smack request="system::vconf_system" type="rl"/>
-                       <smack request="system::vconf_inhouse" type="rl"/>
-                       <smack request="system::vconf_multimedia" type="rl"/>
                        <smack request="device::app_logging" type="rw"/>
                        <smack request="device::sys_logging" type="rw"/>
                        <smack request="deviced::display" type="rw"/>
                        <smack request="msg-service" type="rwx"/>
                        <smack request="msg-service::db" type="r"/>
                        <smack request="msg-service::read" type="rw"/>
-                       <smack request="msg-service::vconf" type="r"/>
-                       <smack request="tizen::vconf::message" type="r"/>
                        <smack request="privilege::tizen::message.write" type="rw"/>
                        <smack request="privilege::tizen::message.read" type="rw"/>
                        <smack request="msg-service::write" type="rw"/>
                        <smack request="msg-service::read" type="rw"/>
                        <smack request="app-svc::jump" type="x"/>
-                       <smack request="tizen::vconf::public::r::platform::rw" type="rlw"/>
+                       <smack request="tizen::vconf::message" type="r"/>
+                       <smack request="tizen::vconf::setting::admin" type="rl"/>
+                       <smack request="tizen::vconf::volume::set" type="rl"/>
                </request>
        </define>
        <request>
index afcb70fbede4b19b4b0dd5464d69154c17de4567..e35dcfb7c527876cd49c9212115ba1f6e11066e3 100644 (file)
 #include <types_internal.h>
 #include "peer_creds.h"
 
-std::string ctx::peer_creds::get_smack_label(GDBusConnection *connection, const char *unique_name)
+bool ctx::peer_creds::get(GDBusConnection *connection, const char *unique_name, std::string &smack_label, pid_t &pid)
 {
        gchar *client = NULL;
        int err = cynara_creds_gdbus_get_client(connection, unique_name, CLIENT_METHOD_SMACK, &client);
-       IF_FAIL_RETURN_TAG(err == CYNARA_API_SUCCESS, "", _E, "cynara_creds_gdbus_get_client() failed");
+       IF_FAIL_RETURN_TAG(err == CYNARA_API_SUCCESS, false, _E, "cynara_creds_gdbus_get_client() failed");
 
-       std::string ret = client;
+       smack_label = client;
        g_free(client);
-       return ret;
-}
 
-pid_t ctx::peer_creds::get_pid(GDBusConnection *connection, const char *unique_name)
-{
-       pid_t pid = -1;
-       int err = cynara_creds_gdbus_get_pid(connection, unique_name, &pid);
-       IF_FAIL_RETURN_TAG(err == CYNARA_API_SUCCESS, -1, _E, "cynara_creds_gdbus_get_pid() failed");
+       err = cynara_creds_gdbus_get_pid(connection, unique_name, &pid);
+       IF_FAIL_RETURN_TAG(err == CYNARA_API_SUCCESS, false, _E, "cynara_creds_gdbus_get_pid() failed");
 
-       return pid;
+       return true;
 }
index e2704e5bf15184b42d6a55fdeb6c42ea903f7e00..76b51d4ae4db385d66d9da168cb4fa38f55113a4 100644 (file)
@@ -23,8 +23,7 @@
 
 namespace ctx {
        namespace peer_creds {
-               std::string get_smack_label(GDBusConnection *connection, const char *unique_name);
-               pid_t get_pid(GDBusConnection *connection, const char *unique_name);
+               bool get(GDBusConnection *connection, const char *unique_name, std::string &smack_label, pid_t &pid);
        }
 }      /* namespace ctx */
 
index 93400e7fa2c6ed8fa253d8e5b65b24b08e4624f0..21b10d37bcd74c359e1243ecf92ff00c34ad799a 100644 (file)
@@ -89,16 +89,16 @@ static void handle_request(const char *sender, GVariant *param, GDBusMethodInvoc
                return;
        }
 
-       std::string smack_label = ctx::peer_creds::get_smack_label(dbus_connection, sender);
-       pid_t pid = ctx::peer_creds::get_pid(dbus_connection, sender);
-       const char* zone = ctx::zone_util::get_name_by_pid(pid);
+       std::string smack_label;
+       pid_t pid;
 
-       if (smack_label.empty() || !request->set_peer_creds(smack_label.c_str(), zone)) {
-               g_dbus_method_invocation_return_value(invocation, g_variant_new("(iss)", ERR_OPERATION_FAILED, EMPTY_JSON_OBJECT, EMPTY_JSON_OBJECT));
+       if (ctx::peer_creds::get(dbus_connection, sender, smack_label, pid) &&
+                       request->set_peer_creds(smack_label.c_str(), ctx::zone_util::get_name_by_pid(pid))) {
+               ctx::server::send_request(request);
                return;
        }
 
-       ctx::server::send_request(request);
+       g_dbus_method_invocation_return_value(invocation, g_variant_new("(iss)", ERR_OPERATION_FAILED, EMPTY_JSON_OBJECT, EMPTY_JSON_OBJECT));
 }
 
 static void handle_method_call(GDBusConnection *conn, const gchar *sender,