--- /dev/null
+/**
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file im-get-xattrs.h
+ * @author Janusz Kozerski (j.kozerski@samsung.com)
+ * @version 1.0
+ * @brief
+ */
+
+#ifndef __IM_GET_XATTRS_H__
+#define __IM_GET_XATTRS_H__
+
+#include "im-uigadget.h"
+
+void im_get_xattrs_cb (void *data, Evas_Object *obj, void *event_info);
+int im_get_xattrs_wrapper (struct ug_data *ad, const char* const file_path);
+
+#endif /* __IM_GET_XATTRS_H__ */
--- /dev/null
+/**
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file im-get-xattrs.c
+ * @author Janusz Kozerski (j.kozerski@samsung.com)
+ * @version 1.0
+ * @brief
+ */
+
+#include <imaevm.h>
+
+#include "im-common.h"
+#include "im-uigadget.h"
+#include "im-get-xattrs.h"
+
+#define GET_XATTRS_DEFAULT_PATH "/"
+#define MESSAGE_BEGIN "IDS_ST_GET_XATTRS_MSG_BEGIN" // "Xattrs of:"
+#define MESSAGE_IMA ":<br>security.ima: "
+#define MESSAGE_EVM "<br>security.evm: "
+#define FILE_SELECTOR_TITLE "IDS_ST_GET_XATTRS_TITLE"
+
+void im_get_xattrs_cb (void *data, Evas_Object *obj, void *event_info)
+{
+ LOGD("Enter function: %s", __func__);
+ // Unused param warning
+ (void)obj;
+ (void)event_info;
+
+ struct ug_data *ad = (struct ug_data*) data;
+ ad->file_action = im_get_xattrs_wrapper;
+ ad->fileselector_default_path = GET_XATTRS_DEFAULT_PATH;
+
+ show_file_selector(ad, dgettext(PACKAGE, FILE_SELECTOR_TITLE));
+}
+
+int im_get_xattrs_wrapper (struct ug_data *ad, const char* const file_path)
+{
+ LOGD("Enter function: %s", __func__);
+
+ int ret;
+ char* ima_xattr = NULL;
+ char* evm_xattr = NULL;
+
+ ret = ima_get_xattr(file_path, &ima_xattr);
+ if (ret != LIB_SUCCESS) {
+ LOGE("ima_get_xattr (%s) failed (%d)", file_path, ret);
+ goto out;
+ }
+ ret = evm_get_xattr(file_path, &evm_xattr);
+ if (ret != LIB_SUCCESS) {
+ LOGE("evm_get_xattr (%s) failed (%d)", file_path, ret);
+ goto out;
+ }
+
+ size_t size = strlen(dgettext(PACKAGE, IDS_ST_GET_XATTRS_MSG_BEGIN)) +
+ strlen(file_path) +
+ strlen(MESSAGE_IMA) +
+ strlen(ima_xattr) +
+ strlen(MESSAGE_EVM) +
+ strlen(evm_xattr) + 1; // Use asprintf?
+ ad->popup_content = malloc(sizeof(char) * size); // One more char to add NULL at the end
+ snprintf(ad->popup_content, size, "%s%s%s%s%s%s",
+ dgettext(PACKAGE, IDS_ST_GET_XATTRS_MSG_BEGIN),
+ file_path,
+ MESSAGE_IMA,
+ ima_xattr,
+ MESSAGE_EVM,
+ evm_xattr);
+ ad->popup_content[size-1] = '\0';
+
+ create_ok_popup(ad);
+
+out:
+ free(ima_xattr);
+ free(evm_xattr);
+ return 0;
+}
NULL, im_check_file_cb, ad);
elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE);
+ nf_it = _add_genlist_item(genlist, ITC_TYPE_LIST, dgettext(PACKAGE, "IDS_ST_GET_FILE_XATTRS"),
+ NULL, im_check_file_cb, ad);
+ elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE);
+
nf_it = elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "IDS_ST_IMA_EVM_SETUP_MAIN"),
NULL, NULL, genlist, NULL);
elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE);