summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonkyu Kwon <wonkyu.kwon@samsung.com>2013-10-16 13:15:31 +0900
committerJi-hoon Jung <jh8801.jung@samsung.com>2014-04-16 09:46:13 +0900
commit7d5da70551f5bd2733f137986bbb6591debd29a2 (patch)
treee8801b03bdb96bcf5a5e9611f8d5f923eff73fe3
parente45ae0bdfb3f5fe3a8c1d2fa5856703a6159132a (diff)
downloadsmartcard-service-tizen_3.0.m14.3_ivi.tar.gz
smartcard-service-tizen_3.0.m14.3_ivi.tar.bz2
smartcard-service-tizen_3.0.m14.3_ivi.zip
or getting ATR Change-Id: I39ca32471efff9603c6f60cea245d66b564b1c02 Signed-off-by: Ji-hoon Jung <jh8801.jung@samsung.com>
-rw-r--r--packaging/smartcard-service.spec2
-rw-r--r--server/ServerGDBus.cpp15
-rw-r--r--server/ServerResource.cpp27
-rw-r--r--server/ServerSession.cpp12
4 files changed, 44 insertions, 12 deletions
diff --git a/packaging/smartcard-service.spec b/packaging/smartcard-service.spec
index bf21ac6..84e86b9 100644
--- a/packaging/smartcard-service.spec
+++ b/packaging/smartcard-service.spec
@@ -4,7 +4,7 @@
Name: smartcard-service
Summary: Smartcard Service
-Version: 0.1.29
+Version: 0.1.30
Release: 0
Group: Network & Connectivity/Service
License: Apache-2.0
diff --git a/server/ServerGDBus.cpp b/server/ServerGDBus.cpp
index 5f68c03..f0f1b08 100644
--- a/server/ServerGDBus.cpp
+++ b/server/ServerGDBus.cpp
@@ -856,12 +856,19 @@ namespace smartcard_service_api
if (terminal != NULL) {
int rv;
- if ((rv = terminal->getATRSync(resp)) == 0) {
- result = SCARD_ERROR_OK;
+ if (terminal->open() == true) {
+ rv = terminal->getATRSync(resp);
+ if (rv < SCARD_ERROR_OK) {
+ _ERR("getATRSync failed : name [%s], service_id [%d], session_id [%d]", name, service_id, session_id);
+
+ result = rv;
+ }
+
+ terminal->close();
} else {
- _ERR("getATRSync failed : name [%s], service_id [%d], session_id [%d]", name, service_id, session_id);
+ _ERR("terminal->open failed");
- result = rv;
+ result = SCARD_ERROR_UNAVAILABLE;
}
} else {
_ERR("getTerminal failed : name [%s], service_id [%d], session_id [%d]", name, service_id, session_id);
diff --git a/server/ServerResource.cpp b/server/ServerResource.cpp
index 790abdc..9b72607 100644
--- a/server/ServerResource.cpp
+++ b/server/ServerResource.cpp
@@ -336,10 +336,17 @@ namespace smartcard_service_api
session = service->getSession(sessionID);
if (terminal != NULL && session != NULL)
{
- result = _createChannel(terminal, service, channelType, sessionID, aid);
- if (result == IntegerHandle::INVALID_HANDLE)
- {
- _ERR("create channel failed [%d]", sessionID);
+ if (terminal->open() == true) {
+ result = _createChannel(terminal, service, channelType, sessionID, aid);
+ if (result == IntegerHandle::INVALID_HANDLE)
+ {
+ _ERR("create channel failed [%d]", sessionID);
+
+ terminal->close();
+ }
+ } else {
+ _ERR("terminal open failed");
+ throw ExceptionBase(SCARD_ERROR_UNAVAILABLE);
}
}
else
@@ -386,7 +393,19 @@ namespace smartcard_service_api
if ((instance = getService(name, handle)) != NULL)
{
+ ServerChannel *channel;
+ Terminal *terminal = NULL;
+
+ channel = instance->getChannel(channelID);
+ if (channel != NULL) {
+ terminal = channel->getTerminal();
+ }
+
instance->closeChannel(channelID);
+
+ if (terminal != NULL) {
+ terminal->close();
+ }
}
else
{
diff --git a/server/ServerSession.cpp b/server/ServerSession.cpp
index fcbc37a..0c73fe8 100644
--- a/server/ServerSession.cpp
+++ b/server/ServerSession.cpp
@@ -59,10 +59,16 @@ namespace smartcard_service_api
/* call get atr to terminal */
if (atr.isEmpty()) {
if (terminal != NULL) {
- int error = terminal->getATRSync(atr);
+ if (terminal->open() == true) {
+ int error = terminal->getATRSync(atr);
- if (error < SCARD_ERROR_OK) {
- _ERR("getATRSync failed, [%d]", error);
+ if (error < SCARD_ERROR_OK) {
+ _ERR("getATRSync failed, [%d]", error);
+ }
+
+ terminal->close();
+ } else {
+ _ERR("terminal->open failed");
}
} else {
_ERR("terminal is null.");