/*
- * Copyright(c) 2013-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2013-2019 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.
extern "C" {
#endif
+/**
+ * @brief Free GList allocated by privilege_db_manager APIs
+ * @param [in] list The GList allocated by privilege_db_manager APIs
+ */
+void privilege_db_manager_list_free(GList* list);
+
/**
* @brief Get all privilege information of the target profile and package type
* @remarks @a privilege_list must be released by you.
/**
* @brief Get mapped privilege list for the given api-version and privilege list.
- * @remarks @a privilege_list must be released by you.
+ * @remarks @a privilege_list must be released by using privilege_db_manager_list_free().
* @remarks @a mapped_privilege_list must be released by you.
* @param [in] api_version The api-version to get mapped privilege list
* @param [in] package_type The package type
/**
* @brief Get all privacy list
- * @remarks @a privacy_list must be released by you.
+ * @remarks @a privacy_list must be released by using privilege_db_manager_list_free().
* @param [out] privacy_list The privacy list.
* @return 0 on success, otherwise a negative error value.
* @retval #PRIVILEGE_DB_MANAGER_ERR_NONE Successful.
/**
* @brief Get list of privileges included in the given privacy group.
- * @remarks @a privilege_list must be released by you.
+ * @remarks @a privilege_list must be released by using privilege_db_manager_list_free().
* @param [in] privacy_name The privacy name
* @param [out] privilege_list The privilege list.
* @return 0 on success, otherwise a negative error value.
/**
* @brief Get privilege list of the same privacy group that the given privilege is included in.
+ * @remarks @a privilege_list must be released by using privilege_db_manager_list_free().
* @param [in] privilege The privilege
* @param [out] privilege_list The privilege list of the same privacy group.
* @return 0 on success, otherwise a negative error value.
/**
* @brief Get blacklisted privileges according to the policy type, uid, and package type.
+ * @remarks @a privilege_list must be released by using privilege_db_manager_list_free().
* @param [in] policy_type The policy type indicates which blacklist to get(PRVMGR_POLICY_TYPE_PREVENT for dpm blacklist and PRVMGR_POLICY_TYPE_DISABLE for mdm blacklist).
* @param [in] uid The uid
* @param [in] package_type The package type
/**
* @brief Get all privacy package list of the user
+ * @remarks @a package_list must be released by using privilege_db_manager_list_free().
* @param [in] uid The uid
* @param [out] package_list The package list
* @return 0 on success, otherwise a negative error value.
/**
* @brief Get privacy list of the application package
+ * @remarks @a privacy_list must be released by using privilege_db_manager_list_free().
* @param [in] uid The uid
* @param [in] pkgid The package ID
* @param [out] privacy_list The privacy list
/**
* @brief Get package list with the given privacy
+ * @remarks @a package_list must be released by using privilege_db_manager_list_free().
* @param [in] uid The uid
* @param [in] privacy The privacy name
* @param [out] package_list The package list
/**
* @brief Get package's privilege list related to the given privacy
+ * @remarks @a privilege_list must be released by using privilege_db_manager_list_free().
* @param [in] uid The uid
* @param [in] pkgid The package id
* @param [in] privacy The privacy name
/*
- * Copyright (c) 2013-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013-2019 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.
extern "C" {
#endif
+/**
+ * @brief Free GList allocated by privilege_info APIs
+ * @param [in] list The GList allocated by privilege_info APIs
+ */
+void privilege_info_list_free(GList* list);
+
/**
* @brief Called to get a privilege group once for specific package.
* @param[in] privilege_group The privilege group
/**
* @brief Gets all privacy list.
- * @remarks @a privacy_list must be released with g_list_free() by you.
+ * @remarks @a privacy_list must be released by using privilege_info_list_free().
* @param [out] privacy_list The privacy list
* @return 0 on success, otherwise a nonzero error value.
* @retval #PRVMGR_ERR_NONE Successful
/**
* @brief Gets privacy display.
- * @remarks @a privacy_display must be released with g_list_free() by you.
+ * @remarks @a privacy_display must be released with free() by you.
* @param [in] privacy The privacy
* @param [out] privacy_display The privacy display
* @return 0 on success, otherwise a nonzero error value.
/**
* @brief Gets privilege list with the given privacy.
- * @remarks @a privilege_list must be released with g_list_free() by you.
+ * @remarks @a privilege_list must be released by using privilege_info_list_free().
* @param [in] privacy The privacy
* @param [out] privilege_list The list of privileges mapped to the given privacy
* @return 0 on success, otherwise a nonzero error value.
/**
* @brief Gets privacy id of the given privilege.
- * @remarks @a privacy must be released with g_list_free() by you.
+ * @remarks @a privacy must be released with free() by you.
* @param [in] privilege The privilege
* @param [out] privacy The privacy id of the given privilege
* @return 0 on success, otherwise a nonzero error value.
/**
* @brief Gets the list of privilges marked as dpm black list.
- * @remarks @a privilege_list must be released with g_list_free() by you.
+ * @remarks @a privilege_list must be released by using privilege_info_list_free().
* @param [in] uid The UID
* @param [in] package_type The privilege_manager_package_type_e
* @param [out] privilege_list The list for privileges marked as black list
/**
* @brief Gets the list of privilges marked as mdm black list for the given uid.
- * @remarks @a privilege_list must be released with g_list_free() by you.
+ * @remarks @a privilege_list must be released by using privilege_info_list_free().
* @param [in] uid The UID
* @param [out] privilege_list The list for privileges marked as black list
* @return 0 on success, otherwise a nonzero error value.
/**
* @brief Get privilege list of the same privacy group that the given privilege is included in.
- * @remarks @a privilege_list must be released with g_list_free() by you.
+ * @remarks @a privilege_list must be released by using privilege_info_list_free().
* @remarks @a privilege_list is NULL when the given privilege is not a privacy privilege.
* @param [in] privilege privilege
* @param [out] privilege_list The privilege list of the same privacy group
/*
- * Copyright(c) 2013-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2013-2019 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.
extern "C" {
#endif
+/**
+ * @brief Free GList allocated by privilege_manager APIs
+ * @param [in] list The GList allocated by privilege_manager APIs
+ */
+EXPORT_API void privilege_manager_list_free(GList* list);
+
/**
* @brief verify privilege in the privilege list by checking its name and level at given api version.
- * @remarks @a privilege_list must be released with g_list_free() by you.
- * @remarks @a error_message must be released with g_list_free() by you.
+ * @remarks @a error_message must be released with free() by you.
* @param [in] uid The uid of the user who's trying to install the application.
* @param [in] api_version The api version of the application
* @param [in] privilege_manager_package_type_e The privilege_manager_package_type_e
/**
* @brief get mapped privilege list of input privilege list according to the given package type, api version, and profile.
- * @remarks @a privilege_list must be released with g_list_free() by you.
- * @remarks @a mapped_privilege_list must be released with g_list_free() by you.
+ * @remarks @a mapped_privilege_list must be released by using privilege_manager_list_free().
* @param [in] api_version The api version of the application
* @param [in] privilege_manager_package_type_e The privilege_manager_package_type_e
* @param [in] privilege_list The privilege_list
/**
* @brief verify metadata level in the metadata list.
- * @remarks @a metadata_list must be released with free() by you.
- * @remarks @a error_messsage must be released with free() by you.
+ * @remarks @a error_message must be released with free() by you.
* @param [in] api_version The API Version
* @param [in] metadata_list The metadata_list
* @param [in] privilege_manager_visibility_e The privilege_manager_visibility_e
/*
- * Copyright(c) 2013-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2013-2019 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.
}
}
+void privilege_db_manager_list_free(GList* list)
+{
+ g_list_free_full(list, free);
+}
+
int privilege_db_manager_check_black_list(uid_t uid, privilege_manager_package_type_e package_type, GList* privilege_list)
{
sqlite3 *db = NULL;
/*
- * Copyright(c) 2013-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2013-2019 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.
return returnValue; \
}
+void privilege_info_list_free(GList* list)
+{
+ g_list_free_full(list, free);
+}
+
int privilege_info_privilege_list_by_pkgid_callback(const char *privilege_name, void *user_data)
{
int ret = privilege_info_is_internal(privilege_name);
/*
- * Copyright(c) 2013-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2013-2019 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.
}
}
+void privilege_manager_list_free(GList* list)
+{
+ g_list_free_full(list, free);
+}
+
int privilege_manager_verify_privilege(uid_t uid, const char *api_version, privilege_manager_package_type_e package_type, GList * privilege_list, privilege_manager_visibility_e visibility, char **error_message)
{
GList *l;