1selinux_file_context_cmp(3)Library Functions Manualselinux_file_context_cmp(3)
2
3
4

NAME

6       selinux_file_context_cmp   -  Compare  two  SELinux  security  contexts
7       excluding the 'user' component
8

SYNOPSIS

10       #include <selinux/selinux.h>
11
12       int selinux_file_context_cmp(const char * a,
13              const char * b);
14

DESCRIPTION

16       selinux_file_context_cmp() compares two context strings  excluding  the
17       user component with strcmp(3) as shown in the EXAMPLE section.
18
19       This  is  useful as for most object contexts, the user component is not
20       relevant.
21

RETURN VALUE

23       The return values follow the strcmp(3) function, where:
24              0  if they are equal.
25              1  if a is greater than b
26              -1 if a is less than b
27

ERRORS

29       None.
30

NOTES

32       The contexts being compared do not specifically need to  be  file  con‐
33       texts.
34

EXAMPLE

36       If context a is:
37              user_u:user_r:user_t:s0
38
39       and context b is:
40              root:user_r:user_t:s0
41
42       then the actual strings compared are:
43              :user_r:user_t:s0 and :user_r:user_t:s0
44
45       Therefore  they  will  match and selinux_file_context_cmp() will return
46       zero.
47

SEE ALSO

49       selinux(8)
50
51
52
53SELinux API documentation        08 March 2011     selinux_file_context_cmp(3)
Impressum