|
Chris PeBenito |
473ea7 |
#ifndef _SELINUX_GET_SID_LIST_H_
|
|
Chris PeBenito |
473ea7 |
#define _SELINUX_GET_SID_LIST_H_
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
#include <selinux/selinux.h>
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
#ifdef __cplusplus
|
|
Chris PeBenito |
473ea7 |
extern "C"
|
|
Chris PeBenito |
473ea7 |
{
|
|
Chris PeBenito |
473ea7 |
#endif
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
#define SELINUX_DEFAULTUSER "user_u"
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* Get an ordered list of authorized security contexts for a user session
|
|
Chris PeBenito |
473ea7 |
for 'user' spawned by 'fromcon' and set *conary to refer to the
|
|
Chris PeBenito |
473ea7 |
NULL-terminated array of contexts. Every entry in the list will
|
|
Chris PeBenito |
473ea7 |
be authorized by the policy, but the ordering is subject to user
|
|
Chris PeBenito |
473ea7 |
customizable preferences. Returns number of entries in *conary.
|
|
Chris PeBenito |
473ea7 |
If 'fromcon' is NULL, defaults to current context.
|
|
Chris PeBenito |
473ea7 |
Caller must free via freeconary. */
|
|
Chris PeBenito |
473ea7 |
extern int get_ordered_context_list(const char *user,
|
|
Chris PeBenito |
473ea7 |
security_context_t fromcon,
|
|
Chris PeBenito |
473ea7 |
security_context_t **list);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* As above, but use the provided MLS level rather than the
|
|
Chris PeBenito |
473ea7 |
default level for the user. */
|
|
Chris PeBenito |
473ea7 |
int get_ordered_context_list_with_level (const char *user,
|
|
Chris PeBenito |
473ea7 |
const char *level,
|
|
Chris PeBenito |
473ea7 |
security_context_t fromcon,
|
|
Chris PeBenito |
473ea7 |
security_context_t **list);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* Get the default security context for a user session for 'user'
|
|
Chris PeBenito |
473ea7 |
spawned by 'fromcon' and set *newcon to refer to it. The context
|
|
Chris PeBenito |
473ea7 |
will be one of those authorized by the policy, but the selection
|
|
Chris PeBenito |
473ea7 |
of a default is subject to user customizable preferences.
|
|
Chris PeBenito |
473ea7 |
If 'fromcon' is NULL, defaults to current context.
|
|
Chris PeBenito |
473ea7 |
Returns 0 on success or -1 otherwise.
|
|
Chris PeBenito |
473ea7 |
Caller must free via freecon. */
|
|
Chris PeBenito |
473ea7 |
extern int get_default_context(const char* user,
|
|
Chris PeBenito |
473ea7 |
security_context_t fromcon,
|
|
Chris PeBenito |
473ea7 |
security_context_t *newcon);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* As above, but use the provided MLS level rather than the
|
|
Chris PeBenito |
473ea7 |
default level for the user. */
|
|
Chris PeBenito |
473ea7 |
int get_default_context_with_level(const char *user,
|
|
Chris PeBenito |
473ea7 |
const char *level,
|
|
Chris PeBenito |
473ea7 |
security_context_t fromcon,
|
|
Chris PeBenito |
473ea7 |
security_context_t *newcon);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* Same as get_default_context, but only return a context
|
|
Chris PeBenito |
473ea7 |
that has the specified role. If no reachable context exists
|
|
Chris PeBenito |
473ea7 |
for the user with that role, then return -1. */
|
|
Chris PeBenito |
473ea7 |
int get_default_context_with_role(const char* user,
|
|
Chris PeBenito |
473ea7 |
const char *role,
|
|
Chris PeBenito |
473ea7 |
security_context_t fromcon,
|
|
Chris PeBenito |
473ea7 |
security_context_t *newcon);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* Given a list of authorized security contexts for the user,
|
|
Chris PeBenito |
473ea7 |
query the user to select one and set *newcon to refer to it.
|
|
Chris PeBenito |
473ea7 |
Caller must free via freecon.
|
|
Chris PeBenito |
473ea7 |
Returns 0 on sucess or -1 otherwise. */
|
|
Chris PeBenito |
473ea7 |
extern int query_user_context(security_context_t *list,
|
|
Chris PeBenito |
473ea7 |
security_context_t *newcon);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
/* Allow the user to manually enter a context as a fallback
|
|
Chris PeBenito |
473ea7 |
if a list of authorized contexts could not be obtained.
|
|
Chris PeBenito |
473ea7 |
Caller must free via freecon.
|
|
Chris PeBenito |
473ea7 |
Returns 0 on success or -1 otherwise. */
|
|
Chris PeBenito |
473ea7 |
extern int manual_user_enter_context(const char *user,
|
|
Chris PeBenito |
473ea7 |
security_context_t *newcon);
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
#ifdef __cplusplus
|
|
Chris PeBenito |
473ea7 |
}
|
|
Chris PeBenito |
473ea7 |
#endif
|
|
Chris PeBenito |
473ea7 |
|
|
Chris PeBenito |
473ea7 |
#endif
|