summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/XmlHandler/PrivilegeHandler.cpp69
-rw-r--r--src/XmlHandler/PrivilegeHandler.h2
2 files changed, 7 insertions, 64 deletions
diff --git a/src/XmlHandler/PrivilegeHandler.cpp b/src/XmlHandler/PrivilegeHandler.cpp
index c4109d3..5f8df2b 100755
--- a/src/XmlHandler/PrivilegeHandler.cpp
+++ b/src/XmlHandler/PrivilegeHandler.cpp
@@ -110,13 +110,9 @@ PrivilegeHandler::PickExternalPrivilege(const IList& fullPrivilegeList, int visi
Integer* pPrivilegeLevel = static_cast<Integer*>(privilegeList.GetValue(*pTempString));
TryReturnResultTag(OSP_INSTALLER, pPrivilegeLevel != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
- // To be removed
- if (visibilityLevel != _API_VISIBILITY_NONE)
- {
- int privilegeLevel = pPrivilegeLevel->ToInt();
- TryReturnResultTag(OSP_INSTALLER, privilegeLevel <= visibilityLevel, E_ILLEGAL_ACCESS, E_ILLEGAL_ACCESS,
- "[E_ILLEGAL_ACCESS] The application does not have the privilege level to register [%ls]", pTempString->GetPointer());
- }
+ int privilegeLevel = pPrivilegeLevel->ToInt();
+ TryReturnResultTag(OSP_INSTALLER, privilegeLevel <= visibilityLevel, E_ILLEGAL_ACCESS, E_ILLEGAL_ACCESS,
+ "[E_ILLEGAL_ACCESS] The application does not have the privilege level to register [%ls]", pTempString->GetPointer());
externalPrivilegeList.Add(new String(*pTempString));
}
@@ -131,56 +127,6 @@ PrivilegeHandler::PickExternalPrivilege(const IList& fullPrivilegeList, int visi
}
result
-PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, String& encryptedPrivileges, String& checksum, IList& stringPrivilegeList)
-{
- result r = E_SUCCESS;
- byte* pBitwisePrivilege = null;
- int count = 0;
- ArrayList normalPrivilegeList;
-
- encryptedPrivileges.Clear();
- checksum.Clear();
- normalPrivilegeList.Construct();
-
- count = privilegeList.GetCount();
- if (count == 0)
- {
- goto CATCH;
- }
-
- r = PickExternalPrivilege(privilegeList, _API_VISIBILITY_NONE, normalPrivilegeList, stringPrivilegeList);
- if (r == E_SUCCESS)
- {
- pBitwisePrivilege = PackPrivilegeN(normalPrivilegeList);
- TryReturnResultTag(OSP_INSTALLER, pBitwisePrivilege != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- }
- else
- {
- AppLog("Working with normal PrivilegeDb.");
- pBitwisePrivilege = PackPrivilegeN(privilegeList);
- TryReturnResultTag(OSP_INSTALLER, pBitwisePrivilege != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- }
-
- r = GetEncryptedBitwise(pBitwisePrivilege, encryptedPrivileges);
- TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
-
- r = GetChecksum(appId, pBitwisePrivilege, checksum);
- TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
-
- // fall through
-
-CATCH:
-
- if (pBitwisePrivilege)
- {
- free(pBitwisePrivilege);
- }
-
- normalPrivilegeList.RemoveAll(true);
- return r;
-}
-
-result
PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, int visibilityLevel, String& encryptedPrivileges, String& checksum, IList& stringPrivilegeList)
{
result r = E_SUCCESS;
@@ -386,13 +332,10 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel
validStringFlag = true;
privilegeEnum = static_cast< int >(privilegeListTable[index].privilege);
- if (visibilityLevel != _API_VISIBILITY_NONE)
+ if (visibilityLevelListTable[privilegeEnum] > visibilityLevel)
{
- if (visibilityLevelListTable[privilegeEnum] > visibilityLevel)
- {
- validLevelFlag = false;
- break;
- }
+ validLevelFlag = false;
+ break;
}
position = privilegeEnum / _BITS_IN_BYTE;
diff --git a/src/XmlHandler/PrivilegeHandler.h b/src/XmlHandler/PrivilegeHandler.h
index e7f022f..2fd1066 100644
--- a/src/XmlHandler/PrivilegeHandler.h
+++ b/src/XmlHandler/PrivilegeHandler.h
@@ -50,8 +50,8 @@ class PrivilegeHandler
{
public:
- static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
+
private:
static byte* PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList);
static result PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, byte** ppBitwisePrivilege);