From dfd031ba086c7a526a2c87634bc7567ce67b9ce9 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Thu, 3 Jan 2019 15:32:01 +0900 Subject: [PATCH] Remove unused file and change spec file Change-Id: Ia83b66e8ca0ae6c903d5a080d8551114bf03cab2 Signed-off-by: Jihoon Jung --- CMakeLists.txt | 8 - debian/changelog | 55 --- debian/compat | 1 - debian/control | 65 --- debian/rules | 33 -- debian/smartcard-service-common-dev.dirs | 2 - debian/smartcard-service-common-dev.install | 5 - debian/smartcard-service-common.dirs | 1 - debian/smartcard-service-common.install | 1 - debian/smartcard-service-dev.dirs | 2 - debian/smartcard-service-dev.install | 5 - debian/smartcard-service-server.dirs | 2 - debian/smartcard-service-server.init | 28 -- debian/smartcard-service-server.install | 2 - debian/smartcard-service.dirs | 1 - debian/smartcard-service.install | 1 - packaging/smartcard-service | 206 ---------- packaging/smartcard-service-common | 206 ---------- packaging/smartcard-service.spec | 106 ++--- server/CMakeLists.txt | 23 +- server/org.tizen.SmartcardService.service | 2 +- server/private/AccessControl.cpp | 593 ---------------------------- server/private/PKCS15CDFACL.cpp | 123 ------ server/private/PKCS15CDFACL.h | 48 --- server/private/access-control-gdbus.xml | 26 -- test-client/CMakeLists.txt | 48 --- test-client/test-client-sync.cpp | 180 --------- test-client/test-client.cpp | 227 ----------- 28 files changed, 30 insertions(+), 1970 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100755 debian/rules delete mode 100644 debian/smartcard-service-common-dev.dirs delete mode 100644 debian/smartcard-service-common-dev.install delete mode 100644 debian/smartcard-service-common.dirs delete mode 100644 debian/smartcard-service-common.install delete mode 100644 debian/smartcard-service-dev.dirs delete mode 100644 debian/smartcard-service-dev.install delete mode 100644 debian/smartcard-service-server.dirs delete mode 100755 debian/smartcard-service-server.init delete mode 100644 debian/smartcard-service-server.install delete mode 100644 debian/smartcard-service.dirs delete mode 100644 debian/smartcard-service.install delete mode 100644 packaging/smartcard-service delete mode 100644 packaging/smartcard-service-common delete mode 100755 server/private/AccessControl.cpp delete mode 100755 server/private/PKCS15CDFACL.cpp delete mode 100644 server/private/PKCS15CDFACL.h delete mode 100755 server/private/access-control-gdbus.xml delete mode 100644 test-client/CMakeLists.txt delete mode 100644 test-client/test-client-sync.cpp delete mode 100644 test-client/test-client.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 643273b..8788307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,6 @@ MESSAGE("build smartcard-service") SET(CMAKE_VERBOSE_MAKEFILE OFF) -IF(DEFINED USE_AUTOSTART) - ADD_DEFINITIONS("-DUSE_AUTOSTART") -ENDIF() - # make string from entire content of byte array ADD_DEFINITIONS("-DTO_STRING_ALL") ADD_DEFINITIONS("-DUSE_CYNARA") @@ -37,7 +33,3 @@ IF(BUILD_GTESTS) ADD_SUBDIRECTORY(gtest) ADD_DEFINITIONS(-DBUILD_GTEST) ENDIF(BUILD_GTESTS) -IF(DEFINED TEST_CLIENT) - ADD_SUBDIRECTORY(test-client) -ENDIF() - diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index c7c2e9a..0000000 --- a/debian/changelog +++ /dev/null @@ -1,55 +0,0 @@ -smartcard-service (0.1.0-3) unstable; urgency=low - - * add an exceptional case when is openning client channel (nfc-manager) - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.1.0-3 - - -- Wonkyu Kwon Fri, 20 Apr 2012 11:00:00 +0900 - -smartcard-service (0.1.0-2) unstable; urgency=low - - * add helpers for openssl and package signature - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.1.0-2 - - -- Wonkyu Kwon Fri, 23 Mar 2012 12:40:00 +0900 - -smartcard-service (0.1.0-1) unstable; urgency=low - - * Upload package - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.1.0-1 - - -- Wonkyu Kwon Wed, 14 Mar 2012 13:30:00 +0900 - -smartcard-service (0.0.0-4) unstable; urgency=low - - * Upload package - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.0.0-4 - - -- Wonkyu Kwon Tue, 13 Mar 2012 13:10:00 +0900 - -smartcard-service (0.0.0-3) unstable; urgency=low - - * namespace and macro name change - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.0.0-3 - - -- Sangsoo Lee Wed, 07 Mar 2012 19:26:46 +0900 - -smartcard-service (0.0.0-2) unstable; urgency=low - - * getChannelCount api add - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.0.0-2 - - -- Sangsoo Lee Thu, 23 Feb 2012 21:10:42 +0900 - -smartcard-service (0.0.0-1) unstable; urgency=low - - * Initial release - * Git: slp/pkgs/s/smartcard-service - * Tag: smartcard-service_0.0.0-1 - - -- Wonkyu Kwon Thu, 31 Jan 2012 00:00:00 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 45a4fb7..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/debian/control b/debian/control deleted file mode 100644 index f0eabd9..0000000 --- a/debian/control +++ /dev/null @@ -1,65 +0,0 @@ -Source: smartcard-service -Priority: extra -Maintainer: Wonkyu Kwon , Sangsoo Lee , Sungjae Lim , Junyong Sim , Sechang Sohn -Build-Depends: debhelper (>= 8.0.0), libglib2.0-dev, libvconf-dev, libsecurity-server-client-dev, dlog-dev, wrt-commons-dev, libaul-1-dev, libssl-dev -#Build-Depends: debhelper (>= 8.0.0), libglib2.0-dev, libvconf-dev, libsecurity-server-client-dev, dlog-dev, libpkcs11-helper1-dev, wrt-commons, libaul-dev, libssl-dev -#Standards-Version: 3.9.2 -Section: mixed -Homepage: -#Vcs-Git: git://git.debian.org/collab-maint/smartcard-service.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/smartcard-service.git;a=summary - -Package: smartcard-service-common -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Common library of Smart card service - Common library of Smart card service - -Package: smartcard-service-common-dev -Section: libdevel -Architecture: any -Depends: smartcard-service-common (= ${binary:Version}) -Description: Common library of Smart card service - Common library of Smart card service - -Package: smartcard-service-common-dbg -Section: debug -Architecture: any -Depends: smartcard-service-common (= ${binary:Version}) -Description: Common library of Smart card service (unstripped) - Common library of Smart card service (unstripped) - -Package: smartcard-service-server -Architecture: any -Depends: smartcard-service-common-dev (= ${binary:Version}) -Description: Main process of Smart card service - Main process of Smart card service - -Package: smartcard-service-server-dbg -Section: debug -Architecture: any -Depends: smartcard-service-server (= ${binary:Version}) -Description: Main process of Smart card service (unstripped) - Main process of Smart card service (unstripped) - -Package: smartcard-service -Section: libs -Architecture: any -Depends: smartcard-service-common-dev (= ${binary:Version}) -Description: User library of Smart card service - User library of Smart card service - -Package: smartcard-service-dev -Section: libdevel -Architecture: any -Depends: smartcard-service (= ${binary:Version}) -Description: User library of Smart card service - User library of Smart card service - -Package: smartcard-service-dbg -Section: debug -Architecture: any -Depends: smartcard-service (= ${binary:Version}) -Description: User library of Smart card service (unstripped) - User library of Smart card service (unstripped) diff --git a/debian/rules b/debian/rules deleted file mode 100755 index d6ef688..0000000 --- a/debian/rules +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -override_dh_auto_build: - - cd $(CMAKE_BINARY_DIR) - dh_auto_build - -override_dh_install: - - mkdir -p $(CURDIR)/debian/tmp/etc/init.d - mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/ - mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/ - - cp -af $(CURDIR)/debian/smartcard-service-server.init $(CURDIR)/debian/tmp/etc/init.d/smartcard-service-server - ln -s ../init.d/smartcard-service-server $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S79smartcard-service-server - ln -s ../init.d/smartcard-service-server $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S79smartcard-service-server - - dh_install - -override_dh_installinit: - -%: - dh $@ - diff --git a/debian/smartcard-service-common-dev.dirs b/debian/smartcard-service-common-dev.dirs deleted file mode 100644 index 4418816..0000000 --- a/debian/smartcard-service-common-dev.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib -usr/include diff --git a/debian/smartcard-service-common-dev.install b/debian/smartcard-service-common-dev.install deleted file mode 100644 index 2d332a5..0000000 --- a/debian/smartcard-service-common-dev.install +++ /dev/null @@ -1,5 +0,0 @@ -usr/include/smartcard-service-common/* -#usr/lib/lib*.a -usr/lib/libsmartcard-service-common.so -usr/lib/pkgconfig/smartcard-service-common.pc -#usr/share/pkgconfig/* diff --git a/debian/smartcard-service-common.dirs b/debian/smartcard-service-common.dirs deleted file mode 100644 index 6845771..0000000 --- a/debian/smartcard-service-common.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/debian/smartcard-service-common.install b/debian/smartcard-service-common.install deleted file mode 100644 index 3b87046..0000000 --- a/debian/smartcard-service-common.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/libsmartcard-service-common.so.* diff --git a/debian/smartcard-service-dev.dirs b/debian/smartcard-service-dev.dirs deleted file mode 100644 index 4418816..0000000 --- a/debian/smartcard-service-dev.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib -usr/include diff --git a/debian/smartcard-service-dev.install b/debian/smartcard-service-dev.install deleted file mode 100644 index a547e24..0000000 --- a/debian/smartcard-service-dev.install +++ /dev/null @@ -1,5 +0,0 @@ -usr/include/smartcard-service/* -#usr/lib/lib*.a -usr/lib/libsmartcard-service.so -usr/lib/pkgconfig/smartcard-service.pc -#usr/share/pkgconfig/* diff --git a/debian/smartcard-service-server.dirs b/debian/smartcard-service-server.dirs deleted file mode 100644 index 2d445a0..0000000 --- a/debian/smartcard-service-server.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -etc \ No newline at end of file diff --git a/debian/smartcard-service-server.init b/debian/smartcard-service-server.init deleted file mode 100755 index ffc409b..0000000 --- a/debian/smartcard-service-server.init +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: smartcard-service-server -# Required-Start: $network $local_fs -# Required-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: -# Description: -# <...> -# <...> -### END INIT INFO - -# Author: Wonkyu Kwon - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/usr/bin -DESC=smartcard-daemon # Introduce a short description here -NAME=smartcard-daemon # Introduce the short server's name here -DAEMON=/usr/bin/smartcard-daemon # Introduce the server's location here -DAEMON_ARGS="" # Arguments to run the daemon with -PIDFILE=/var/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME - -# Exit if the package is not installed -[ -x $DAEMON ] || exit 0 - -$DAEMON $DAEMON_ARGS & \ No newline at end of file diff --git a/debian/smartcard-service-server.install b/debian/smartcard-service-server.install deleted file mode 100644 index 8a71c41..0000000 --- a/debian/smartcard-service-server.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/smartcard-daemon -etc/* \ No newline at end of file diff --git a/debian/smartcard-service.dirs b/debian/smartcard-service.dirs deleted file mode 100644 index 6845771..0000000 --- a/debian/smartcard-service.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/debian/smartcard-service.install b/debian/smartcard-service.install deleted file mode 100644 index 05b76e3..0000000 --- a/debian/smartcard-service.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/libsmartcard-service.so.* diff --git a/packaging/smartcard-service b/packaging/smartcard-service deleted file mode 100644 index ec68963..0000000 --- a/packaging/smartcard-service +++ /dev/null @@ -1,206 +0,0 @@ -Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - diff --git a/packaging/smartcard-service-common b/packaging/smartcard-service-common deleted file mode 100644 index ec68963..0000000 --- a/packaging/smartcard-service-common +++ /dev/null @@ -1,206 +0,0 @@ -Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - - - diff --git a/packaging/smartcard-service.spec b/packaging/smartcard-service.spec index 563a0e2..ec62fb9 100755 --- a/packaging/smartcard-service.spec +++ b/packaging/smartcard-service.spec @@ -1,17 +1,8 @@ -# FOR COMMENTING DEFINITION, MUST USE %% instead of % -%global use_autostart "-DUSE_AUTOSTART=1" -#%%global test_client "-DTEST_CLIENT=1" -%global bindir /usr/apps/%{name} - -################################################################################ -# package : smartcard-service # -################################################################################ Name: smartcard-service Summary: Smartcard Service FW -Version: 0.1.57 +Version: 0.1.58 Release: 0 Group: Network & Connectivity -Requires: %{name}-common = %{version}-%{release} License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake @@ -34,7 +25,6 @@ BuildRequires: python-xml Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig Requires: %{name}-common = %{version}-%{release} -Requires: security-config %if 0%{?gtests:1} BuildRequires: pkgconfig(gmock) @@ -43,37 +33,6 @@ BuildRequires: pkgconfig(gmock) %description Smartcard Service FW. - -%files -%manifest %{name}.manifest -%license LICENSE.APLv2 -%defattr(-,root,root,-) -%{bindir}/bin/smartcard-daemon -%if 0%{?test_client:1} - %{bindir}/bin/smartcard-test-client -%endif -%if 0%{?use_autostart:1} - %{_datadir}/dbus-1/system-services/org.tizen.SmartcardService.service -%endif -%{bindir}/%{name} -/etc/dbus-1/system.d/org.tizen.SmartcardService.conf -%if 0%{?gtests:1} -%{_bindir}/gtest* -%endif - -%post -ln -sf /usr/apps/%{name}/bin/smartcard-daemon /usr/bin/smartcard-daemon -%if 0%{?test_client:1} - ln -sf /usr/apps/%{name}/bin/smartcard-test-client /usr/bin/smartcard-test-client -%endif - -%postun -rm -f /usr/bin/smartcard-daemon - - -################################################################################ -# package : smartcard-service-common # -################################################################################ %package common Summary: common smartcard service Group: Development/Libraries @@ -82,17 +41,6 @@ Group: Development/Libraries %description common common smartcard service. - -%files common -%manifest %{name}-common.manifest -%license LICENSE.APLv2 -%defattr(-,root,root,-) -%{_libdir}/lib%{name}-common.so.* - - -################################################################################ -# package : smartcard-service-common-devel # -################################################################################ %package common-devel Summary: common smartcard service Group: Development/Libraries @@ -102,19 +50,6 @@ Requires: %{name}-common = %{version}-%{release} %description common-devel common smartcard service. - -%files common-devel -%manifest %{name}-common-devel.manifest -%defattr(-,root,root,-) -%{_includedir}/%{name}-common/* -%{_libdir}/lib%{name}-common.so -%{_libdir}/pkgconfig/%{name}-common.pc - -### - -################################################################################ -# common... # -################################################################################ %prep %setup -q @@ -126,24 +61,35 @@ export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" export LDFLAGS+=" -lgcov " %endif -%if 0%{?sec_build_binary_debug_enable} -export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" -export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -%endif -export LDFLAGS+="-Wl,-Bsymbolic-functions" - - -mkdir obj-arm-limux-qnueabi -cd obj-arm-limux-qnueabi -%cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} %{?use_autostart} %{?use_gdbus} %{?test_client} \ - -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \ +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \ -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} %install -cd obj-arm-limux-qnueabi %make_install mkdir -p %{buildroot}/etc/dbus-1/system.d/ -cp -af %{_builddir}/%{name}-%{version}/packaging/%{name} %{buildroot}%{bindir} cp -af %{_builddir}/%{name}-%{version}/packaging/org.tizen.SmartcardService.conf %{buildroot}/etc/dbus-1/system.d/ + +%files +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_bindir}/smartcard-daemon +%{_sysconfdir}/dbus-1/system.d/org.tizen.SmartcardService.conf +%{_datadir}/dbus-1/system-services/org.tizen.SmartcardService.service +%if 0%{?gtests:1} +%{_bindir}/gtest* +%endif +%license LICENSE.APLv2 + +%files common +%manifest %{name}-common.manifest +%defattr(-,root,root,-) +%{_libdir}/lib%{name}-common.so.* +%license LICENSE.APLv2 + +%files common-devel +%manifest %{name}-common-devel.manifest +%defattr(-,root,root,-) +%{_includedir}/%{name}-common/* +%{_libdir}/lib%{name}-common.so +%{_libdir}/pkgconfig/%{name}-common.pc diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 220f833..09cc9b7 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -7,25 +7,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ SRCS) -### for private -ADD_DEFINITIONS("-D__PRIVATE") - IF(BUILD_GTESTS) ADD_DEFINITIONS(-DBUILD_GTEST) ENDIF(BUILD_GTESTS) -FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen) -EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS - " \\ - --generate-c-code ${CMAKE_CURRENT_SOURCE_DIR}/private/access-control-gdbus \\ - --c-namespace SmartcardService\\ - --interface-prefix org.tizen.SmartcardService. \\ - ${CMAKE_CURRENT_SOURCE_DIR}/private/access-control-gdbus.xml \\ - ") - -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/private SRCS) -############## - IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") @@ -63,7 +48,7 @@ IF("${ARCH}" MATCHES "^arm.*") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}") ENDIF() -ADD_DEFINITIONS("-DPREFIX=\"/usr/apps/smartcard-service\"") +ADD_DEFINITIONS("-DPREFIX=\"/usr\"") ADD_DEFINITIONS("-DLOG_TAG=\"SMARTCARD_SERVICE\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") @@ -72,7 +57,5 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-L../common" "-lsmartcard-service-common" "-pie -ldl") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/apps/smartcard-service/bin) -IF("${USE_AUTOSTART}" STREQUAL "1") - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.SmartcardService.service DESTINATION share/dbus-1/system-services) -ENDIF() +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.SmartcardService.service DESTINATION share/dbus-1/system-services) diff --git a/server/org.tizen.SmartcardService.service b/server/org.tizen.SmartcardService.service index 05a886a..e55882e 100644 --- a/server/org.tizen.SmartcardService.service +++ b/server/org.tizen.SmartcardService.service @@ -1,6 +1,6 @@ [D-BUS Service] Name=org.tizen.SmartcardService -Exec=/usr/apps/smartcard-service/bin/smartcard-daemon +Exec=/usr/bin/smartcard-daemon MemoryLimit=10M User=network_fw Group=network_fw diff --git a/server/private/AccessControl.cpp b/server/private/AccessControl.cpp deleted file mode 100755 index ee629cf..0000000 --- a/server/private/AccessControl.cpp +++ /dev/null @@ -1,593 +0,0 @@ -/* - * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. - * - * 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. - */ - -/* standard library header */ -#include -#include -#include - -/* local header */ -#include "Debug.h" -#include "APDUHelper.h" -#include "ServerResource.h" -#include "SignatureHelper.h" -#include "ServerGDBus.h" -#include "PKCS15CDFACL.h" -#include "access-control-gdbus.h" - -using namespace std; -using namespace smartcard_service_api; - -static SmartcardServiceAccessControl *access_control; -static map mapGranted; -static PKCS15CDFACL cdfAcl; - -static void _load_granted_package_info() -{ - mapGranted.clear(); - - /* TODO : load information form file */ - mapGranted.insert(make_pair("nfc-manager", ByteArray::EMPTY)); -} - -/* LCOV_EXCL_START */ -static gboolean _compare_hash(char *package, ByteArray &hash) -{ - gboolean result = false; - vector hashes; - - /* get certificate hashes by pid */ - if (SignatureHelper::getCertificationHashes(package, hashes) == true) { - vector::iterator item; - - for (item = hashes.begin(); item != hashes.end(); item++) { - if (*item == hash) { - result = true; - break; - } - } - } else { - _ERR("getCertificationHashes failed, [%s]", package); - } - - return result; -} - -static gboolean _check_permission(pid_t pid) -{ -#if (BUILD_GTEST != 0) - return true; -#endif - - gboolean result = false; - char package[1024]; - - if (SignatureHelper::getPackageName(pid, - package, sizeof(package)) == 0) { - map::iterator item; - - item = mapGranted.find(package); - if (item != mapGranted.end()) { - /* TODO : check privilege */ - if (false) { - result = _compare_hash(package, item->second); - } else { - result = true; - } - } - } else { - _ERR("aul_app_get_pkgname_bypid failed"); - } - - return result; -} - -static bool _get_se_name(unsigned int se_type, char *buf, size_t len) -{ - - bool result = false; - - switch ((se_type >> 4) & 0x0F) { - case 1 : - snprintf(buf, len, "SIM%d", (se_type & 0x0F) + 1); - result = true; - break; - - case 2 : - snprintf(buf, len, "eSE"); - result = true; - break; - - default : - break; - } - - return result; -} - -static bool _is_authorized_request(GDBusMethodInvocation *invocation, - const char *rights) -{ - bool result = true; - - return result; -} - -static gboolean __process_is_authorized_nfc_access( - SmartcardServiceAccessControl *object, - GDBusMethodInvocation *invocation, - guint se_type, - const gchar *package, - GVariant *aid, - void *user_data) -{ - bool result = false; - const char *error; - const char *name; - char se[10]; - pid_t pid; - - ByteArray temp; - Terminal *terminal; - vector hashes; - - _INFO("[MSG_IS_AUTHORIZED_NFC_ACCESS]"); - - ServerResource &resource = ServerResource::getInstance(); - - name = g_dbus_method_invocation_get_sender(invocation); - - pid = ServerGDBus::getInstance().getPID(name); - - _INFO("service requested, pid [%d]", pid); - - if (pid < 0) { - error = "invalid pid"; - - _ERR("%s, [%d]", error, pid); - - goto ERR; - } - - /* check process permission */ - if (_check_permission(pid) == false) { - error = "permission denied"; - - _ERR("%s, [%d]", error, pid); - - goto ERR; - } - - /* load secure elements */ - resource.loadSecureElements(); - - if (_get_se_name(se_type, se, sizeof(se)) == false) { - error = "unknown SE type"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - _INFO("SE : [%s]", se); - - terminal = resource.getTerminal(se); - if (terminal == NULL) { - error = "failed getting terminal"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - if (terminal->isSecureElementPresence() == false) { - error = "terminal is not available now"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - /* get certificate hashes */ - if (SignatureHelper::getCertificationHashes(package, hashes) == false) { - error = "failed getting certificates"; - - _ERR("%s, [%s]", error, package); - - goto ERR; - } - - /* convert AID */ - GDBusHelper::convertVariantToByteArray(aid, temp); - - result = resource.isAuthorizedNFCAccess(terminal, temp, hashes); - - /* response to client */ - smartcard_service_access_control_complete_is_authorized_nfc_access( - object, invocation, result); - - return true; - -ERR : - g_dbus_method_invocation_return_dbus_error( - invocation, - "org.tizen.SmartcardService.AccessControl.Error", - error); - - return false; -} - -static void _process_is_authorized_nfc_access(vector ¶ms) -{ - SmartcardServiceAccessControl *object; - GDBusMethodInvocation *invocation; - guint se_type; - gchar *package; - GVariant *aid; - void *user_data; - - if (params.size() != 6) { - _ERR("invalid parameter"); - - return; - } - - object = (SmartcardServiceAccessControl *)params[0]; - invocation = (GDBusMethodInvocation *)params[1]; - se_type = (gulong)params[2]; - package = (gchar *)params[3]; - aid = (GVariant *)params[4]; - user_data = params[5]; - - __process_is_authorized_nfc_access(object, invocation, se_type, - package, aid, user_data); - - g_variant_unref(aid); - - g_free(package); - - g_object_unref(invocation); - g_object_unref(object); - - /* FIXME : disable killing process code */ -// ServerResource::getInstance().finish(); -} - -static gboolean _handle_is_authorized_nfc_access( - SmartcardServiceAccessControl *object, - GDBusMethodInvocation *invocation, - guint se_type, - const gchar *package, - GVariant *aid, - void *user_data) -{ - vector params; - - /* apply user space smack */ - if (_is_authorized_request(invocation, "r") == true) { - g_object_ref(object); - params.push_back((void *)object); - - g_object_ref(invocation); - params.push_back((void *)invocation); - - params.push_back((void *)se_type); - params.push_back((void *)g_strdup(package)); - - g_variant_ref(aid); - params.push_back((void *)aid); - - params.push_back((void *)user_data); - - GDBusDispatcher::getInstance().push( - _process_is_authorized_nfc_access, - params); - } else { - _ERR("access denied"); - - g_dbus_method_invocation_return_dbus_error( - invocation, - "org.tizen.SmartcardService.AccessControl.Error", - "access denied"); - - /* FIXME : disable killing process code */ -// ServerResource::getInstance().finish(); - } - - return true; -} - -static bool __load_cdf_acl(Terminal *terminal) -{ - bool result = false; - ServerResource &resource = ServerResource::getInstance(); - ServerChannel *channel; - - if (terminal == NULL) { - return result; - } - -// if (terminal->open() == SCARD_ERROR_OK) { - channel = resource.createInternalChannel(terminal, 1); - if (channel != NULL) { - int ret; - - ret = cdfAcl.updateACL(channel); - if (ret == 0) { - result = true; - } else { - _ERR("acl is null"); - result = false; - } - - delete channel; - } else { - _ERR("alloc failed"); - } -// -// terminal->close(); -// } else { -// _ERR("terminal open failed"); -// } - - return result; -} - -static gboolean __process_is_authorized_extra_access( - SmartcardServiceAccessControl *object, - GDBusMethodInvocation *invocation, - guint se_type, - const gchar *package, - void *user_data) -{ - bool result = false; - const char *error; - const char *name; - char se[10]; - pid_t pid; - - ByteArray temp; - Terminal *terminal; - vector hashes; - - _INFO("[MSG_IS_AUTHORIZED_EXTRA_ACCESS]"); - - ServerResource &resource = ServerResource::getInstance(); - - name = g_dbus_method_invocation_get_sender(invocation); - - pid = ServerGDBus::getInstance().getPID(name); - - _INFO("service requested, pid [%d]", pid); - - if (pid < 0) { - error = "invalid pid"; - - _ERR("%s, [%d]", error, pid); - - goto ERR; - } - - /* check process permission */ - if (_check_permission(pid) == false) { - error = "permission denied"; - - _ERR("%s, [%d]", error, pid); - - goto ERR; - } - - /* load secure elements */ - resource.loadSecureElements(); - - if (_get_se_name(se_type, se, sizeof(se)) == false) { - error = "unknown SE type"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - _INFO("SE : [%s]", se); - - terminal = resource.getTerminal(se); - if (terminal == NULL) { - error = "failed getting terminal"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - if (terminal->isSecureElementPresence() == false) { - error = "terminal is not available now"; - - _ERR("%s, [%d]", error, se_type); - - goto ERR; - } - - /* get certificate hashes */ - if (SignatureHelper::getCertificationHashes(package, hashes) == false) { - error = "failed getting certificates"; - - _ERR("%s, [%s]", error, package); - - goto ERR; - } - - if ((se_type & 0xF0) == 0x10/* SIM */) { - /* load CDF */ - if (cdfAcl.hasConditions() == false) { - _ERR("cdf rule doesn't be load"); - __load_cdf_acl(terminal); - } - - /* check access */ - result = cdfAcl.isAuthorizedAccess( - AccessControlList::ALL_SE_APPS, hashes); - } else if ((se_type & 0xF0) == 0x20/* eSE */) { - if (terminal->open() == true) { - result = resource.isAuthorizedAccess(terminal, - AccessControlList::ALL_SE_APPS, hashes); - - terminal->close(); - } - } - - /* response to client */ - smartcard_service_access_control_complete_is_authorized_extra_access( - object, invocation, result); - - return true; - -ERR : - g_dbus_method_invocation_return_dbus_error( - invocation, - "org.tizen.SmartcardService.AccessControl.Error", - error); - - return false; -} - -static void _process_is_authorized_extra_access(vector ¶ms) -{ - SmartcardServiceAccessControl *object; - GDBusMethodInvocation *invocation; - guint se_type; - gchar *package; - void *user_data; - - if (params.size() != 5) { - _ERR("invalid parameter"); - - return; - } - - object = (SmartcardServiceAccessControl *)params[0]; - invocation = (GDBusMethodInvocation *)params[1]; - se_type = (gulong)params[2]; - package = (gchar *)params[3]; - user_data = params[4]; - - __process_is_authorized_extra_access(object, invocation, se_type, - package, user_data); - - g_free(package); - - g_object_unref(invocation); - g_object_unref(object); - - /* FIXME : disable killing process code */ -// ServerResource::getInstance().finish(); -} - -static gboolean _handle_is_authorized_extra_access( - SmartcardServiceAccessControl *object, - GDBusMethodInvocation *invocation, - guint se_type, - const gchar *package, - void *user_data) -{ - vector params; - - /* apply user space smack */ - if (_is_authorized_request(invocation, "r") == true) { - g_object_ref(object); - params.push_back((void *)object); - - g_object_ref(invocation); - params.push_back((void *)invocation); - - params.push_back((void *)se_type); - params.push_back((void *)g_strdup(package)); - - params.push_back((void *)user_data); - - GDBusDispatcher::getInstance().push( - _process_is_authorized_extra_access, - params); - } else { - _ERR("access denied"); - - g_dbus_method_invocation_return_dbus_error( - invocation, - "org.tizen.SmartcardService.AccessControl.Error", - "access denied"); - - /* FIXME : disable killing process code */ -// ServerResource::getInstance().finish(); - } - - return true; -} -/* LCOV_EXCL_STOP */ - -static bool _init_access_control(void *connection) -{ - GError *error = NULL; - - access_control = smartcard_service_access_control_skeleton_new(); - - g_signal_connect(access_control, - "handle-is-authorized-nfc-access", - G_CALLBACK(_handle_is_authorized_nfc_access), - NULL); - - g_signal_connect(access_control, - "handle-is-authorized-extra-access", - G_CALLBACK(_handle_is_authorized_extra_access), - NULL); - - if (g_dbus_interface_skeleton_export( - G_DBUS_INTERFACE_SKELETON(access_control), - (GDBusConnection *)connection, - "/org/tizen/SmartcardService/AccessControl", - &error) == false) - { - /* LCOV_EXCL_START */ - _ERR("Can not skeleton_export %s", error->message); - - g_error_free(error); - g_object_unref(access_control); - access_control = NULL; - - return false; - /* LCOV_EXCL_STOP */ - } - - return true; -} - -static void _deinit_access_control() -{ - if (access_control != NULL) { - g_object_unref(access_control); - access_control = NULL; - } -} - -extern "C" bool smartcard_service_init_access_control(void *connection) -{ - _load_granted_package_info(); - - return _init_access_control(connection); -} - -extern "C" void smartcard_service_deinit_access_control() -{ - _deinit_access_control(); -} diff --git a/server/private/PKCS15CDFACL.cpp b/server/private/PKCS15CDFACL.cpp deleted file mode 100755 index 7ecdd59..0000000 --- a/server/private/PKCS15CDFACL.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. - * - * 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. - */ - -/* standard library header */ - -/* SLP library header */ - -/* local header */ -#include "Debug.h" -#include "PKCS15CDFACL.h" -#include "PKCS15ODF.h" -#include "OpensslHelper.h" -#include "AccessCondition.h" - -#ifndef EXTERN_API -#define EXTERN_API __attribute__((visibility("default"))) -#endif - -namespace smartcard_service_api -{ - PKCS15CDFACL::PKCS15CDFACL() : AccessControlList() - { - } - - PKCS15CDFACL::~PKCS15CDFACL() - { - } - - /* LCOV_EXCL_START */ - int PKCS15CDFACL::loadACL(Channel *channel) - { - int result = SCARD_ERROR_OK; - - _BEGIN(); - - if (channel == NULL) - { - return SCARD_ERROR_ILLEGAL_PARAM; - } - - releaseACL(); - - PKCS15 pkcs15(channel); - - result = pkcs15.select(); - if (result >= SCARD_ERROR_OK) - { - PKCS15ODF *odf; - - result = SCARD_ERROR_OK; - - if ((odf = pkcs15.getODF()) != NULL) - { - PKCS15CDF *cdf; - - cdf = odf->getCDF(); - if (cdf != NULL) - { - result = loadRules(channel, cdf); - if (result == SCARD_ERROR_OK) { - printAccessControlList(); - } else { - result = SCARD_ERROR_OK; - } - } else { - _ERR("dodf null, every request will be denied."); - } - } else { - _ERR("odf null, every request will be denied."); - } - } else { - _ERR("failed to open PKCS#15, every request will be denied."); - } - - _END(); - - return result; - } - - int PKCS15CDFACL::loadRules(Channel *channel, PKCS15CDF *cdf) - { - int result = 0; - size_t i; - ByteArray hash; - const CertificateType *type; - AccessCondition condition; - - condition.setAID(AccessControlList::ALL_SE_APPS); - - for (i = 0; i < cdf->getCount(); i++) { - type = cdf->getCertificateType(i); - if(type == NULL) - continue; - - OpensslHelper::digestBuffer("SHA1", type->certificate, hash); - - _INFO("cdf[%zu] = %s", i, hash.toString().c_str()); - - condition.addAccessRule(hash); - } - - pair newItem( - AccessControlList::ALL_SE_APPS, condition); - - mapConditions.insert(newItem); - - return result; - } - /* LCOV_EXCL_STOP */ -} /* namespace smartcard_service_api */ diff --git a/server/private/PKCS15CDFACL.h b/server/private/PKCS15CDFACL.h deleted file mode 100644 index 93c18b9..0000000 --- a/server/private/PKCS15CDFACL.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. - * - * 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. - */ - -#ifndef PKCS15CDFACL_H_ -#define PKCS15CDFACL_H_ - -/* standard library header */ - -/* SLP library header */ - -/* local header */ -#include "smartcard-types.h" -#ifdef __cplusplus -#include "AccessControlList.h" -#include "PKCS15.h" -#endif /* __cplusplus */ - -#ifdef __cplusplus -namespace smartcard_service_api -{ - class PKCS15CDFACL : public AccessControlList - { - private: - int loadRules(Channel *channel, PKCS15CDF *cdf); - - public: - PKCS15CDFACL(); - ~PKCS15CDFACL(); - - int loadACL(Channel *channel); - }; - -} /* namespace smartcard_service_api */ -#endif /* __cplusplus */ -#endif /* PKCS15CDFACL_H_ */ diff --git a/server/private/access-control-gdbus.xml b/server/private/access-control-gdbus.xml deleted file mode 100755 index f5a0c37..0000000 --- a/server/private/access-control-gdbus.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/test-client/CMakeLists.txt b/test-client/CMakeLists.txt deleted file mode 100644 index 51b89db..0000000 --- a/test-client/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -PROJECT(smartcard-test-client CXX) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common/include) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../client/include) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - -#AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ SRCS) -SET(SRCS "${CMAKE_CURRENT_SOURCE_DIR}/test-client-sync.cpp") -#SET(SRCS "${CMAKE_CURRENT_SOURCE_DIR}/test-client.cpp") - -IF("${CMAKE_BUILD_TYPE}" STREQUAL "") - SET(CMAKE_BUILD_TYPE "Release") -ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_test_client REQUIRED glib-2.0 dlog) - -FOREACH(flag ${pkgs_test_client_CFLAGS}) - SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}") -ENDFOREACH(flag) - -MESSAGE("CHECK MODULE in ${PROJECT_NAME} ${pkgs_test_client_LDFLAGS}") - -# this for NFC flag - -SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden -std=c++0x") -SET(ARM_CXXFLAGS "${ARM_CXXLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -FIND_PROGRAM(UNAME NAMES uname) -EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") -IF("${ARCH}" MATCHES "^arm.*") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM_CXXFLAGS}") -ENDIF() - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -#ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-DLOG_TAG=\"SMARTCARD_SERVICE_TEST\"") - -ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_test_client_LDFLAGS} "-L../common" "-lsmartcard-service-common" "-L../client" "-lsmartcard-service" "-pie -ldl") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/apps/smartcard-service/bin) diff --git a/test-client/test-client-sync.cpp b/test-client/test-client-sync.cpp deleted file mode 100644 index 18f547d..0000000 --- a/test-client/test-client-sync.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. - * - * 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. - */ - -#include -#include -#include - -#include "Debug.h" -#include "SEService.h" -#include "Reader.h" -#include "Session.h" -#include "APDUHelper.h" -#include "ClientChannel.h" - -using namespace smartcard_service_api; - -typedef struct _user_context_t -{ - Session *clientSession; - SEServiceHelper *clientService; - Channel *clientChannel; -} -user_context_t; - -/* global variable */ -GMainLoop *loop = NULL; -user_context_t user_context = { 0, }; - -void testCloseCallback(int error, void *userData); -void testTransmitCallback(unsigned char *buffer, unsigned int length, int error, void *userData); -void testOpenChannelCallback(Channel *channel, int error, void *userData); -void testGetATRCallback(unsigned char *atr, unsigned int length, int error, void *userData); -void testCloseSessionCallback(int error, void *userData); -void testOpenSessionCallback(SessionHelper *session, int error, void *userData); -void testConnectedCallback(SEServiceHelper *service, void *context); - -class TestEventHandler : public SEServiceListener -{ - void serviceConnected(SEServiceHelper *service, void *userData) - { - _BEGIN(); - testConnectedCallback(service, userData); - _END(); - } - - void eventHandler(SEServiceHelper *service, char *seName, int event, void *userData) - { - _BEGIN(); - - _INFO("event occurred service [%p], seName[%p], event [%d]", service, seName, event); - - _END(); - } - - void errorHandler(SEServiceHelper *service, int error, void *userData) - { - _BEGIN(); - - _ERR("error occurred service [%p], error [%d]", service, error); - - _END(); - } -}; - -TestEventHandler testEventHandler; - -void testConnectedCallback(SEServiceHelper *service, void *userData) -{ - vector readers; - user_context_t *context = (user_context_t *)userData; - uint8_t buffer[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; -// uint8_t buffer[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; - - _BEGIN(); - - if (service != NULL) { - _DBG("callback called, service [%p]", service); - - context->clientService = service; - - readers = service->getReaders(); - - size_t i; - for (i = 0; i < readers.size(); i++) { - Reader *reader = NULL; - - reader = (Reader *)readers[i]; - - _DBG("reader [%p]", reader); - - Session *session = (Session *)reader->openSessionSync(); - if (session != NULL) { - _DBG("session [%p]", session); - - ByteArray temp; - try - { - temp = session->getATRSync(); - } - catch (...) - { - _ERR("exception...."); - } - _DBG("atr[%d] : %s", temp.size(), temp.toString().c_str()); - - ByteArray aid; - - aid.assign(buffer, sizeof(buffer)); - try - { - ClientChannel *channel = (ClientChannel *)session->openLogicalChannelSync(aid); - if (channel != NULL) { - _DBG("channel [%p]", channel); - ByteArray response; - ByteArray data, command; - int fid = 0x00003150; - - response = channel->getSelectResponse(); - _INFO("response : %s", response.toString().c_str()); - - _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical"); - _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened"); - - data.assign((unsigned char *)&fid, 2); - command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, data); - int error = channel->transmitSync(command, response); - - _INFO("error : %d, response : %s", error, response.toString().c_str()); - - channel->closeSync(); - } else { - _ERR("openLogicalChannelSync failed"); - } - } - catch (...) - { - _ERR("exception...."); - } - - session->closeSync(); - } else { - _ERR("openSessionSync failed"); - } - } - - ((SEService *)service)->shutdownSync(); - } else { - _ERR("service is NULL"); - } - - g_main_loop_quit(loop); - - _END(); -} - -int main(int argv, char *args[]) -{ - SEService *service = new SEService((void *)&user_context, &testEventHandler); - - loop = g_main_new(TRUE); - g_main_loop_run(loop); - - if (service != NULL) - delete service; - - return 0; -} diff --git a/test-client/test-client.cpp b/test-client/test-client.cpp deleted file mode 100644 index 238191b..0000000 --- a/test-client/test-client.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. - * - * 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. - */ - -#include -#include -#include - -#include "Debug.h" -#include "SEService.h" -#include "Reader.h" -#include "Session.h" -#include "APDUHelper.h" - -using namespace smartcard_service_api; - -typedef struct _user_context_t -{ - Session *clientSession; - SEServiceHelper *clientService; - Channel *clientChannel; -} -user_context_t; - -/* global variable */ -GMainLoop *loop = NULL; -user_context_t user_context = { 0, }; - -void testCloseCallback(int error, void *userData); -void testTransmitCallback(unsigned char *buffer, unsigned int length, int error, void *userData); -void testOpenChannelCallback(Channel *channel, int error, void *userData); -void testGetATRCallback(unsigned char *atr, unsigned int length, int error, void *userData); -void testCloseSessionCallback(int error, void *userData); -void testOpenSessionCallback(SessionHelper *session, int error, void *userData); -void testConnectedCallback(SEServiceHelper *service, void *context); - -class TestEventHandler : public SEServiceListener -{ - void serviceConnected(SEServiceHelper *service, void *userData) - { - _BEGIN(); - testConnectedCallback(service, userData); - _END(); - } - - void eventHandler(SEServiceHelper *service, char *seName, int event, void *userData) - { -// user_context_t *context = (user_context_t *)userData; - vector readers; - size_t i; - - _BEGIN(); - - _INFO("event occurred service [%p], seName[%s], event [%d], userData [%p]", service, seName, event, userData); - - readers = service->getReaders(); - - for (i = 0; i < readers.size(); i++) - { - _DBG("Reader[%d] : name [%s], %s", i, readers[i]->getName(), readers[i]->isSecureElementPresent() ? "available" : "unavailable"); - } - - if (event == 1) - { - testConnectedCallback(service, userData); - } - - _END(); - } - - void errorHandler(SEServiceHelper *service, int error, void *userData) - { - _BEGIN(); - - _ERR("error occurred service [%p], error [%d]", service, error); - - _END(); - } -}; - -TestEventHandler testEventHandler; - -void testCloseCallback(int error, void *userData) -{ - user_context_t *context = (user_context_t *)userData; - - _DBG("result [%d], userData [%p]", error, userData); - - context->clientService->shutdown(); -} - -void testTransmitCallback(unsigned char *buffer, unsigned int length, int error, void *userData) -{ - ByteArray response(buffer, length); - user_context_t *context = (user_context_t *)userData; - - _DBG("buffer [%p], length [%d], error [%d], userData [%p]", buffer, length, error, userData); - - context->clientChannel->close(testCloseCallback, userData); -} - -void testOpenChannelCallback(Channel *channel, int error, void *userData) -{ - _DBG("channel [%p]", channel); - - if (error == 0 && channel != NULL) { - ByteArray response; - ByteArray data, command; - int fid = 0x00003150; - user_context_t *context = (user_context_t *)userData; - - context->clientChannel = channel; - - response = channel->getSelectResponse(); - - _INFO("response : %s", response.toString().c_str()); - - _DBG("isBasicChannel() = %s", channel->isBasicChannel() ? "Basic" : "Logical"); - _DBG("isClosed() = %s", channel->isClosed() ? "Closed" : "Opened"); - - data.assign((unsigned char *)&fid, 2); - command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, data); - context->clientChannel->transmit(command, testTransmitCallback, userData); - } else { - _ERR("openBasicChannel failed"); - } -} - -void testGetATRCallback(unsigned char *atr, unsigned int length, int error, void *userData) -{ -// unsigned char MF[] = { 0x3F, 0x00 }; - unsigned char MF[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; - ByteArray aid, result(atr, length); - user_context_t *context = (user_context_t *)userData; - - _DBG("atr[%d] : %s", result.size(), result.toString().c_str()); - - aid.assign(MF, sizeof(MF)); - context->clientSession->openLogicalChannel(aid, testOpenChannelCallback, userData); -} - -void testCloseSessionCallback(int error, void *userData) -{ -} - -void testOpenSessionCallback(SessionHelper *session, int error, void *userData) -{ - _DBG("session [%p]", session); - - if (session != NULL) { - user_context_t *context = (user_context_t *)userData; - - context->clientSession = (Session *)session; - context->clientSession->getATR(testGetATRCallback, userData); - } else { - _ERR("openSession failed"); - } -} - -void testConnectedCallback(SEServiceHelper *service, void *userData) -{ - vector readers; - user_context_t *context = (user_context_t *)userData; - - _BEGIN(); - - if (service != NULL) { - _DBG("callback called, service [%p]", service); - - context->clientService = service; - - readers = service->getReaders(); - - if (readers.size() > 0) { - Reader *reader = NULL; - - reader = (Reader *)readers[0]; - - _DBG("reader [%p]", reader); - - reader->openSession(testOpenSessionCallback, userData); - } else { - _ERR("reader is empty"); - } - } else { - _ERR("service is NULL"); - } - - _END(); -} - -int main(int argv, char *args[]) -{ - SEService *service = NULL; - - try - { - service = new SEService((void *)&user_context, &testEventHandler); - } - catch (...) - { - _ERR("exception raised!!!"); - } - - if (service != NULL) - { - loop = g_main_new(TRUE); - g_main_loop_run(loop); - - if (service != NULL) - delete service; - } - - return 0; -} -- 2.7.4