From f148d094877275d641ff458097b402f14a1fa273 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 11 Dec 2017 11:39:34 +0900 Subject: [PATCH] Convert d-bus interface name to hexa string - Special letters such as '-' and '+' are not allowed as d-bus interface name Change-Id: I5c74bdef4321e83ed8e13410fe4b9a19b8c69d1e Signed-off-by: Junghoon Park --- CMakeLists.txt | 2 +- packaging/rpc-port.spec | 1 - src/fdbroker-internal.cc | 12 ++++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c183bc..a9527d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/src ) -SET(${this_target}_requires "dlog bundle glib-2.0 gio-2.0 aul openssl capi-base-common pkgmgr-info gio-unix-2.0") +SET(${this_target}_requires "dlog bundle glib-2.0 gio-2.0 aul capi-base-common pkgmgr-info gio-unix-2.0") INCLUDE(FindPkgConfig) pkg_check_modules(${this_target} REQUIRED ${${this_target}_requires}) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 18b8126..282fc9d 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -13,7 +13,6 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(pkgmgr-info) -BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(gmock) Requires(post): /sbin/ldconfig diff --git a/src/fdbroker-internal.cc b/src/fdbroker-internal.cc index b65bdb6..77ecf6f 100644 --- a/src/fdbroker-internal.cc +++ b/src/fdbroker-internal.cc @@ -196,12 +196,16 @@ FdBroker::~FdBroker() { std::string FdBroker::GetInterfaceName(const std::string& target_appid, const std::string& port_name) { - std::string interface_name = RPC_PORT_INTERFACE_PREFIX; + std::string interface_name = target_appid + "_" + port_name; + char c_buf[interface_name.length() * 2 + 1] = {0}; + char* temp = &c_buf[0]; - interface_name += target_appid; - interface_name += "_" + port_name; + for (int index = 0; index < interface_name.length(); index++) { + snprintf(temp, 3, "%02x", interface_name[index]); + temp += 2; + } - return interface_name; + return RPC_PORT_INTERFACE_PREFIX + std::string(c_buf); } int FdBroker::Send(const std::string& target_appid, -- 2.7.4