summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2016-02-24 17:33:42 +0900
committerKyungwook Tak <k.tak@samsung.com>2016-02-25 10:41:41 +0900
commita993b52ff6f33f08cf7cfc3ce821cb82232410df (patch)
tree06e923b29f3eeb5f99b2a0b245c927cded36c8d9
parente2a5feda18076a512b9624eef44e4b336afd758f (diff)
downloadpubkey-pinning-a993b52ff6f33f08cf7cfc3ce821cb82232410df.tar.gz
pubkey-pinning-a993b52ff6f33f08cf7cfc3ce821cb82232410df.tar.bz2
pubkey-pinning-a993b52ff6f33f08cf7cfc3ce821cb82232410df.zip
Define unix sock path commonly
Change-Id: Ia965558fb1ec5ea986a923e60283973abd747e5c Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--packaging/pubkey-pinning.spec2
-rw-r--r--src/common/include/ui/connection.h2
-rw-r--r--src/common/ui/popup-bin/popup.cpp4
-rw-r--r--src/common/ui/popup_runner.cpp2
-rw-r--r--systemd/CMakeLists.txt1
-rw-r--r--systemd/pubkey-pinning-popup.socket.in (renamed from systemd/pubkey-pinning-popup.socket)2
7 files changed, 7 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa2510f..dd225f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
ADD_DEFINITIONS("-DPROJECT_NAME=\"${PROJECT_NAME}\"")
+ADD_DEFINITIONS("-DSOCK_PATH=\"${SOCK_PATH}\"")
# compiler warning flags
ADD_DEFINITIONS("-Wall")
diff --git a/packaging/pubkey-pinning.spec b/packaging/pubkey-pinning.spec
index e287e00..88a4653 100644
--- a/packaging/pubkey-pinning.spec
+++ b/packaging/pubkey-pinning.spec
@@ -61,11 +61,13 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
export LDFLAGS+="-Wl,--rpath=%_prefix/lib"
+%global sock_path /tmp/.%name-popup.sock
%{!?build_type:%define build_type "Release"}
%cmake . -DCMAKE_INSTALL_PREFIX=%_prefix \
-DVERSION=%version \
-DINCLUDEDIR=%_includedir \
+ -DSOCK_PATH=%sock_path \
-DCMAKE_BUILD_TYPE=%build_type \
%if 0%{?pubkey_pinning_test_build}
-DPUBKEY_PINNING_TEST_BUILD=1 \
diff --git a/src/common/include/ui/connection.h b/src/common/include/ui/connection.h
index 587d4cd..2b906b3 100644
--- a/src/common/include/ui/connection.h
+++ b/src/common/include/ui/connection.h
@@ -24,8 +24,6 @@
#include "ui/popup_common.h"
-#define TPKP_UI_SOCK_ADDR "/tmp/.tpkp-ui-backend.sock"
-
namespace TPKP {
namespace UI {
diff --git a/src/common/ui/popup-bin/popup.cpp b/src/common/ui/popup-bin/popup.cpp
index b417aad..574ece0 100644
--- a/src/common/ui/popup-bin/popup.cpp
+++ b/src/common/ui/popup-bin/popup.cpp
@@ -41,8 +41,6 @@
#endif
#define LOG_TAG "TPKP_POPUP"
-#define TPKP_UI_SOCK_ADDR "/tmp/.tpkp-ui-backend.sock"
-
using namespace TPKP::UI;
namespace {
@@ -242,7 +240,7 @@ int getSockFromSystemd(void)
int n = sd_listen_fds(0);
for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; ++fd) {
- if (sd_is_socket_unix(fd, SOCK_STREAM, 1, TPKP_UI_SOCK_ADDR, 0) > 0) {
+ if (sd_is_socket_unix(fd, SOCK_STREAM, 1, SOCK_PATH, 0) > 0) {
SLOGD("Get socket from systemd. fd[%d]", fd);
return fd;
}
diff --git a/src/common/ui/popup_runner.cpp b/src/common/ui/popup_runner.cpp
index 7816406..0aa9fe1 100644
--- a/src/common/ui/popup_runner.cpp
+++ b/src/common/ui/popup_runner.cpp
@@ -83,7 +83,7 @@ Response runPopup(const std::string &hostname, int timeout) noexcept
else if (timeout < TIMEOUT_MS_MIN)
timeout = TIMEOUT_MS_MIN;
- ServiceConnection connection(TPKP_UI_SOCK_ADDR, timeout);
+ ServiceConnection connection(SOCK_PATH, timeout);
BinaryStream outStream = connection.processRequest(inStream);
deserialize(pdp, outStream);
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
index 249b1ee..f18d387 100644
--- a/systemd/CMakeLists.txt
+++ b/systemd/CMakeLists.txt
@@ -1,4 +1,5 @@
CONFIGURE_FILE(pubkey-pinning-popup.service.in pubkey-pinning-popup.service @ONLY)
+CONFIGURE_FILE(pubkey-pinning-popup.socket.in pubkey-pinning-popup.socket @ONLY)
INSTALL(
FILES
diff --git a/systemd/pubkey-pinning-popup.socket b/systemd/pubkey-pinning-popup.socket.in
index 9afc063..4c23237 100644
--- a/systemd/pubkey-pinning-popup.socket
+++ b/systemd/pubkey-pinning-popup.socket.in
@@ -1,5 +1,5 @@
[Socket]
-ListenStream=/tmp/.tpkp-ui-backend.sock
+ListenStream=@SOCK_PATH@
SocketMode=0777
Service=pubkey-pinning-popup.service