Use ima_get_policy() from libimaevm to get policy. 87/21387/1
authorJanusz Kozerski <j.kozerski@samsung.com>
Mon, 28 Apr 2014 12:32:12 +0000 (14:32 +0200)
committerJanusz Kozerski <j.kozerski@samsung.com>
Mon, 19 May 2014 12:13:48 +0000 (14:13 +0200)
Change-Id: I523cf80a35f020c1fe5f9470ed9444158ffe19f6
Signed-off-by: Janusz Kozerski <j.kozerski@samsung.com>
src/im-get-policy.c

index 1d7a8d8..2b6f95e 100644 (file)
@@ -20,6 +20,8 @@
  * @brief
  */
 
+#include <imaevm.h>
+
 #include "im-uigadget.h"
 #include "im-common.h"
 #include "im-get-policy.h"
@@ -110,15 +112,11 @@ void im_get_policy_cb(void *data, Evas_Object *obj, void *event_info)
     char **policy = NULL;
     char *formated_policy = NULL;
 
-    // TODO: Call function from libIMA to get currently loaded policy
-    // int res = ima_get_ima_policy(&policy);
-    // Check error code: if (res) {return;}
-    // Temporary allocation - will be removed when function from libIMA will be used
-    policy = calloc(4, sizeof(char*));
-    policy[0] = strdup("MEASURE something");
-    policy[1] = strdup("MEASUER something else");
-    policy[2] = strdup("DONT_MEASURE file");
-    // ------------
+    int res = ima_get_policy(&policy);
+    LOGD("ima_get_policy returned: %d\n", res);
+    if (res != LIB_SUCCESS) {
+        return;
+    }
 
     formated_policy = _convert_policy((const char *const *const) policy);
     i = 0;