Remove key-manager-listener. 20/56220/4
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Tue, 5 Jan 2016 10:48:56 +0000 (11:48 +0100)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Tue, 12 Jan 2016 11:47:05 +0000 (12:47 +0100)
Change-Id: I5c56ebadc865ff61b18f7fa6235963aa0d3b4376

packaging/key-manager.spec
src/CMakeLists.txt
src/listener/CMakeLists.txt [deleted file]
src/listener/listener-daemon.cpp [deleted file]
systemd/CMakeLists.txt
systemd/central-key-manager-listener.service.in [deleted file]

index 544ecf3..0e2ac04 100644 (file)
@@ -172,7 +172,6 @@ cp tests/encryption-scheme/db/key-7654 %{buildroot}/usr/share/ckm-db-test/key-76
 
 %make_install
 %install_service multi-user.target.wants central-key-manager.service
-%install_service multi-user.target.wants central-key-manager-listener.service
 %install_service sockets.target.wants central-key-manager-api-control.socket
 %install_service sockets.target.wants central-key-manager-api-storage.socket
 %install_service sockets.target.wants central-key-manager-api-ocsp.socket
@@ -230,13 +229,9 @@ fi
 
 %post -n key-manager-listener
 systemctl daemon-reload
-if [ $1 = 1 ]; then
-    # installation
-    systemctl start central-key-manager-listener.service
-fi
 if [ $1 = 2 ]; then
     # update
-    systemctl restart central-key-manager-listener.service
+    systemctl stop central-key-manager-listener.service
 fi
 
 %preun -n key-manager-listener
@@ -285,9 +280,6 @@ fi
 
 %files -n key-manager-listener
 %manifest key-manager-listener.manifest
-%{_bindir}/key-manager-listener
-%{_unitdir}/multi-user.target.wants/central-key-manager-listener.service
-%{_unitdir}/central-key-manager-listener.service
 
 %files -n libkey-manager-common
 %manifest libkey-manager-common.manifest
