selinux/libselinux/man/man8/sefcontext_compile.8
Richard Haines 3cb6078ae5 libselinux: Enhance file context support
Update file contexts generation and loading to use common code.

Remove "status = 0; after "status = sort_specs(data);" otherwise
the function will never indicate a failure.

The file labeling code also has minor formatting, white space
removal etc. changes.

label_file.c - Move process_line function to label_file.h
sefcontext_compile.c - Update to use common process_line code. Now frees
all malloc'ed memory, checked by valgrind. Also added optional -o output
file parameter - updated man page to reflect this change.

V2 - Revert to using compat_validate instead of selabel_validate.
V3 - Revert to using callback for validation now the problem has been
fixed by commit e889148494
("libselinux:  build sefcontext_compile with static libselinux")

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
2015-06-16 12:30:08 -04:00

61 lines
1.3 KiB
Groff

.TH "sefcontext_compile" "8" "12 Jun 2015" "dwalsh@redhat.com" "SELinux Command Line documentation"
.SH "NAME"
sefcontext_compile \- compile file context regular expression files
.
.SH "SYNOPSIS"
.B sefcontext_compile
.RB [ \-o
.IR outputfile ]
.I inputfile
.
.SH "DESCRIPTION"
.B sefcontext_compile
is used to compile file context regular expressions into
.BR prce (3)
format.
.sp
The compiled file is used by libselinux file labeling functions.
.sp
By default
.B sefcontext_compile
writes the compiled prce file with the
.B .bin
suffix appended (e.g. \fIinputfile\fB.bin\fR).
.SH OPTIONS
.TP
.B \-o
Specify an
.I outputfile
that must be a fully qualified file name as the
.B .bin
suffix is not automatically added.
.
.SH "RETURN VALUE"
On error -1 is returned. On success 0 is returned.
.SH "EXAMPLES"
.B Example 1:
.br
sefcontext_compile /etc/selinux/targeted/contexts/files/file_contexts
.sp
Results in the following file being generated:
.RS
/etc/selinux/targeted/contexts/files/file_contexts.bin
.RE
.sp
.B Example 2:
.br
sefcontext_compile -o new_fc.bin /etc/selinux/targeted/contexts/files/file_contexts
.sp
Results in the following file being generated in the cwd:
.RS
new_fc.bin
.RE
.
.SH AUTHOR
Dan Walsh, <dwalsh@redhat.com>
.
.SH "SEE ALSO"
.BR selinux (8),
.BR semanage (8),