2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Rafal Krypa <r.krypa@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
18 * Security Manager library header
21 * @file security-manager.h
22 * @author Pawel Polawski (p.polawski@samsung.com)
24 * @brief This file contains header of security-manager API
27 #ifndef SECURITY_MANAGER_H_
28 #define SECURITY_MANAGER_H_
30 #include <sys/types.h>
36 /*! \brief return code of API functions */
38 SECURITY_MANAGER_SUCCESS,
39 SECURITY_MANAGER_ERROR_UNKNOWN,
40 SECURITY_MANAGER_ERROR_INPUT_PARAM,
41 SECURITY_MANAGER_ERROR_MEMORY,
42 SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE,
43 SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED,
44 SECURITY_MANAGER_ERROR_ACCESS_DENIED,
47 /*! \brief accesses types for application installation paths*/
48 enum app_install_path_type {
49 //accessible read-write only for applications with same package id
50 SECURITY_MANAGER_PATH_PRIVATE,
51 //read-write access for all applications
52 SECURITY_MANAGER_PATH_PUBLIC,
53 //read only access for all applications
54 SECURITY_MANAGER_PATH_PUBLIC_RO,
55 //this is only for range limit
56 SECURITY_MANAGER_ENUM_END
60 * This enum has values equivalent to gumd user type.
61 * The gum-utils help states that
62 * "usertype can be system(1), admin(2), guest(3), normal(4)."
64 enum security_manager_user_type {
65 SM_USER_TYPE_NONE = 0,/*<-this should not be used, if it is used, there will be an error returned by SM*/
66 SM_USER_TYPE_SYSTEM = 1,
67 SM_USER_TYPE_ADMIN = 2,
68 SM_USER_TYPE_GUEST = 3,
69 SM_USER_TYPE_NORMAL = 4,
70 SM_USER_TYPE_ANY = 5,/*<-this value may be used only for setting policies and not during user adding*/
73 typedef enum security_manager_user_type security_manager_user_type;
75 /*! \brief data structure responsible for handling informations
76 * required to install / uninstall application */
78 typedef struct app_inst_req app_inst_req;
80 /*! \brief data structure responsible for handling informations
81 * required to manage users */
83 typedef struct user_req user_req;
85 /*! \brief data structure responsible for handling policy updates
86 * required to manage users' and applications' permissions */
87 struct policy_update_req;
88 typedef struct policy_update_req policy_update_req;
90 /*! \brief data structure responsible for handling single policy entry*/
92 typedef struct policy_entry policy_entry;
94 /*! \brief wildcard to be used in requests to match all possible values of given field.
95 * Use it, for example when it is desired to list or apply policy change for all
96 * users or all apps for selected user.
98 #define SECURITY_MANAGER_ANY "#"
100 /*! \brief value denoting delete operation on specific policy. It can only be used
101 * in update policy operation, passed to either security_manager_policy_entry_admin_set_level
102 * or security_manager_policy_entry_set_level.
104 #define SECURITY_MANAGER_DELETE "DELETE"
107 * This function translates lib_retcode error codes to strings describing
109 * @param[in] rc error code of lib_retcode type
110 * @return string describing error for error code
112 const char *security_manager_strerror(enum lib_retcode rc);
115 * This function is responsible for initialize app_inst_req data structure
116 * It uses dynamic allocation inside and user responsibility is to call
117 * app_inst_req_free() for freeing allocated resources
119 * \param[in] Address of pointer for handle app_inst_req structure
120 * \return API return code or error code
122 int security_manager_app_inst_req_new(app_inst_req **pp_req);
125 * This function is used to free resources allocated by calling app_inst_req_new()
126 * \param[in] Pointer handling allocated app_inst_req structure
128 void security_manager_app_inst_req_free(app_inst_req *p_req);
131 * This function is used to set up application identifier in app_inst_req structure
133 * \param[in] Pointer handling app_inst_req structure
134 * \param[in] Application identifier
135 * \return API return code or error code
137 int security_manager_app_inst_req_set_app_id(app_inst_req *p_req, const char *app_id);
140 * This function is used to set up package identifier in app_inst_req structure
142 * \param[in] Pointer handling app_inst_req structure
143 * \param[in] Package identifier
144 * \return API return code or error code
146 int security_manager_app_inst_req_set_pkg_id(app_inst_req *p_req, const char *pkg_id);
149 * This function is used to add privilege to app_inst_req structure,
150 * it can be called multiple times
152 * \param[in] Pointer handling app_inst_req structure
153 * \param[in] Application privilager
154 * \return API return code or error code
156 int security_manager_app_inst_req_add_privilege(app_inst_req *p_req, const char *privilege);
159 * This function is used to add application path to app_inst_req structure,
160 * it can be called multiple times
162 * \param[in] Pointer handling app_inst_req structure
163 * \param[in] Application path
164 * \param[in] Application path type
165 * \return API return code or error code
167 int security_manager_app_inst_req_add_path(app_inst_req *p_req, const char *path, const int path_type);
170 * This function is used to set up user identifier in app_inst_req structure.
171 * This field simplifies support for online and offline modes.
173 * \param[in] Pointer handling app_inst_req structure
174 * \param[in] User identifier (UID)
175 * \return API return code or error code
177 int security_manager_app_inst_req_set_uid(app_inst_req *p_req,
181 * This function is used to install application based on
182 * using filled up app_inst_req data structure
184 * \param[in] Pointer handling app_inst_req structure
185 * \return API return code or error code: it would be
186 * - SECURITY_MANAGER_SUCCESS on success,
187 * - SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED when user does not
188 * have rights to install requested directories,
189 * - SECURITY_MANAGER_ERROR_UNKNOWN on other errors.
191 int security_manager_app_install(const app_inst_req *p_req);
194 * This function is used to uninstall application based on
195 * using filled up app_inst_req data structure
197 * \param[in] Pointer handling app_inst_req structure
198 * \return API return code or error code
200 int security_manager_app_uninstall(const app_inst_req *p_req);
203 * Get package id of a given application
205 * On successful call pkg_id should be freed by the caller using free() function
207 * \param[out] Pointer to package identifier string
208 * \param[in] Application identifier
209 * \return API return code or error code
211 int security_manager_get_app_pkgid(char **pkg_id, const char *app_id);
214 * Compute smack label for given application id and set it for
215 * currently running process
217 * \param[in] Application identifier
218 * \return API return code or error code
220 int security_manager_set_process_label_from_appid(const char *app_id);
223 * For given app_id and current user, calculate allowed privileges that give
224 * direct access to file system resources. Then add current process to
225 * supplementary groups that are assigned to these resources.
227 * In Tizen some sensitive resources are being accessed by applications directly.
228 * The resources, being file system objects, are owned by dedicated GIDs and only
229 * processes in those UNIX groups can access them. This function is used for
230 * adding application process to all permitted groups that are assigned to such
233 * \param[in] Application identifier
234 * \return API return code or error code
236 int security_manager_set_process_groups_from_appid(const char *app_id);
239 * The above launcher functions, manipulating process Smack label and group,
240 * require elevated privileges. Since they will be called by launcher after fork,
241 * in the process for the application, privileges should be dropped before
242 * running an actual application. This function is a helper for that purpose -
243 * it drops capabilities from the process.
245 * \return API return code or error code
247 int security_manager_drop_process_privileges(void);
250 * A convenience function for launchers for preparing security context for an
251 * application process. It should be called after fork in the new process, before
252 * running the application in it.
253 * It is aimed to cover most common cases and will internally call other, more
254 * specialized security-manager functions for launchers.
255 * Currently it just calls:
256 * - security_manager_set_process_label_from_appid
257 * - security_manager_set_process_groups_from_appid
258 * - security_manager_drop_process_privileges
260 * \param[in] Application identifier
261 * \return API return code or error code
263 int security_manager_prepare_app(const char *app_id);
266 * This function is responsible for initialization of user_req data structure.
267 * It uses dynamic allocation inside and user responsibility is to call
268 * security_manager_user_req_free() for freeing allocated resources.
270 * @param[in] Address of pointer for handle user_req structure
271 * @return API return code or error code
273 int security_manager_user_req_new(user_req **pp_req);
276 * This function is used to free resources allocated by
277 * security_manager_user_req_new()
279 * @param[in] Pointer handling allocated user_req structure
281 void security_manager_user_req_free(user_req *p_req);
284 * This function is used to set up user identifier in user_req structure.
286 * @param p_req Structure containing user data filled during this function call
287 * @param uid User identifier to be set
288 * @return API return code or error code
290 int security_manager_user_req_set_uid(user_req *p_req, uid_t uid);
293 * This function is used to set up user type in user_req structure.
295 * @param p_req Structure containing user data filled during this function call
296 * @param utype User type to be set
297 * @return API return code or error code
299 int security_manager_user_req_set_user_type(user_req *p_req, security_manager_user_type utype);
302 * This function should be called to inform security-manager about adding new user.
303 * This function succeeds only when is called by privileged user.
304 * Otherwise it just returns SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED and does nothing.
306 * It adds all required privileges to a newly created user.
307 * User data are passed through pointer 'p_req'.
308 * @param p_req Structure containing user data filled before calling this
309 * uid and user type needs to be filled in p_req structure,
310 * otherwise SECURITY_MANAGER_ERROR_INPUT_PARAM will be returned.
311 * @return API return code or error code.
313 int security_manager_user_add(const user_req *p_req);
316 * This function should be called to inform security-manager about removing a user.
317 * This function succeeds only when is called by privileged user.
318 * Otherwise it just returns SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED and does nothing.
320 * It removes all privileges granted to a user that has been granted previously by
321 * security_manager_user_add.
323 * @param p_req Structure containing user data filled before calling this.
324 * uid of user needs to be filled in p_req structure,
325 * otherwise SECURITY_MANAGER_ERROR_INPUT_PARAM will be returned.
326 * @return API return code or error code
328 int security_manager_user_delete(const user_req *p_req);
331 * \brief This function is responsible for initializing policy_update_req data structure.
333 * It uses dynamic allocation inside and user responsibility is to call
334 * policy_update_req_free() for freeing allocated resources.
336 * \param[out] pp_req Address of pointer for handle policy_update_req structure
337 * \return API return code or error code
339 int security_manager_policy_update_req_new(policy_update_req **pp_req);
342 * \brief This function is used to free resources allocated by calling policy_update_req_new().
343 * \param[in] p_req Pointer handling allocated policy_update_req structure
345 void security_manager_policy_update_req_free(policy_update_req *p_req);
348 * \brief This function is responsible for initializing policy_entry data structure.
350 * It uses dynamic allocation inside and user responsibility is to call
351 * policy_policy_entry_free() for freeing allocated resources.
353 * \note application and privilege fields default to SECURITY_MANAGER_ANY wildcard,
354 * user field defaults to calling user's UID, whereas the current and max level
355 * values, default to empty string "".
357 * \param[out] pp_entry Address of pointer for handle policy_entry structure
358 * \return API return code or error code
360 int security_manager_policy_entry_new(policy_entry **pp_entry);
363 * \brief This function is used to free resources allocated by calling
364 * policy_entry_req_new().
365 * \param[in] p_entry Pointer handling allocated policy_entry structure
367 void security_manager_policy_entry_free(policy_entry *p_entry);
370 * This function is used to set up application identifier in p_entry structure
372 * \param[in] p_entry Pointer handling policy_entry structure
373 * \param[in] app_id Application identifier to be set
374 * \return API return code or error code
376 int security_manager_policy_entry_set_application(policy_entry *p_entry, const char *app_id);
379 * This function is used to set up user identifier in p_entry structure
380 * Calling this function may be omitted if user wants to set policies for himself
381 * \param[in] p_entry Pointer handling policy_entry structure
382 * \param[in] user_id User identifier to be set
383 * \return API return code or error code
385 int security_manager_policy_entry_set_user(policy_entry *p_entry, const char *user_id);
388 * This function is used to set up privilege in p_entry structure
390 * \param[in] p_entry Pointer handling policy_entry structure
391 * \param[in] privilege Privilege to be set
392 * \return API return code or error code
394 int security_manager_policy_entry_set_privilege(policy_entry *p_entry, const char *privilege);
397 * This function is used to set up privilege level in p_entry structure.
398 * This api is intended to be used to decrease user's own level of privilege.
400 * \param[in] p_entry Pointer handling policy_entry structure
401 * \param[in] policy_level Policy level to be set. The level of privilege may
402 * be one of strings returned by @ref security_manager_policy_levels_get.
403 * If it is not, then error code SECURITY_MANAGER_ERROR_INPUT_PARAM is returned.
404 * Two predefined values are always valid here:
406 * "Allow", which means that user allows some app (setup by calling function
407 * @ref security_manager_policy_entry_set_application) to run with some privilege
408 * (setup by @ref security_manager_policy_entry_set_privilege).
409 * Note, that this not necessarily mean, that this privilege will really be granted.
410 * Final decision of granting privilege also depends on app's manifests,
411 * predefined policy and administrator's or manufacturer's settings.
412 * If all of those policy sources also allows granting privilege for that app,
413 * then (and only then) it will be granted.
415 * "Deny", which means that user disallows some app (setup by calling function
416 * @ref security_manager_policy_entry_set_application) to run with some privilege
417 * (setup by @ref security_manager_policy_entry_set_privilege).
418 * Note, that this denies privilege irrespective of privilege levels granted
419 * to app by other policy sources: app's manifests, predefined policy
420 * and administrator's or manufacturer's settings.
422 * Other levels may be also valid, if returned by security_manager_policy_levels_get.
423 * They represent other policy levels configured in system, which security-manager
424 * does support. The other levels are always something between "Allow" and "Deny"
425 * (like "Allow only once").
427 * Irrespective of a meaning of those values security-manager will always treat
428 * policy set by security_manager_policy_entry_set_level as a mean to
429 * decrease user's own rights. This will never increase overall policy.
431 * \return API return code or error code
433 int security_manager_policy_entry_set_level(policy_entry *p_entry, const char *policy_level);
436 * This function is used to set up privilege level for admin policy entries
437 * in p_entry structure.
439 * This function is intended to be used by admin to change level of privilege.
440 * If it is used by user that has no http://tizen.org/privilege/systemsettings.admin
441 * privilege, then security_manager_policy_update_send will return error code.
443 * \param[in] p_entry Pointer handling policy_entry structure
444 * \param[in] policy_level Policy level to be set. This may be one of strings
445 * returned by @ref security_manager_policy_levels_get. If it is not, then error
446 * code is returned (SECURITY_MANAGER_ERROR_INPUT_PARAM).
447 * Two predefined values are always valid here:
449 * "Allow", which means that admin allows some user's app to
450 * get privilege irrespective of predefined policy settings for that user.
451 * Note, that this not necessarily mean, that this privilege will really be granted.
452 * Final decision of granting privilege also depends on app's manifests,
453 * user's own policy (set up by @ref security_manager_policy_entry_set_level)
454 * or manufacturer's settings.
455 * If all of those policy sources also allows granting privilege for that app,
456 * then (and only then) it will be granted.
458 * "Deny", which means that admin disallows some user's app to get privilege
459 * irrespective of predefined policy settings for that user.
460 * Note, that this denies privilege app's manifests, user's own policy
461 * (set up by @ref security_manager_policy_entry_set_level) or manufacturer's
464 * Other levels may be also valid, if returned by security_manager_policy_levels_get.
465 * They represent other policy levels configured in system, which security-manager
466 * does support. The other levels are always something between "Allow" and "Deny"
467 * (like "Allow only once").
469 * Irrespective of a meaning of those values security-manager will always treat
470 * policy set by security_manager_policy_entry_admin_set_level as a mean for admin
471 * to change user's rights, but will not alter user's own privilege level set up
472 * by @ref security_manager_policy_entry_set_level.
474 * \return API return code or error code
476 int security_manager_policy_entry_admin_set_level(policy_entry *p_entry, const char *policy_level);
479 * This function is used to add policy entry to policy update request.
481 * Note, that this function does not make a copy of object pointed to by p_entry
482 * and does not change owner of this handler.
483 * User is responsible to keep p_entry untouched until @ref security_manager_policy_update_send
484 * is called on p_req. After that p_entry still needs to be freed.
485 * (see examples in documentation of @ref security_manager_policy_update_send)
487 * \param[in] p_req Pointer handling allocated policy_update_req structure
488 * \param[in] p_entry Pointer handling policy_entry structure
489 * \return API return code or error code
491 int security_manager_policy_update_req_add_entry(policy_update_req *p_req, const policy_entry *p_entry);
494 * This function is used to obtain user ID from p_entry structure
496 * \param[in] p_entry Pointer handling policy_entry structure
497 * \attention Warning: memory pointed to by value written to policy_level needs to be freed
502 const char *security_manager_policy_entry_get_user(policy_entry *p_entry);
504 * This function is used to obtain application name from p_entry structure
506 * \param[in] p_entry Pointer handling policy_entry structure
507 * \attention Warning: memory pointed to by value written to policy_level needs to be freed
509 * \return application name
512 const char *security_manager_policy_entry_get_application(policy_entry *p_entry);
514 * This function is used to obtain privilege name from p_entry structure
516 * \param[in] p_entry Pointer handling policy_entry structure
517 * \attention Warning: memory pointed to by value written to policy_level needs to be freed
519 * \return privilege name
521 const char *security_manager_policy_entry_get_privilege(policy_entry *p_entry);
523 * This function is used to obtain current policy level from p_entry structure
525 * \param[in] p_entry Pointer handling policy_entry structure
526 * \attention Warning: memory pointed to by value written to policy_level needs to be freed
528 * \return Current policy level
530 const char *security_manager_policy_entry_get_level(policy_entry *p_entry);
533 * This function is used to obtain maximal policy level from p_entry structure
535 * \param[in] p_entry Pointer handling policy_entry structure.
536 * \attention Warning: memory pointed to by value written to policy_level needs to be freed
538 * \return Maximal policy level
540 const char *security_manager_policy_entry_get_max_level(policy_entry *p_entry);
543 * \brief This function is used to send the prepared policy update request using privacy manager
544 * entry point. The request should contain at least one policy update unit, otherwise
545 * the SECURITY_MANAGER_ERROR_INPUT_PARAM is returned.
547 * \note 1. If user field in policy_entry is empty, then uid of the calling user is assumed
548 * 2. If privilege or app field in policy_entry is empty, then SECURITY_MANAGER_API_BAD_REQUEST
550 * 3. For user's personal policy: wildcards usage in application or privilege field of policy_entry
553 * \param[in] p_req Pointer handling allocated policy_update_req structure
554 * \return API return code or error code
557 * (warning: checking return codes are omitted in examples just for visibility reasons)
559 * - to update policy for user by himself:
560 * (Deny access from app MyApp1 to privilege http://tizen.org/privilege/systemsettings,
561 * deny access from app MyApp2 to privilege http://tizen.org/privilege/systemsettings,
562 * deny access from app MyApp3 to privilege http://tizen.org/privilege/notificationmanager)
564 * policy_update_req *policy_update_request;
565 * policy_entry *entry1;
566 * policy_entry *entry2;
567 * policy_entry *entry3;
569 * security_manager_policy_update_req_new(&policy_update_request);
570 * security_manager_policy_entry_new(&entry1);
571 * security_manager_policy_entry_new(&entry2);
572 * security_manager_policy_entry_new(&entry3);
574 * security_manager_policy_entry_set_application(entry1, "MyApp1");
575 * security_manager_policy_entry_set_privilege(entry1, "http://tizen.org/privilege/systemsettings");
576 * security_manager_policy_entry_set_level(entry1, "Deny");
578 * security_manager_policy_entry_set_application(entry2, "MyApp2");
579 * security_manager_policy_entry_set_privilege(entry2, "http://tizen.org/privilege/systemsettings");
580 * security_manager_policy_entry_set_level(entry2, "Deny");
582 * security_manager_policy_entry_set_application(entry3, "MyApp3");
583 * security_manager_policy_entry_set_privilege(entry3, "http://tizen.org/privilege/notificationmanager");
584 * security_manager_policy_entry_set_level(entry3, "Deny");
586 * security_manager_policy_update_req_add_entry(policy_update_request, entry1);
587 * security_manager_policy_update_req_add_entry(policy_update_request, entry2);
588 * security_manager_policy_update_req_add_entry(policy_update_request, entry3);
590 * //do not change entry1, entry2 or entry3!
592 * security_manager_policy_update_send(policy_update_request);
594 * security_manager_policy_entry_free(entry1);
595 * security_manager_policy_entry_free(entry2);
596 * security_manager_policy_entry_free(entry3);
597 * security_manager_policy_update_free(policy_update_request);
599 * - to update policy by administrator for some user:
600 * (Deny access of user of uid 2001 from any app to privilege http://tizen.org/privilege/vibrator,
601 * (allow access of user of uid 2002 using app "App1" to privilege http://tizen.org/privilege/email.admin)
603 * policy_update_req *policy_update_request;
605 * security_manager_policy_update_req_new(&policy_update_request);
607 * policy_entry *entry1;
608 * policy_entry *entry2;
609 * char *adminswife = "2001";
610 * char *adminsfriend = "2002";
612 * security_manager_policy_entry_new(&entry1);
613 * security_manager_policy_entry_new(&entry2);
615 * security_manager_policy_entry_set_user(entry1, adminswife);
616 * security_manager_policy_entry_set_application(entry1, SECURITY_MANAGER_ANY);
617 * security_manager_policy_entry_set_privilege(entry1, "http://tizen.org/privilege/vibrator");
618 * security_manager_policy_entry_admin_set_level(entry1, "Deny");
620 * security_manager_policy_entry_set_user(entry2, adminsfriend);
621 * security_manager_policy_entry_set_application(entry2, "App1");
622 * security_manager_policy_entry_set_privilege(entry2, "http://tizen.org/privilege/email.admin");
623 * security_manager_policy_entry_admin_set_level(entry2, "Allow");
625 * security_manager_policy_update_req_add_entry(policy_update_request, entry1);
626 * security_manager_policy_update_req_add_entry(policy_update_request, entry2);
628 * //do not change entry1 or entry2!
630 * security_manager_policy_update_send(policy_update_request);
632 * security_manager_policy_entry_free(entry1);
633 * security_manager_policy_entry_free(entry2);
634 * security_manager_policy_update_free(policy_update_request);
637 int security_manager_policy_update_send(policy_update_req *p_req);
640 * \brief Function fetches all privileges enforced by admin user.
641 * The result is stored in the policy_entry structures array.
643 * \note It should be called by user with http://tizen.org/privilege/systemsettings.admin privilege.
644 * Normal users may list their personal policy entries using
645 * security_manager_get_configured_policy_for_self() API function.
647 * \attention Developer is responsible for calling security_manager_policy_entries_free()
648 * for freeing allocated resources.
650 * \param[in] p_filter Pointer to filter struct
651 * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
652 * \param[out] p_size Pointer where the size of allocated array will be stored
653 * \return API return code or error code
655 int security_manager_get_configured_policy_for_admin(
656 policy_entry *p_filter,
657 policy_entry ***ppp_privs_policy,
661 * \brief Function fetches all privileges that are configured by user in his/her
662 * privacy manager. The result is stored in the policy_entry structures array.
663 * User may only fetch privileges for his/her own UID.
665 * \attention Developer is responsible for calling security_manager_policy_entries_free()
666 * for freeing allocated resources.
668 * \param[in] p_filter Pointer to filter struct
669 * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
670 * \param[out] p_size Pointer where the size of allocated array will be stored
671 * \return API return code or error code
673 int security_manager_get_configured_policy_for_self(
674 policy_entry *p_filter,
675 policy_entry ***ppp_privs_policy,
679 * \brief Function gets the whole policy for all users, their applications and privileges
680 * based on the provided filter. The result is stored in the policy_entry array.
682 * \note If this call is performed by user with http://tizen.org/privilege/systemsettings.admin
683 * privilege, then it's possible to list policies for all users.
684 * Normal users may only list privileges for their own UID.
686 * \attention Developer is responsible for calling security_manager_policy_entries_free()
687 * for freeing allocated resources.
689 * \param[in] p_filter Pointer to filter struct
690 * \param[out] ppp_privs_policy Pointer handling allocated policy_entry structures array
691 * \param[out] p_size Pointer where the size of allocated array will be stored
692 * \return API return code or error code
694 int security_manager_get_policy(
695 policy_entry *p_filter,
696 policy_entry ***ppp_privs_policy,
700 * \brief This function is used to free resources allocated in policy_entry structures array.
701 * \param[in] p_entries Pointer handling allocated policy status array
702 * \param[in] size Size of the array
704 void security_manager_policy_entries_free(policy_entry *p_entries, const size_t size);
707 * This function returns array of available policy levels in form of simple
708 * text descriptions. List is sorted using internal policy level value,
709 * from highest value to lowest and starts with "Allow".
711 * Caller needs to free memory allocated for the list using
712 * security_manager_policy_levels_free().
714 * @param levels pointer to array of strings.
715 * @param levels_count number of strings in levels array.
716 * @return API return code or error code.
718 int security_manager_policy_levels_get(char ***levels, size_t *levels_count);
721 * This function free memory allocated by security_manager_policy_levels_get()
724 * @param levels array of strings returned by
725 * security_manager_policy_levels_get() function.
726 * @return API return code or error code.
728 void security_manager_policy_levels_free(char **levels, size_t levels_count);
734 #endif /* SECURITY_MANAGER_H_ */