index 99ace29..4745577 100644 (file)
@@ -231,5 +231,4 @@ INSTALL(FILES
 ################################################################################
 
 ADD_SUBDIRECTORY(manager)
-ADD_SUBDIRECTORY(listener)
 ADD_SUBDIRECTORY(pam_plugin)
diff --git a/src/listener/CMakeLists.txt b/src/listener/CMakeLists.txt
deleted file mode 100644 (file)
index 1518c42..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-PKG_CHECK_MODULES(LISTENER_DEP
-    REQUIRED
-    dlog
-    glib-2.0
-    capi-appfw-package-manager
-    )
-
-SET(LISTENER_SOURCES ${PROJECT_SOURCE_DIR}/src/listener/listener-daemon.cpp)
-
-# fPIE flag is added for ASLR
-SET_SOURCE_FILES_PROPERTIES(
-    ${LISTENER_SOURCES}
-    PROPERTIES
-        COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=hidden -fPIE")
-
-INCLUDE_DIRECTORIES(
-    ${PROJECT_SOURCE_DIR}/src/include
-    ${LISTENER_DEP_INCLUDE_DIRS}
-    )
-
-ADD_EXECUTABLE(${TARGET_LISTENER} ${LISTENER_SOURCES})
-
-# pie flag is added for ASLR
-TARGET_LINK_LIBRARIES(
-    ${TARGET_LISTENER}
-    ${LISTENER_DEP_LIBRARIES}
-    ${TARGET_KEY_MANAGER_CLIENT}
-    ${TARGET_KEY_MANAGER_CONTROL_CLIENT}
-    -pie
-    )
-
-INSTALL(TARGETS ${TARGET_LISTENER} DESTINATION bin)
diff --git a/src/listener/listener-daemon.cpp b/src/listener/listener-daemon.cpp
deleted file mode 100644 (file)
index 92d6ce1..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/*
- * @file        listener-daemon.cpp
- * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- * @version     1.0
- * @brief       Listener daemon handle some events for key-manager.
- */
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <package_manager.h>
-#include <ckm/ckm-control.h>
-#include <ckm/ckm-type.h>
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CKM_LISTENER"
-
-namespace {
-const char* const CKM_LOCK = RUN_DIR "/" SERVICE_NAME "/key-manager.pid";
-};
-
-bool isCkmRunning()
-{
-    int lock = TEMP_FAILURE_RETRY(open(CKM_LOCK, O_RDWR));
-    if (lock == -1)
-        return false;
-
-    int ret = lockf(lock, F_TEST, 0);
-    close(lock);
-
-    // if lock test fails because of an error assume ckm is running
-    return (0 != ret);
-}
-
-void packageUninstalledEventCallback(
-    const char *type,
-    const char *package,
-    package_manager_event_type_e eventType,
-    package_manager_event_state_e eventState,
-    int progress,
-    package_manager_error_e error,
-    void *userData)
-{
-    (void) type;
-    (void) progress;
-    (void) error;
-    (void) userData;
-
-    if (eventType != PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL ||
-            eventState != PACKAGE_MANAGER_EVENT_STATE_STARTED ||
-            package == NULL)
-        return;
-
-    SLOGD("PackageUninstalled Callback. Uninstalation of: %s", package);
-
-    if (!isCkmRunning()) {
-        SLOGE("package uninstall event recieved but ckm isn't running!");
-        return;
-    }
-
-    auto control = CKM::Control::create();
-    int ret = control->removeApplicationData(std::string(package));
-    if (ret != CKM_API_SUCCESS)
-        SLOGE("CKM::Control::removeApplicationData error. ret : %d", ret);
-    else
-        SLOGD("CKM::Control::removeApplicationData success. Uninstallation package : %s", package);
-}
-
-int main(void)
-{
-    SLOGD("Start!");
-
-    GMainLoop *main_loop = g_main_loop_new(NULL, FALSE);
-
-    package_manager_h request;
-    package_manager_create(&request);
-
-    SLOGD("register uninstalledApp event callback start");
-    if (0 != package_manager_set_event_cb(request, packageUninstalledEventCallback, NULL)) {
-        SLOGE("Error in package_manager_set_event_cb");
-        exit(-1);
-    }
-    SLOGD("Ready to listen!");
-    g_main_loop_run(main_loop);
-
-    return 0;
-}
-
index e8f38ad..32b6023 100644 (file)
@@ -1,13 +1,9 @@
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/systemd/central-key-manager.service.in
                ${CMAKE_SOURCE_DIR}/systemd/central-key-manager.service @ONLY)
 
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/systemd/central-key-manager-listener.service.in
-               ${CMAKE_SOURCE_DIR}/systemd/central-key-manager-listener.service @ONLY)
-
 INSTALL(FILES
     ${CMAKE_SOURCE_DIR}/systemd/central-key-manager.service
     ${CMAKE_SOURCE_DIR}/systemd/central-key-manager.target
-    ${CMAKE_SOURCE_DIR}/systemd/central-key-manager-listener.service
     ${CMAKE_SOURCE_DIR}/systemd/central-key-manager-api-control.socket
     ${CMAKE_SOURCE_DIR}/systemd/central-key-manager-api-storage.socket
     ${CMAKE_SOURCE_DIR}/systemd/central-key-manager-api-ocsp.socket
diff --git a/systemd/central-key-manager-listener.service.in b/systemd/central-key-manager-listener.service.in
deleted file mode 100644 (file)
index 2b4e7cd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Start the Central Key Manager Listener
-Requires=dbus.service
-After=central-key-manager.service
-
-[Service]
-User=@USER_NAME@
-Group=@GROUP_NAME@
-SmackProcessLabel=@SMACK_DOMAIN_NAME@
-Type=simple
-ExecStart=/usr/bin/key-manager-listener
-
-[Install]
-WantedBy=multi-user.target