#include "im-load-policy.h"
#include "im-get-policy.h"
+// FIXME: For testing/debug purpose only
+// This flag cause that errors from libimaevm will be ignored.
+//#define DO_NOT_CHECK_ERROR
+
static int _ima_state; // 0 for disabled, 1 for enabled
static int _ima_fix_state; // 0 for fix off (ima enabled), 1 for fix on
if (_ima_fix_state == 1) {
ret = ima_set_state(IMA_STATE_FIX);
printf("result of ima_set_state(IMA_STATE_FIX): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
else {
ret = ima_set_state(IMA_STATE_ENABLED);
printf("result of ima_set_state(IMA_STATE_ENABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
_ima_state = 1;
((ItemData_t *)data)->check_status = EINA_TRUE;
else { // Turning off the IMA
ret = ima_set_state(IMA_STATE_DISABLED);
printf("result of ima_set_state(IMA_STATE_DISABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
_ima_state = 0;
((ItemData_t *)data)->check_status = EINA_FALSE;
_ima_disable_all_items(it);
}
-// out:
+#ifndef DO_NOT_CHECK_ERROR
+out:
+#endif
+
elm_genlist_item_update(it);
elm_genlist_item_selected_set(it, EINA_FALSE);
}
if (_ima_state == 1) { // If IMA is enabled then turn on FIX mode
ret = ima_set_state(IMA_STATE_FIX);
printf("result of ima_set_state(FIX): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
// If IMA is disabled then just change the state in UI
_ima_fix_state = 1;
if (_ima_state == 1) {
ret = ima_set_state(IMA_STATE_ENABLED);
printf("result of ima_set_state(IMA_STATE_ENABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
// If IMA is disabled then just change the state in UI
_ima_fix_state = 0;
((ItemData_t *)data)->check_status = EINA_FALSE;
}
-//out:
+#ifndef DO_NOT_CHECK_ERROR
+out:
+#endif
+
elm_genlist_item_selected_set(it, EINA_FALSE);
elm_genlist_item_update(it);
}
// ------------------ EVM ------------------
-// FIXME: Copy-paste code. Merge it with IMA switch callbacks if possible
+// FIXME: Copy-paste code. Merge it with IMA switch callbacks if possible.
static void genlist_evm_enable_disable_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
if (_evm_fix_state == 1) {
ret = evm_set_state(EVM_STATE_FIX);
printf("result of evm_set_state(EVM_STATE_FIX): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
else {
ret = evm_set_state(EVM_STATE_ENABLED);
printf("result of evm_set_state(EVM_STATE_ENABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
_evm_state = 1;
((ItemData_t *)data)->check_status = EINA_TRUE;
else { // Turning off the EVM
ret = evm_set_state(EVM_STATE_DISABLED);
printf("result of evm_set_state(EVM_STATE_DISABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
_evm_state = 0;
((ItemData_t *)data)->check_status = EINA_FALSE;
_ima_disable_all_items(it);
}
-// out:
+#ifndef DO_NOT_CHECK_ERROR
+out:
+#endif
+
elm_genlist_item_update(it);
elm_genlist_item_selected_set(it, EINA_FALSE);
}
if (_evm_state == 1) { // If EVM is enabled then turn on FIX mode
ret = evm_set_state(EVM_STATE_FIX);
printf("result of evm_set_state(FIX): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
// If EVM is disabled then just change the state in UI
_evm_fix_state = 1;
if (_evm_state == 1) {
ret = evm_set_state(EVM_STATE_ENABLED);
printf("result of evm_set_state(EVM_STATE_ENABLED): %d\n", ret);
- // FIXME: this code is commented for testing purpose
- // if (ret) // Error
- // goto out;
+#ifndef DO_NOT_CHECK_ERROR
+ if (ret != LIB_SUCCESS) // Error
+ goto out;
+#endif
}
// If EVM is disabled then just change the state in UI
_evm_fix_state = 0;
((ItemData_t *)data)->check_status = EINA_FALSE;
}
-//out:
+#ifndef DO_NOT_CHECK_ERROR
+out:
+#endif
+
elm_genlist_item_selected_set(it, EINA_FALSE);
elm_genlist_item_update(it);
}