summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2017-02-15 16:52:10 +0900
committerKyungwook Tak <k.tak@samsung.com>2017-02-16 15:59:31 +0900
commita7eca811f384b4125f81c96e030efb7dc1ff7852 (patch)
tree86973d88460a11c9b9e333c70629c3a6ddfb8e4f
parent8b5c184adca12e32f3fc82008e07affc31888b28 (diff)
downloadpubkey-pinning-accepted/tizen_common.tar.gz
pubkey-pinning-accepted/tizen_common.tar.bz2
pubkey-pinning-accepted/tizen_common.zip
There could be profile which doesn't includes UI framework. For those profile, ui popup module can be excluded easily and it's determined by socket file existance (IO error when socket send) and response will be always 'ALLOW'. For profile who supports UI, ui rpm should be included explicitly (because the dependency to ui rpm isn't explicitly defined) Change-Id: I67576a3f46b1d4c6ed36481cb08594d8ecab35eb Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r--packaging/pubkey-pinning.spec43
-rw-r--r--src/common/ui/popup_runner.cpp12
2 files changed, 38 insertions, 17 deletions
diff --git a/packaging/pubkey-pinning.spec b/packaging/pubkey-pinning.spec
index 3a1829f..19065dc 100644
--- a/packaging/pubkey-pinning.spec
+++ b/packaging/pubkey-pinning.spec
@@ -8,24 +8,12 @@ Group: Security/Libraries
License: Apache-2.0 and BSD-3-Clause and MPL-1.1
Source0: %name-%version.tar.gz
Source1: %name.manifest
-Requires(post): /sbin/ldconfig
-Requires(post): /usr/bin/systemctl
-Requires(postun): /sbin/ldconfig
-Requires(postun): /usr/bin/systemctl
-Requires(preun): /usr/bin/systemctl
BuildRequires: cmake
-BuildRequires: gettext-tools
-BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(libxml-2.0)
-BuildRequires: pkgconfig(libiri)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(gnutls)
BuildRequires: pkgconfig(openssl)
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(libsystemd-daemon)
-BuildRequires: pkgconfig(vconf)
-%{?systemd_requires}
+Requires: /sbin/ldconfig
%description
Https Public Key Pinning for Tizen platform system framework.
@@ -39,6 +27,21 @@ Requires: %name = %version-%release
Tizen HPKP library development files including headers and
pkgconfig.
+%package ui
+Summary: Tizen HPKP ui daemon
+Group: Development/Libraries
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(libsystemd-daemon)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: gettext-tools
+Requires: /usr/bin/systemctl
+Requires: %name = %version-%release
+%{?systemd_requires}
+
+%description ui
+Tizen HPKP ui daemon package.
+
%if 0%{?pubkey_pinning_test_build}
%package test
Summary: Tizen HPKP library internal test
@@ -85,6 +88,9 @@ ln -sf ../%name-popup.socket %buildroot%_unitdir_user/sockets.target.wants/%name
%post
/sbin/ldconfig
+
+%post ui
+/sbin/ldconfig
systemctl daemon-reload
if [ $1 == 1 ]; then
systemctl start %name-popup.socket
@@ -94,7 +100,7 @@ if [ $1 == 2 ]; then
systemctl restart %name-popup.socket
fi
-%preun
+%preun ui
if [ $1 == 0 ]; then
systemctl stop %name-popup.service
systemctl stop %name-popup.socket
@@ -103,9 +109,12 @@ fi
%postun
/sbin/ldconfig
+
+%postun ui
+/sbin/ldconfig
systemctl daemon-reload
-%files -f %{name}.lang
+%files
%manifest %name.manifest
%license LICENSE
%license LICENSE.BSD-3-Clause
@@ -113,6 +122,10 @@ systemctl daemon-reload
%_libdir/libtpkp-common.so.*
%_libdir/libtpkp-curl.so.*
%_libdir/libtpkp-gnutls.so.*
+
+%files ui -f %name.lang
+%manifest %name.manifest
+%license LICENSE
%_unitdir_user/%name-popup.service
%_unitdir_user/%name-popup.socket
%_unitdir_user/sockets.target.wants/%name-popup.socket
diff --git a/src/common/ui/popup_runner.cpp b/src/common/ui/popup_runner.cpp
index 4ada3bd..392b1a4 100644
--- a/src/common/ui/popup_runner.cpp
+++ b/src/common/ui/popup_runner.cpp
@@ -87,12 +87,20 @@ Response runPopup(const std::string &hostname, int timeout) noexcept
// have some(1 second) spare to give change to popup service to timed out.
ServiceConnection connection(SOCK_PATH,
(timeout > 0) ? (timeout + 1000) : timeout);
- BinaryStream outStream = connection.processRequest(inStream);
+ BinaryStream outStream;
+ try {
+ outStream = connection.processRequest(inStream);
+ } catch (const TPKP::Exception &e) {
+ if (e.code() != TPKP_E_IO)
+ throw;
+
+ SLOGI("popup ui process request io error(%s). Popup service may not exist.", e.what());
+ return Response::ALLOW;
+ }
deserialize(pdp, outStream);
return pdp->response;
-
} catch (const TPKP::Exception &e) {
SLOGE("Exception[%d]: %s", e.code(), e.what());
return Response::ERROR;