mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-14 01:54:42 +00:00
6ef13eeda7
- Add man page sections '(N)' to external references, and '()' on functions described in the same man page. - Escape minus signs when those are expected to be used on the command line or files. - Mark files and variables in italic; Note headings, function names, constants, program options and man page references in bold. - Do not justify and hyphenate SEE ALSO section, and avoid hyphenation on symbol names by prepending them with \%. - Remove trailing dot from NAME section description. - Split sections with a no-op command '.', to visually distinguish them but to avoid introducing spurious vertical space in the formatted output. - Add explicit .sp commands in the SYNOPSIS section between function prototypes, and fix space placement in function protoypes. - Split header includes with .br (instead of the explicit or implicit .sp) so that they are vertically contiguous. - Add missing {} around SELINUXTYPE and POLICYTYPE variable text in paths. - Remove unneeded formatting commands. - Remove spurious blank lines. Signed-off-by: Guillem Jover <guillem@debian.org> Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
89 lines
2.6 KiB
Groff
89 lines
2.6 KiB
Groff
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
.\"
|
|
.\" Author: Eamon Walsh (ewalsh@tycho.nsa.gov) 2008
|
|
.TH "selinux_set_mapping" "3" "12 Jun 2008" "" "SELinux API documentation"
|
|
.SH "NAME"
|
|
selinux_set_mapping \- establish dynamic object class and permission mapping
|
|
.
|
|
.SH "SYNOPSIS"
|
|
.B #include <selinux/selinux.h>
|
|
.sp
|
|
.nf
|
|
struct security_class_mapping {
|
|
const char *name;
|
|
const char *perms[];
|
|
};
|
|
.fi
|
|
.sp
|
|
.BI "int selinux_set_mapping(struct security_class_mapping *" map ");"
|
|
.
|
|
.SH "DESCRIPTION"
|
|
.BR selinux_set_mapping ()
|
|
establishes a mapping from a user-provided ordering of object classes and permissions to the numbers actually used by the loaded system policy. Use of this function is highly preferred over the generated constants in the libselinux header files, as this method allows the policy's class and permission values to change over time.
|
|
|
|
After the mapping is established, all libselinux functions that operate on class and permission values take the user-provided numbers, which are determined as follows:
|
|
|
|
The
|
|
.I map
|
|
argument consists of an array of
|
|
.B security_class_mapping
|
|
structures, which must be terminated by a structure having a NULL name field. Except for this last structure, the
|
|
.I name
|
|
field should refer to the string name of an object class, and the corresponding
|
|
.I perms
|
|
field should refer to an array of permission bit names terminated by a NULL string.
|
|
|
|
The object classes named in the mapping and the bit indexes of each set of permission bits named in the mapping are numbered in order starting from 1. These numbers are the values that should be passed to subsequent libselinux calls.
|
|
.
|
|
.SH "RETURN VALUE"
|
|
Zero is returned on success. On error, \-1 is returned and
|
|
.I errno
|
|
is set appropriately.
|
|
.
|
|
.SH "ERRORS"
|
|
.TP
|
|
.B EINVAL
|
|
One of the class or permission names requested in the mapping is not present in the loaded policy.
|
|
.TP
|
|
.B ENOMEM
|
|
An attempt to allocate memory failed.
|
|
.
|
|
.SH "EXAMPLE"
|
|
.RS
|
|
.ta 4n 10n
|
|
.nf
|
|
struct security_class_mapping map[] = {
|
|
{ "file", { "create", "unlink", "read", "write", NULL } },
|
|
{ "socket", { "bind", NULL } },
|
|
{ "process", { "signal", NULL } },
|
|
{ NULL }
|
|
};
|
|
|
|
if (selinux_set_mapping(map) < 0)
|
|
exit(1);
|
|
.fi
|
|
.ta
|
|
.RE
|
|
|
|
In this example, after the call has succeeded, classes
|
|
.BR file ,
|
|
.BR socket ,
|
|
and
|
|
.B process
|
|
will be identified by 1, 2 and 3, respectively. Permissions
|
|
.IR create ,
|
|
.IR unlink ,
|
|
.IR read ,
|
|
and
|
|
.I write
|
|
(for the
|
|
.B file
|
|
class) will be identified by 1, 2, 4, and 8 respectively. Classes and permissions not listed in the mapping cannot be used.
|
|
.
|
|
.SH "AUTHOR"
|
|
Eamon Walsh <ewalsh@tycho.nsa.gov>
|
|
.
|
|
.SH "SEE ALSO"
|
|
.BR avc_open (8),
|
|
.BR selinux (8)
|