#include <stdlib.h>
#include <FBaseString.h>
-#include <FBaseSysLog.h>
+#include <FBaseLog.h>
#include <FSecCryptoAesCipher.h>
#include <FSecCryptoSha1Hash.h>
#include <FBase_StringConverter.h>
byte* pBitwisePrivilege = null;
int count = 0;
- SysLog(NID_SEC, "Enter.");
-
encryptedPrivileges.Clear();
checksum.Clear();
}
pBitwisePrivilege = PackPrivilegeN(privilegeList);
- SysTryReturnResult(NID_SEC, pBitwisePrivilege != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ TryReturnResultTag(OSP_INSTALLER, pBitwisePrivilege != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
r = GetEncryptedBitwise(pBitwisePrivilege, encryptedPrivileges);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
r = GetChecksum(appId, pBitwisePrivilege, checksum);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
// fall through
free(pBitwisePrivilege);
}
- SysLog(NID_SEC, "Exit.");
return r;
}
byte* pBitwisePrivilege = null;
int count = 0;
- SysLog(NID_SEC, "Enter.");
-
encryptedPrivileges.Clear();
checksum.Clear();
}
r = PackPrivilegeN(privilegeList, visibilityLevel, &pBitwisePrivilege);
- SysTryReturnResult(NID_SEC, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ TryReturnResultTag(OSP_INSTALLER, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
r = GetEncryptedBitwise(pBitwisePrivilege, encryptedPrivileges);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
r = GetChecksum(appId, pBitwisePrivilege, checksum);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
// fall through
free(pBitwisePrivilege);
}
- SysLog(NID_SEC, "Exit.");
return r;
}
byte* pBitwisePrivilege = null;
IEnumerator* pEnum = null;
- SysLog(NID_SEC, "Enter.");
ClearLastResult();
pResult = (byte*) malloc(sizeof(byte) * MAX_BITWISE_PRIV_SIZE);
- SysTryReturn(NID_SEC, pResult != null, null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ TryReturnResultTag(OSP_INSTALLER, pResult != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
memset(pResult, 0, MAX_BITWISE_PRIV_SIZE);
pEnum = privilegeList.GetEnumeratorN();
- SysTryCatch(NID_SEC, pEnum != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatch(pEnum != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
while (pEnum->MoveNext() == E_SUCCESS)
{
if ((pTempString->GetLength()) < (privilegeURI.GetLength()))
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(1): length error[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (Length error): [%ls]", pTempString->GetPointer());
resultFlag = false;
continue;
}
if (!(uriString.Equals(privilegeURI, true)))
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(1): uri error[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (URI error): [%ls]", pTempString->GetPointer());
resultFlag = false;
continue;
}
if (validStringFlag == false)
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(1): validStringFlag is false[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string: [%ls]", pTempString->GetPointer());
resultFlag = false;
}
}
- SysTryCatch(NID_SEC, resultFlag == true, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
+ TryCatchTag(OSP_INSTALLER, resultFlag == true, r = E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
pBitwisePrivilege = pResult;
delete pEnum;
- SysLog(NID_SEC, "Exit.");
return pBitwisePrivilege;
CATCH:
delete pEnum;
free(pResult);
- SysLog(NID_SEC, "Exit.");
+ SetLastResult(r);
+
return null;
}
byte* pResult = null;
IEnumerator* pEnum = null;
- SysLog(NID_SEC, "Enter.");
ClearLastResult();
pResult = (byte*) malloc(sizeof(byte) * MAX_BITWISE_PRIV_SIZE);
- SysTryReturn(NID_SEC, pResult != null, null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ TryReturnResultTag(OSP_INSTALLER, pResult != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
memset(pResult, 0, MAX_BITWISE_PRIV_SIZE);
pEnum = privilegeList.GetEnumeratorN();
- SysTryCatch(NID_SEC, pEnum != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, pEnum != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
while (pEnum->MoveNext() == E_SUCCESS)
{
if ((pTempString->GetLength()) < (privilegeURI.GetLength()))
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(3): length error[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (Length error): [%ls]", pTempString->GetPointer());
resultFlag = false;
continue;
}
if (!(uriString.Equals(privilegeURI, true)))
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(3): uri error[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (URI error): [%ls]", pTempString->GetPointer());
resultFlag = false;
continue;
}
if (validStringFlag == false)
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(3): privilege string error[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string: [%ls]", pTempString->GetPointer());
resultFlag = false;
}
if (validLevelFlag == false)
{
- SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] The application does not have the visibility to register %ls", pTempString->GetPointer());
- AppLog("[Privilege] PackPrivilegeN(3): validLevelFlag is false[%ls]", pTempString->GetPointer());
+ AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] The application does not have the visibility to register [%ls]", pTempString->GetPointer());
resultFlag = false;
}
}
- SysTryCatch(NID_SEC, resultFlag == true, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
+ TryCatchTag(OSP_INSTALLER, resultFlag == true, r = E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
*ppBitwisePrivilege = pResult;
delete pEnum;
- SysLog(NID_SEC, "Exit.");;
return r;
CATCH:
delete pEnum;
free(pResult);
- SysLog(NID_SEC, "Exit.");
return r;
}
result r = E_SUCCESS;
ByteBuffer* pTempBitwisePrivilege = null;
- SysLog(NID_SEC, "Enter.");
-
pTempBitwisePrivilege = new (std::nothrow) ByteBuffer();
- SysTryReturnResult(NID_SEC, pTempBitwisePrivilege != null, E_OUT_OF_MEMORY, "Memory allocation is failed.");
+ TryReturnResultTag(OSP_INSTALLER, pTempBitwisePrivilege != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
r = pTempBitwisePrivilege->Construct(MAX_BITWISE_PRIV_SIZE);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
r = pTempBitwisePrivilege->SetArray(pBitwisePrivilege, 0, MAX_BITWISE_PRIV_SIZE);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
pTempBitwisePrivilege->Flip();
r = StringUtil::EncodeToBase64String(*pTempBitwisePrivilege, encryptedPrivileges);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
// fall through
delete pTempBitwisePrivilege;
- SysLog(NID_SEC, "Exit.");
return r;
}
char* pAppId = null;
pAppId = (char*) _StringConverter::CopyToCharArrayN(appId);
- SysTryCatch(NID_SEC, pAppId != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, pAppId != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
memcpy(tempChecksumString, pAppId, MAX_APP_ID_SIZE);
memcpy(tempChecksumString + MAX_APP_ID_SIZE, pBitwisePrivilege, MAX_BITWISE_PRIV_SIZE);
pAppId = null;
r = input.Construct(MAX_APP_ID_SIZE + MAX_BITWISE_PRIV_SIZE);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
r = input.SetArray(tempChecksumString, 0, MAX_APP_ID_SIZE + MAX_BITWISE_PRIV_SIZE);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
input.Flip();
pHash = new (std::nothrow) Sha1Hash();
- SysTryCatch(NID_SEC, pHash != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
+ TryCatchTag(OSP_INSTALLER, pHash != null, r = E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
pChecksumByteBuffer = pHash->GetHashN(input);
- SysTryCatch(NID_SEC, pChecksumByteBuffer != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, pChecksumByteBuffer != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
r = StringUtil::EncodeToBase64String(*pChecksumByteBuffer, checksum);
- SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+ TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
// fall through