Fix for API: added missing dereference operator in get_policy* functions 66/35066/4 accepted/tizen/tv/20150217.004257 submit/tizen_tv/20150216.113520
authorRafal Krypa <r.krypa@samsung.com>
Fri, 6 Feb 2015 16:42:01 +0000 (17:42 +0100)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 10 Feb 2015 17:21:42 +0000 (09:21 -0800)
policy_entry is an incomplete type, hence the need of three dereference operators

Change-Id: Ib7489e6e0f03419784af01d1a1c4c823791815f7
Signed-off-by: Krzysztof Sasiak <k.sasiak@samsung.com>
src/client/client-security-manager.cpp
src/include/security-manager.h

index 9a32631..4427704 100644 (file)
@@ -687,13 +687,13 @@ int security_manager_policy_update_send(policy_update_req *p_req)
 static inline int security_manager_get_policy_internal(
         SecurityManager::SecurityModuleCall call_type,
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size)
 {
     using namespace SecurityManager;
     MessageBuffer send, recv;
 
-    if (pp_privs_policy == nullptr || p_size == nullptr)
+    if (ppp_privs_policy == nullptr || p_size == nullptr)
         return SECURITY_MANAGER_ERROR_INPUT_PARAM;
 
     return try_catch([&] {
@@ -716,8 +716,10 @@ static inline int security_manager_get_policy_internal(
                 Deserialization::Deserialize(recv, entriesCnt);
                 try {
                     entries = new policy_entry*[entriesCnt]();
-                    for (int i = 0; i < entriesCnt; ++i)
+                    for (int i = 0; i < entriesCnt; ++i) {
+                        entries[i] = new policy_entry;
                         Deserialization::Deserialize(recv, entries[i]);
+                    };
                 } catch (...) {
                     LogError("Error while parsing server response");
                     for (int i = 0; i < entriesCnt; ++i)
@@ -726,7 +728,7 @@ static inline int security_manager_get_policy_internal(
                     return SECURITY_MANAGER_ERROR_UNKNOWN;
                 }
                 *p_size = entriesCnt;
-                pp_privs_policy = entries;
+                *ppp_privs_policy = entries;
                 return SECURITY_MANAGER_SUCCESS;
             }
             case SECURITY_MANAGER_API_ERROR_AUTHENTICATION_FAILED:
@@ -741,28 +743,28 @@ static inline int security_manager_get_policy_internal(
 SECURITY_MANAGER_API
 int security_manager_get_configured_policy_for_admin(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size)
 {
-    return security_manager_get_policy_internal(SecurityModuleCall::GET_CONF_POLICY_ADMIN, p_filter, pp_privs_policy, p_size);
+    return security_manager_get_policy_internal(SecurityModuleCall::GET_CONF_POLICY_ADMIN, p_filter, ppp_privs_policy, p_size);
 }
 
 SECURITY_MANAGER_API
 int security_manager_get_configured_policy_for_self(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size)
 {
-    return security_manager_get_policy_internal(SecurityModuleCall::GET_CONF_POLICY_SELF, p_filter, pp_privs_policy, p_size);
+    return security_manager_get_policy_internal(SecurityModuleCall::GET_CONF_POLICY_SELF, p_filter, ppp_privs_policy, p_size);
 }
 
 SECURITY_MANAGER_API
 int security_manager_get_policy(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size)
 {
-    return security_manager_get_policy_internal(SecurityModuleCall::GET_POLICY, p_filter, pp_privs_policy, p_size);
+    return security_manager_get_policy_internal(SecurityModuleCall::GET_POLICY, p_filter, ppp_privs_policy, p_size);
 };
 
 SECURITY_MANAGER_API
index fa77321..c8c265d 100644 (file)
@@ -631,13 +631,14 @@ int security_manager_policy_update_send(policy_update_req *p_req);
  *            for freeing allocated resources.
  *
  * \param[in]  p_filter        Pointer to filter struct
- * \param[out] pp_privs_policy Pointer handling allocated policy_entry structures array
+ * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
  * \param[out] p_size          Pointer where the size of allocated array will be stored
  * \return API return code or error code
  */
 int security_manager_get_configured_policy_for_admin(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy, size_t *p_size);
+        policy_entry ***ppp_privs_policy,
+        size_t *p_size);
 
 /**
  * \brief Function fetches all privileges that are configured by user in his/her
@@ -648,13 +649,13 @@ int security_manager_get_configured_policy_for_admin(
  *            for freeing allocated resources.
  *
  * \param[in]  p_filter        Pointer to filter struct
- * \param[out] pp_privs_policy Pointer handling allocated policy_entry structures array
+ * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
  * \param[out] p_size          Pointer where the size of allocated array will be stored
  * \return API return code or error code
  */
 int security_manager_get_configured_policy_for_self(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size);
 
 /**
@@ -669,13 +670,13 @@ int security_manager_get_configured_policy_for_self(
  *            for freeing allocated resources.
  *
  * \param[in]  p_filter        Pointer to filter struct
- * \param[out] pp_privs_policy Pointer handling allocated policy_entry structures array
+ * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
  * \param[out] p_size          Pointer where the size of allocated array will be stored
  * \return API return code or error code
  */
 int security_manager_get_policy(
         policy_entry *p_filter,
-        policy_entry **pp_privs_policy,
+        policy_entry ***ppp_privs_policy,
         size_t *p_size);
 
 /**