From: sangwan.kwon Date: Fri, 28 Jul 2017 07:48:54 +0000 (+0900) Subject: Fix uninstall API policy X-Git-Tag: submit/tizen/20170731.054223^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b274add0f0d1ada57c058406fd9ced9e79cc7ee;p=platform%2Fcore%2Fsecurity%2Ftrust-anchor.git Fix uninstall API policy [AS-IS] - If trust-anchor is never installed and uninstall API is called, return FAILED-status error code. [TO-BE] - If trust-anchor is never installed and uninstall API is called, notify to log as warning and process continue. Change-Id: I2aff6aca3622dba4e7edaa811c5a735c3ffb67c4 Signed-off-by: sangwan.kwon --- diff --git a/src/logic.cpp b/src/logic.cpp index 741a6d5..bada397 100644 --- a/src/logic.cpp +++ b/src/logic.cpp @@ -69,7 +69,7 @@ void Logic::deinit(bool isRollback) const if (customBaseDir.exists()) customBaseDir.remove(true); else if (!isRollback) - throw std::invalid_argument("tanchor is never installed before."); + WARN(SINK, "tanchor is never installed before."); DEBUG(SINK, "Success to deinit[" << this->m_customBasePath << "]"); } diff --git a/tests/test-capi-installer.cpp b/tests/test-capi-installer.cpp index a29f504..2c583c8 100644 --- a/tests/test-capi-installer.cpp +++ b/tests/test-capi-installer.cpp @@ -59,8 +59,8 @@ TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_POSITIVE) TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE); } -TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_NEGATIVE) +TESTCASE(CAPI_TRUST_ANCHOR_UNINSTALL_POSITIVE_WARNING) { int ret = trust_anchor_uninstall(DUMMY_PKG_ID, DUMMY_UID); - TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE); + TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE); } diff --git a/tests/test-installer.cpp b/tests/test-installer.cpp index 2bffbf4..722a3cb 100644 --- a/tests/test-installer.cpp +++ b/tests/test-installer.cpp @@ -71,11 +71,11 @@ TESTCASE(TRUST_ANCHOR_UNINSTALL_POSITIVE) TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE); } -TESTCASE(TRUST_ANCHOR_UNINSTALL_NEGATIVE) +TESTCASE(TRUST_ANCHOR_UNINSTALL_POSITIVE_WARNING) { tanchor::TrustAnchor ta(DUMMY_PKG_ID, DUMMY_UID); int ret = ta.uninstall(); - TEST_EXPECT(false, ret == TRUST_ANCHOR_ERROR_NONE); + TEST_EXPECT(true, ret == TRUST_ANCHOR_ERROR_NONE); } TESTCASE(TRUST_ANCHOR_UNINSTALL_NO_ORIGINAL_CERTS)