summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyeonghun Lee <kh9090.lee@samsung.com>2017-06-15 17:16:35 +0900
committerKyeonghun Lee <kh9090.lee@samsung.com>2017-06-15 17:16:35 +0900
commitb4361bf160d46b1bebdc8a8edb90adc8fb0baa86 (patch)
treef5b224d950343d77729fd59c8bc1cc34910f6a7b
parentcc5276a732423b70338afb7d5ea1d027d00204be (diff)
downloadmsg-service-b4361bf160d46b1bebdc8a8edb90adc8fb0baa86.tar.gz
msg-service-b4361bf160d46b1bebdc8a8edb90adc8fb0baa86.tar.bz2
msg-service-b4361bf160d46b1bebdc8a8edb90adc8fb0baa86.zip
add code to check privilege for some APIs
Change-Id: I97c134572e88f045d99b681e1c86f1ba479669b1 Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
-rwxr-xr-xproxy/MsgHandleStorage.cpp79
1 files changed, 40 insertions, 39 deletions
diff --git a/proxy/MsgHandleStorage.cpp b/proxy/MsgHandleStorage.cpp
index e433e60..488ffd6 100755
--- a/proxy/MsgHandleStorage.cpp
+++ b/proxy/MsgHandleStorage.cpp
@@ -892,14 +892,11 @@ msg_error_t MsgHandle::getFolderList(msg_struct_list_s *pFolderList)
msg_error_t MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pThreadViewList)
{
msg_error_t err = MSG_SUCCESS;
- /*
- err = MsgStoConnectDB();
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgStoConnectDB() Error!!");
- return err;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
}
- */
err = MsgStoGetThreadViewListWithCondition(pSortRule, pListCond, pThreadViewList);
if (err != MSG_SUCCESS) {
@@ -907,8 +904,6 @@ msg_error_t MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, const
return err;
}
- /* MsgStoDisconnectDB(); */
-
#if 0
/* Allocate Memory to Command Data */
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SORT_RULE_S);
@@ -955,9 +950,12 @@ msg_error_t MsgHandle::getConversationViewItem(msg_message_id_t MsgId, MSG_CONVE
msg_error_t err = MSG_SUCCESS;
- /* MsgStoConnectDB(); */
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
+ }
+
err = MsgStoGetConversationViewItem(MsgId, pConv);
- /* MsgStoDisconnectDB(); */
return err;
}
@@ -968,12 +966,12 @@ msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_str
msg_error_t err = MSG_SUCCESS;
- /* MsgStoConnectDB(); */
- err = MsgStoGetConversationViewList(ThreadId, pConvViewList);
- /* MsgStoDisconnectDB(); */
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
+ }
- if (err != MSG_SUCCESS)
- return err;
+ err = MsgStoGetConversationViewList(ThreadId, pConvViewList);
MSG_END();
@@ -1264,6 +1262,11 @@ msg_error_t MsgHandle::searchMessage(const char *pSearchString, msg_struct_list_
{
msg_error_t err = MSG_SUCCESS;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
+ }
+
int count = 0;
MSG_ADDRESS_INFO_S *pAddrInfo = NULL;
@@ -1328,14 +1331,12 @@ msg_error_t MsgHandle::searchMessage(const char *pSearchString, msg_struct_list_
msg_error_t MsgHandle::getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList)
{
msg_error_t err = MSG_SUCCESS;
- /*
- err = MsgStoConnectDB();
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgStoConnectDB() Error!!");
- return err;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
}
- */
+
err = MsgStoGetRejectMsgList(pNumber, pRejectMsgList);
if (err != MSG_SUCCESS) {
@@ -1343,8 +1344,6 @@ msg_error_t MsgHandle::getRejectMsgList(const char *pNumber, msg_struct_list_s *
return err;
}
- /* MsgStoDisconnectDB(); */
-
return err;
}
@@ -1517,14 +1516,12 @@ msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_
msg_error_t MsgHandle::getAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList)
{
msg_error_t err = MSG_SUCCESS;
- /*
- err = MsgStoConnectDB();
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgStoConnectDB() Error!!");
- return err;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
}
- */
+
err = MsgStoGetAddressList(threadId, (msg_struct_list_s *)pAddrList);
if (err != MSG_SUCCESS) {
@@ -1532,8 +1529,6 @@ msg_error_t MsgHandle::getAddressList(const msg_thread_id_t threadId, msg_struct
return err;
}
- /* MsgStoDisconnectDB(); */
-
return err;
}
@@ -1680,14 +1675,12 @@ msg_error_t MsgHandle::getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pT
msg_error_t MsgHandle::getMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList)
{
msg_error_t err = MSG_SUCCESS;
- /*
- err = MsgStoConnectDB();
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgStoConnectDB() Error!!");
- return err;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
}
- */
+
int count = 0;
if (pListCond->pAddressVal) {
@@ -1745,8 +1738,6 @@ msg_error_t MsgHandle::getMessageList(const MSG_LIST_CONDITION_S *pListCond, msg
return err;
}
- /* MsgStoDisconnectDB(); */
-
return err;
}
@@ -1755,6 +1746,11 @@ msg_error_t MsgHandle::getMediaList(const msg_thread_id_t thread_id, msg_list_ha
{
msg_error_t err = MSG_SUCCESS;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
+ }
+
err = MsgStoGetMediaList(thread_id, pMediaList);
if (err != MSG_SUCCESS) {
@@ -1951,6 +1947,11 @@ msg_error_t MsgHandle::dbSelectWithQuery(const char *query, char ***db_res, int
{
msg_error_t err = MSG_SUCCESS;
+ if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
+ MSG_ERR("Client doesn't have permission");
+ return MSG_ERR_PERMISSION_DENIED;
+ }
+
err = MsgStoDbSelectWithQuery(query, db_res, row_count, col_count);
if (err != MSG_SUCCESS)