SECURITY_MANAGER_API
const char *security_manager_policy_entry_get_user(policy_entry *p_entry)
{
- if (p_entry)
- return strdup(p_entry->user.c_str());
- else
- return nullptr;
+ return p_entry ? p_entry->user.c_str() : nullptr;
}
SECURITY_MANAGER_API
const char *security_manager_policy_entry_get_application(policy_entry *p_entry)
{
- if (p_entry)
- return strdup(p_entry->appId.c_str());
- else
- return nullptr;
+ return p_entry ? p_entry->appId.c_str() : nullptr;
}
SECURITY_MANAGER_API
const char *security_manager_policy_entry_get_privilege(policy_entry *p_entry)
{
- if (p_entry)
- return strdup(p_entry->privilege.c_str());
- else
- return nullptr;
+ return p_entry ? p_entry->privilege.c_str() : nullptr;
}
SECURITY_MANAGER_API
const char *security_manager_policy_entry_get_level(policy_entry *p_entry)
{
- if (p_entry)
- return strdup(p_entry->currentLevel.c_str());
- else
- return nullptr;
+ return p_entry ? p_entry->currentLevel.c_str() : nullptr;
}
SECURITY_MANAGER_API
const char *security_manager_policy_entry_get_max_level(policy_entry *p_entry)
{
- if (p_entry)
- return strdup(p_entry->maxLevel.c_str());
- else
- return nullptr;
+ return p_entry ? p_entry->maxLevel.c_str() : nullptr;
}
SECURITY_MANAGER_API
* This function is used to obtain user ID from p_entry structure
*
* \param[in] p_entry Pointer handling policy_entry structure
- * \attention Warning: memory pointed to by value written to policy_level needs to be freed
+ * \attention Warning: returned pointer to user ID is valid as long as p_entry is valid.
*
* \return user uid
*/
* This function is used to obtain application name from p_entry structure
*
* \param[in] p_entry Pointer handling policy_entry structure
- * \attention Warning: memory pointed to by value written to policy_level needs to be freed
+ * \attention Warning: returned pointer to application name is valid as long as p_entry is valid.
*
* \return application name
*/
* This function is used to obtain privilege name from p_entry structure
*
* \param[in] p_entry Pointer handling policy_entry structure
- * \attention Warning: memory pointed to by value written to policy_level needs to be freed
+ * \attention Warning: returned pointer to privilege name is valid as long as p_entry is valid.
*
* \return privilege name
*/
* This function is used to obtain current policy level from p_entry structure
*
* \param[in] p_entry Pointer handling policy_entry structure
- * \attention Warning: memory pointed to by value written to policy_level needs to be freed
+ * \attention Warning: returned pointer to policy level is valid as long as p_entry is valid.
*
* \return Current policy level
*/
* This function is used to obtain maximal policy level from p_entry structure
*
* \param[in] p_entry Pointer handling policy_entry structure.
- * \attention Warning: memory pointed to by value written to policy_level needs to be freed
+ * \attention Warning: returned pointer to maximal policy level is valid as long as p_entry is valid.
*
* \return Maximal policy level
*/