Apply send_destination_prefix policy#1 06/198106/3
authorWootak Jung <wootak.jung@samsung.com>
Mon, 21 Jan 2019 02:13:06 +0000 (11:13 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 21 Jan 2019 05:02:50 +0000 (14:02 +0900)
default deny/allow options are needed for policy checker

Change-Id: I1feac171c04fc7ec8f63a68a9499149d8c5a9528

bt-api/bt-telephony.c
bt-service-adaptation/bluetooth-frwk-service.conf.in

index 673e787..61b6b27 100644 (file)
@@ -50,7 +50,7 @@ typedef struct {
 
 
 char *src_addr = NULL;
-
+guint owner_id = 0;
 
 #define BLUETOOTH_TELEPHONY_ERROR (__bluetooth_telephony_error_quark())
 
@@ -141,8 +141,6 @@ static void __bluetooth_telephony_event_filter(GDBusConnection *connection,
                                                 GVariant *parameters,
                                                 gpointer user_data);
 
-static int __bluetooth_telephony_proxy_init(void);
-static void __bluetooth_telephony_proxy_deinit(void);
 static int __bluetooth_telephony_register(void);
 static int __bluetooth_telephony_unregister(void);
 
@@ -691,6 +689,15 @@ static int __bluetooth_telephony_proxy_init(void)
 {
        FN_START;
        GDBusNodeInfo *node_info;
+       gchar *name;
+
+       name = g_strdup_printf("org.tizen.csd.Call.Instance.p%d", getpid());
+       BT_DBG("well-known name: %s", name);
+
+       owner_id = g_bus_own_name_on_connection(telephony_dbus_info.conn,
+                               name, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+       BT_DBG("owner_id: %d", owner_id);
+       g_free(name);
 
        node_info = __bt_telephony_create_method_node_info(
                                bt_telephony_introspection_xml);
@@ -715,9 +722,9 @@ static void __bluetooth_telephony_proxy_deinit(void)
        FN_START;
 
        __bluetooth_telephony_register_object(FALSE, NULL);
+       g_bus_unown_name(owner_id);
 
        FN_END;
-       return;
 }
 
 static int __bluetooth_telephony_register(void)
@@ -1307,7 +1314,10 @@ BT_EXPORT_API int bluetooth_telephony_init(bt_telephony_func_ptr cb,
 
        is_initialized = TRUE;
 
-       telephony_dbus_info.conn = _bt_gdbus_init_system_gconn();
+       /* As a result of discussion with system team, private connection is not
+        * suitable in here. It is better to use shared connection. */
+       //telephony_dbus_info.conn = _bt_gdbus_init_system_gconn();
+       telephony_dbus_info.conn = _bt_init_system_gdbus_conn();
        if (!telephony_dbus_info.conn) {
                is_initialized = FALSE;
                BT_ERR("Could not get DBus Connection");
index c80bfc8..2cb157d 100644 (file)
@@ -14,8 +14,8 @@
         <allow send_destination="org.bluez.obex"/>
         <allow own="org.projectx.bluetooth.share"/>
         <allow send_destination="org.projectx.bluetooth.share"/>
-        <allow send_interface="org.tizen.csd.Call.Instance" send_member="SendDtmf"/>
-        <allow send_interface="org.tizen.csd.Call.Instance" send_member="VendorCmd"/>
+        <allow send_destination_prefix="org.tizen.csd.Call.Instance" send_interface="org.tizen.csd.Call.Instance" send_member="SendDtmf"/>
+        <allow send_destination_prefix="org.tizen.csd.Call.Instance" send_interface="org.tizen.csd.Call.Instance" send_member="VendorCmd"/>
     </policy>
     <policy context="default">
         <deny own="org.projectx.bt"/>
@@ -28,5 +28,9 @@
         <allow send_destination="org.projectx.bt" send_interface="org.bluez.obex.reply"/>
         <deny own="org.projectx.bluetooth.share"/>
         <deny send_destination="org.projectx.bluetooth.share"/>
+        <deny own_prefix="org.tizen.csd.Call.Instance"/>
+        <allow own_prefix="org.tizen.csd.Call.Instance"/>
+        <deny send_destination_prefix="org.tizen.csd.Call.Instance" send_interface="org.tizen.csd.Call.Instance" send_member="SendDtmf"/>
+        <deny send_destination_prefix="org.tizen.csd.Call.Instance" send_interface="org.tizen.csd.Call.Instance" send_member="VendorCmd"/>
     </policy>
 </busconfig>