| 1 |
.TH "sepol_genusers" "3" "15 March 2005" "[email protected]" "SE Linux binary policy API documentation" |
| 2 |
.SH "NAME" |
| 3 |
sepol_genusers \- Generate a new binary policy image with a customized user configuration |
| 4 |
.SH "SYNOPSIS" |
| 5 |
.B #include <sepol/sepol.h> |
| 6 |
.sp |
| 7 |
.BI "int sepol_genusers(void *" data ", size_t "len ", const char *" usersdir ", void *" newdata ", size_t *" newlen); |
| 8 |
.sp |
| 9 |
.BI "void sepol_set_delusers(int " on ");" |
| 10 |
|
| 11 |
.SH "DESCRIPTION" |
| 12 |
.B sepol_genusers |
| 13 |
generates a new binary policy image from |
| 14 |
an existing binary policy image stored in the memory region described by |
| 15 |
the starting address |
| 16 |
.I data |
| 17 |
and the length |
| 18 |
.I len |
| 19 |
and a pair of user configuration files named |
| 20 |
.B system.users |
| 21 |
and |
| 22 |
.B local.users |
| 23 |
from the directory specified by |
| 24 |
.I usersdir. |
| 25 |
The resulting binary policy is placed into dynamically allocated |
| 26 |
memory and the variables |
| 27 |
.I newdata |
| 28 |
and |
| 29 |
.I newlen |
| 30 |
are set to refer to the new binary image's starting address and length. |
| 31 |
The original binary policy image is not modified. |
| 32 |
|
| 33 |
By default, |
| 34 |
.B sepol_genusers |
| 35 |
will preserve user entries that are defined in the original binary policy image |
| 36 |
but not defined in the user configuration files. If such user entries |
| 37 |
should instead by omitted entirely from the new binary policy image, then |
| 38 |
the |
| 39 |
.B sepol_set_delusers |
| 40 |
function may be called with |
| 41 |
.I on |
| 42 |
set to 1 prior to calling |
| 43 |
.B sepol_genusers |
| 44 |
in order to enable deletion of such users. |
| 45 |
|
| 46 |
.SH "RETURN VALUE" |
| 47 |
Returns 0 on success or \-1 otherwise, with errno set appropriately. |
| 48 |
An errno of ENOENT indicates that one or both of the user |
| 49 |
configuration files did not exist. An errno of EINVAL indicates that |
| 50 |
either the original binary policy image or the generated one were |
| 51 |
invalid. An errno of ENOMEM indicates that insufficient memory was |
| 52 |
available to process the original binary policy image or to generate |
| 53 |
the new policy image. Invalid entries in the user configuration files |
| 54 |
are skipped with a warning. |