Split rpm of popup ui service 39/114839/3 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170222.124426 accepted/tizen/ivi/20170222.094722 accepted/tizen/mobile/20170222.094633 accepted/tizen/tv/20170222.094649 accepted/tizen/unified/20170309.033733 accepted/tizen/wearable/20170222.094705 submit/tizen/20170222.022045 submit/tizen_unified/20170308.100409
authorKyungwook Tak <k.tak@samsung.com>
Wed, 15 Feb 2017 07:52:10 +0000 (16:52 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Thu, 16 Feb 2017 06:59:31 +0000 (15:59 +0900)
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>
packaging/pubkey-pinning.spec
src/common/ui/popup_runner.cpp

index 3a1829f..19065dc 100644 (file)
@@ -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
index 4ada3bd..392b1a4 100644 (file)
@@ -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;