Re: Contributed manual pages for libselinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eamon !

On Fri, 2009-11-20 at 21:42 -0500, Eamon Walsh wrote:

> Hi, thanks for doing this.  Some quick review below.

You are welcome, I suppose it was a boring task for many...

Thanks very much for reviewing the changes. And please accept my
apologies for not placing "[PATCH]" in the subject of the original post.
I had just subscribed to the list.

I left you cc address intact here...

> There is too much in matchpathcon(3) now.  It's going to need to be
> split up into different pages, perhaps the init/fini/teardown stuff in
> one page, the lookup calls in another, and the non-matchpathcon prefixed
> calls in a third page.
> 
> Also, .so manpage links are needed for all the calls here.

Yes, matchpathcon is a mess. Following your guidelines, I have now
splitted the huge and messy page in several different man pages. It's
easier to consult and easier to maintain.

The first part (page) is strictly related to _init, its variant
_init_index, _fini, matchpathcon and its variant matchpathcon_index.
Nice and concise. References are provided in the "SEE ALSO" section to
the rest.

The second page describes the auxiliary lookup calls
(matchpathcon_checkmatches) and the inode associations functions
(matchpathcon_filespec_{add,destroy,eval}). The reference section points
to the main matchpathcon page.

A third page has been created for the functions that are used to set the
flags (set_matchpathcon_flags) or to configure the behaviour of the main
matchpathcon functions (set_matchpathcon_invalidcon and
set_matchpathcon_printf).

A fourth and fifth page is devoted to functions that should never had
ended up in matchpathcon (selinux_file_context_cmp and
selinux_file_context_verify in one page and selinux_lsetfilecon_default
in another one): we do not really need to save electrons needed for new
pages...

> 
> 
> > * print_access_vector
> >   
> 
> Looks good.

No modifications.

> > * security_disable
> >   
> 
> See the selinux.h comments for this.  It needs to be documented that
> this function can only be called at startup time.

Ok. I have stressed that now and also mentioned that after the policy
has been loaded at startup, then only "setenforce" can be used to alter
(not disable) the mode of the SELinux kernel code (for example by
placing it into "permissive" mode).

> > * security_set_boolean_list
> >   
> 
> a RETURN VALUE section is needed in this page, documenting at least this
> call if not the others in that page.

I have now added a "RETURN VALUE" section.

Also, to avoid confusion, I have rephrased the word "returns" in
"provides" when not strictly referring the to the return value of the
function (take for example security_get_boolean_names(), strictly
speaking the function returns an integer representing 0=success or
-1=failure, although from a conceptual point of view it also returns a
list trough modification of one of its parameters passed by reference).

Usually when an application developer looks at the "RETURN VALUE"
section it is because he/she has already planned/coded the call to the
function (and thus also the handling to parameters passed by reference)
and only needs to check for the function exit status so that it can be
handled properly at the call point.

> > * selinux_check_passwd_access
> >   
> 
> This is a replacement for the inconsistently named "checkPasswdAccess"
> function.  So, the existing description of checkPasswdAccess should be
> moved to this function, and checkPasswdAccess should be changed to "this
> is a deprecated alias for selinux_check_passwd_access".

Yes, I have now mentioned that checkPasswdAccess is deprecated. We are
referring to file security_compute_av.3 as the description of these two
functions lives there...

By the way, it has been pointed out that this function should not
hard-code a string. I also agree with him, there is a generic constant
for such "passwd" object class, it is defined in flask.h could be used
instead of the string, thus avoiding hard-coding and also allowing to
save a few cycles and be theoretically future-proof (if ever the name
would change, say to "password", "auth-token" or anything else).

--- libselinux/src/checkAccess.c.orig   2009-11-21 20:07:21.000000000
+0100
+++ libselinux/src/checkAccess.c        2009-11-21 20:08:36.000000000
+0100
@@ -13,17 +13,12 @@ int selinux_check_passwd_access(access_v
        if (is_selinux_enabled() == 0)
                return 0;
        if (getprevcon_raw(&user_context) == 0) {
-               security_class_t passwd_class;
                struct av_decision avd;
                int retval;

-               passwd_class = string_to_security_class("passwd");
-               if (passwd_class == 0)
-                       return 0;
-
                retval = security_compute_av_raw(user_context,
                                                     user_context,
-                                                    passwd_class,
+                                                    SECCLASS_PASSWD,
                                                     requested,
                                                     &avd);

Note that the above code, should really live in the application and not
in the selinux library. It used to be like that, then for some reason it
has been introduced. Redhat's passwd and cronie are calling the library
function and thus at the moment they rely on it. But for example,
util-linux-ng has the code in it and does not call this function, as I
believe it should be. A very minor issue anyway...

> > * selinux_init_load_policy
> >   
> 
> A paragraph break is needed in the DESCRIPTION section before this function.

Done. I have also added a note to the already mentioned fact that after
initial policy load, SELinux cannot be anymore disabled using calls to
security_disable(3).

> > * selinux_lsetfilecon_default
> >   
> 
> See notes above about the matchpathcon manpage.

Yes, separate man page now.

> > * selinux_mkload_policy
> >   
> 
> Looks good.

No modifications.

> > * set_selinuxmnt
> >   
> 
> This manpage includes two static functions that are not part of the
> libselinux API (at least, not anymore) and should be removed.
> 
> Also, I'm not comfortable with the description given.  Instead, use the
> comments in selinux.h, which are more accurate and verbose.
> 

Please let me know if things are any better now.

I did also provide on the same day a patch for beautifying and improving
the command-line option parsing of a few utilities (a ticket had been
created by somebody). That patch provides those improvement according to
GNU-style parsing of "help" and "version" options (including long-option
variants). I think it also fixes a couple of typos here and there. Feel
free to include that patch too if you like it, so that the ticket can be
closed ! I will attach it again in another separate message: it has been
slightly modified in order to apply cleanly to the latest git snapshot.

More important, I was also thinking about fingerprinting (and
subsequently checking) the libraries with some cryptographic hash
function such as the NIST-recommended SHA2. It is beginning to be done
for security-related projects like OpenSSL, so I believe it is even more
essential for SELinux. Ever thought about anything like that ?

Best regards,

Guido
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/fini_selinuxmnt.3 selinux-dev-211109-patched/libselinux/man/man3/fini_selinuxmnt.3
--- selinux-dev-211109/libselinux/man/man3/fini_selinuxmnt.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/fini_selinuxmnt.3	2009-11-21 16:19:43.000000000 +0100
@@ -0,0 +1 @@
+.so man3/init_selinuxmnt.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/init_selinuxmnt.3 selinux-dev-211109-patched/libselinux/man/man3/init_selinuxmnt.3
--- selinux-dev-211109/libselinux/man/man3/init_selinuxmnt.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/init_selinuxmnt.3	2009-11-21 20:39:00.000000000 +0100
@@ -0,0 +1,28 @@
+.TH "init_selinuxmnt" "3" "21 Nov 2009" "" "SELinux API documentation"
+.SH "NAME"
+init_selinuxmnt \- initialize the global variable selinux_mnt.
+
+.SH "SYNOPSIS"
+.BI "static void init_selinuxmnt(void);"
+.sp
+.BI "static void fini_selinuxmnt(void);"
+.sp
+.BI "void set_selinuxmnt(char *" mnt ");"
+
+.SH "DESCRIPTION"
+.B init_selinuxmnt 
+initializes the global variable selinux_mnt to the selinuxfs mountpoint.
+
+.B fini_selinuxmnt
+deinitializes the global variable selinux_mnt that stores the selinuxfs
+mountpoint.
+
+.B set_selinuxmnt
+changes the selinuxfs mountpoint to
+.I mnt. 
+
+.SH "AUTHOR"
+This manual page has been written by Guido Trentalancia <guido@xxxxxxxxxxxxxxxx>
+
+.SH "SEE ALSO"
+.BR selinux (8),
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon.3	2009-11-21 20:36:08.000000000 +0100
@@ -1,27 +1,22 @@
-.TH "matchpathcon" "3" "16 March 2005" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
+.TH "matchpathcon" "3" "21 November 2009" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
 .SH "NAME"
-matchpathcon \- get the default SELinux security context for the specified path from the file contexts configuration.
+matchpathcon, matchpathcon_index \- get the default SELinux security context for the specified path from the file contexts configuration.
 
 .SH "SYNOPSIS"
 .B #include <selinux/selinux.h>
 .sp
+
 .BI "int matchpathcon_init(const char *" path ");"
 
-.BI "int matchpathcon_fini(void);"
+.BI "int matchpathcon_init_prefix(const char *" path ", const char *" subset ");"
 
-.BI "int matchpathcon(const char *" path ", mode_t " mode ", security_context_t *" con);
+.BI "int matchpathcon_fini(void);"
 .sp
 
-.BI "void set_matchpathcon_printf(void (*" f ")(const char *" fmt ", ...));"
-
-.BI "void set_matchpathcon_invalidcon(int (*" f ")(const char *"path ", unsigned " lineno ", char * " context "));"
-
-.BI "void set_matchpathcon_flags(unsigned int " flags ");"
-
-.BI "int selinux_file_context_cmp(const security_context_t a,
-				     const security_context_t b);"
+.BI "int matchpathcon(const char *" path ", mode_t " mode ", security_context_t *" con ");
+.sp
 
-.BI "int selinux_file_context_verify(const char *path, mode_t mode);"
+.BI "int matchpathcon_index(const char *" name ", mode_t " mode ", security_context_t * " con ");"
 
 .SH "DESCRIPTION"
 .B matchpathcon_init
@@ -37,7 +32,7 @@ i.e. the path returned by 
 Unless the 
 .B MATCHPATHCON_BASEONLY 
 flag has been set via 
-.B set_matchpathcon_flags,
+.B set_matchpathcon_flags(3),
 files with the same path prefix but a 
 .B .homedirs
 and
@@ -47,6 +42,14 @@ dynamically generated entries for user h
 customizations.
 
 .sp
+.B matchpathcon_init_prefix
+is the same as
+.B matchpathcon_init
+but only loads entries with regular expressions that have stems prefixed
+by
+.I prefix.
+
+.sp
 .B matchpathcon_fini
 frees the memory allocated by a prior call to
 .B matchpathcon_init.
@@ -63,7 +66,9 @@ configuration and sets the security cont
 to refer to the
 resulting context. The caller must free the returned security context 
 .I con
-using freecon when finished using it.
+using
+.B freecon(3)
+when finished using it.
 .I mode
 can be 0 to disable mode matching, but
 should be provided whenever possible, as it may affect the matching.
@@ -78,54 +83,16 @@ its first invocation with a NULL
 defaulting to the active file contexts configuration.
 .sp
 
-.B set_matchpathcon_printf
-sets the function used by 
-.B matchpathcon_init
-when displaying errors about the file contexts configuration.  If not set, 
-then this defaults to fprintf(stderr, fmt, ...).  This can be set to redirect
-error reporting to a different destination.
-
-.sp
-.B set_matchpathcon_invalidcon
-sets the function used by 
-.B matchpathcon_init
-when checking the validity of a context in the file contexts
-configuration.  If not set, then this defaults to a test based 
-on 
-.B security_check_context(3),
-which checks validity against the active policy on a SELinux system.
-This can be set to instead perform checking based on a binary policy file,
-e.g. using 
-.B sepol_check_context(3),
-as is done by 
-.B setfiles -c.
-The function is also responsible for reporting any such error, and
-may include the 
-.I path
-and
-.I lineno
-in such error messages.
-
+.B matchpathcon_index
+is the same as
+.B matchpathcon
+but returns a specification index that can later be used in a
+.B matchpathcon_filespec_add(3)
+call.
 .sp
-.B set_matchpathcon_flags
-sets flags controlling the operation of 
-.B matchpathcon_init
-or
-.B matchpathcon.
-If the 
-.B MATCHPATHCON_BASEONLY
-flag is set, then only the base file contexts configuration file
-will be processed, not any dynamically generated entries or local customizations.
-.sp
-.B selinux_file_context_cmp
-compares two file contexts to see if their differences are "significant", the function runs the strcmp function ignoring the user componant of the file context.  
-.sp
-.B selinux_file_context_verify
-compares the file context on disk to the system default.
 
-.sp
 .SH "RETURN VALUE"
-Returns 0 on success or -1 otherwise.
+Returns zero on success or \-1 otherwise.
 
 .SH "SEE ALSO"
-.BR selinux "(8), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
+.BR selinux "(8), " set_matchpathcon_flags "(3), " set_matchpathcon_invalidcon "(3), " set_matchpathcon_printf "(3), " matchpathcon_filespec_add "(3), " matchpathcon_checkmatches "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon_checkmatches.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_checkmatches.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon_checkmatches.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_checkmatches.3	2009-11-21 18:37:07.000000000 +0100
@@ -0,0 +1,52 @@
+.TH "matchpathcon_checkmatches" "3" "21 November 2009" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
+.SH "NAME"
+matchpathcon_checkmatches, matchpathcon_filespec_add, matchpathcon_filespec_destroy, matchpathcon_filespec_eval \- check and report whether any specification index has no matches with any inode. Maintenance and statistics on inode associations.
+
+.SH "SYNOPSIS"
+.B #include <selinux/selinux.h>
+.sp
+
+.BI "void matchpathcon_checkmatches(char *" str ");"
+.sp
+
+.BI "int matchpathcon_filespec_add(ino_t " ino ", int " specind ", const char *" file ");"
+
+.BI "void matchpathcon_filespec_destroy(void);"
+
+.BI "void matchpathcon_filespec_eval(void);"
+
+.SH "DESCRIPTION"
+.B matchpathcon_checkmatches
+checks whether any specification has no matches and reports them.
+The
+.I str
+argument is used as a prefix for any warning messages.
+.sp
+
+.B matchpathcon_filespec_add
+maintains an association between an inode
+.I ino
+and a specification index
+.I specind,
+and checks whether a conflicting specification is already associated
+with the same inode (e.g. due to multiple hard links). If so, then
+it uses the latter of the two specifications based on their order in the 
+.I file
+context configuration. Returns the specification index used or \-1 on
+error.
+.sp
+
+.B matchpathcon_filespec_destroy
+destroys any inode associations that have been added, e.g. to restart
+for a new filesystem.
+.sp
+
+.B matchpathcon_filespec_eval
+displays statistics on the hash table usage for the inode associations.
+
+.sp
+.SH "RETURN VALUE"
+Returns zero on success or \-1 otherwise.
+
+.SH "SEE ALSO"
+.BR selinux "(8), " matchpathcon "(3), " matchpathcon_index "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_add.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_add.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_add.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_add.3	2009-11-21 16:52:05.000000000 +0100
@@ -0,0 +1 @@
+.so man3/matchpathcon_checkmatches.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_destroy.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_destroy.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_destroy.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_destroy.3	2009-11-21 16:52:18.000000000 +0100
@@ -0,0 +1 @@
+.so man3/matchpathcon_checkmatches.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_eval.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_eval.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon_filespec_eval.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_filespec_eval.3	2009-11-21 16:52:26.000000000 +0100
@@ -0,0 +1 @@
+.so man3/matchpathcon_checkmatches.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/matchpathcon_index.3 selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_index.3
--- selinux-dev-211109/libselinux/man/man3/matchpathcon_index.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/matchpathcon_index.3	2009-11-21 17:54:05.000000000 +0100
@@ -0,0 +1 @@
+.so man3/matchpathcon.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/print_access_vector.3 selinux-dev-211109-patched/libselinux/man/man3/print_access_vector.3
--- selinux-dev-211109/libselinux/man/man3/print_access_vector.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/print_access_vector.3	2009-11-21 16:19:43.000000000 +0100
@@ -0,0 +1 @@
+.so man3/security_class_to_string.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_class_to_string.3 selinux-dev-211109-patched/libselinux/man/man3/security_class_to_string.3
--- selinux-dev-211109/libselinux/man/man3/security_class_to_string.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_class_to_string.3	2009-11-21 16:19:43.000000000 +0100
@@ -6,6 +6,8 @@
 security_class_to_string, security_av_perm_to_string, string_to_security_class, string_to_av_perm, security_av_string \- convert
 between SELinux class and permission values and string names.
 
+print_access_vector \- display an access vector in human-readable form. 
+
 .SH "SYNOPSIS"
 .B #include <selinux/selinux.h>
 
@@ -20,6 +22,8 @@ between SELinux class and permission val
 .BI "security_class_t string_to_security_class(const char *" name ");"
 .sp
 .BI "access_vector_t string_to_av_perm(security_class_t " tclass ", const char *" name ");"
+.sp
+.BI "void print_access_vector(security_class_t " tclass ", access_vector_t " av ");"
 
 .SH "DESCRIPTION"
 .B security_class_to_string
@@ -56,11 +60,17 @@ and security class
 .IR tclass ,
 or zero if no such value exists.
 
+.B print_access_vector
+displays an access vector in human-readable form on the standard output
+stream.
+
 .SH "RETURN VALUE"
 .B security_av_string
-returns returns zero on success or \-1 on error with
+returns zero on success or \-1 on error with
 .I errno
-set appropriately.  All other functions return zero or NULL on error.
+set appropriately.
+.B print_access_vector
+does not return a value. All other functions return zero or NULL on error.
 
 .SH "ERRORS"
 .TP
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_compute_av.3 selinux-dev-211109-patched/libselinux/man/man3/security_compute_av.3
--- selinux-dev-211109/libselinux/man/man3/security_compute_av.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_compute_av.3	2009-11-21 20:46:47.000000000 +0100
@@ -24,6 +24,8 @@ the SELinux policy database in the kerne
 .BI "int security_get_initial_context(const char *" name ", security_context_t
 "con );
 .sp
+.BI "int selinux_check_passwd_access(access_vector_t " requested );
+.sp
 .BI "int checkPasswdAccess(access_vector_t " requested );
 
 .SH "DESCRIPTION"
@@ -65,18 +67,27 @@ instance.
 
 .B security_compute_user
 is used to determine the set of user contexts that can be reached from a
-source context. Is mainly used by
+source context. It is mainly used by
 .B get_ordered_context_list.
 
 .B security_get_initial_context
 is used to get the context of a kernel initial security identifier specified by 
 .I name
 
+.B selinux_check_passwd_access
+is used to check for a permission in the
+.I passwd
+class.
+.B selinux_check_passwd_access
+uses getprevcon() for the source and target security contexts.
+
 .B checkPasswdAccess
-This functions is a helper functions that allows you to check for a permission in the passwd class. checkPasswdAccess uses getprevcon() for the source and target security contexts.
+is a deprecated alias of the
+.B selinux_check_passwd_access
+function.
 
 .SH "RETURN VALUE"
-0 for success and on error -1 is returned.
+Returns zero on success or \-1 on error.
 
 .SH "SEE ALSO"
 .BR selinux "(8), " getcon "(3), " getfilecon "(3), " get_ordered_context_list "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_disable.3 selinux-dev-211109-patched/libselinux/man/man3/security_disable.3
--- selinux-dev-211109/libselinux/man/man3/security_disable.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_disable.3	2009-11-21 18:59:26.000000000 +0100
@@ -0,0 +1,28 @@
+.TH "security_disable" "3" "21 Nov 2009" "" "SELinux API documentation"
+.SH "NAME"
+security_disable \- disable the SELinux kernel code at runtime.
+
+.SH "SYNOPSIS"
+.B #include <selinux/selinux.h>
+.sp
+.BI "int security_disable(void);"
+
+.SH "DESCRIPTION"
+.B security_disable
+disables the SELinux kernel code, unregisters selinuxfs from /proc/filesystems,
+and then unmounts /selinux.
+.sp
+This function can only be called at runtime and prior to the initial policy
+load. After the initial policy load, the SELinux kernel code cannot be disabled,
+but only placed in "permissive" mode by using
+.B setenforce(1).
+
+.SH "RETURN VALUE"
+.B security_disable
+returns zero on success or \-1 on error.
+
+.SH "AUTHOR"
+This manual page has been written by Guido Trentalancia <guido@xxxxxxxxxxxxxxxx>
+
+.SH "SEE ALSO"
+.BR selinux (8), " setenforce "(3)
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_load_booleans.3 selinux-dev-211109-patched/libselinux/man/man3/security_load_booleans.3
--- selinux-dev-211109/libselinux/man/man3/security_load_booleans.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_load_booleans.3	2009-11-21 19:54:30.000000000 +0100
@@ -6,17 +6,19 @@ security_get_boolean_pending \- routines
 .SH "SYNOPSIS"
 .B #include <selinux/selinux.h>
 .sp
-extern int security_load_booleans(char *path);
-
-extern int security_get_boolean_names(char ***names, int *len);
-
-extern int security_get_boolean_pending(const char *name);
-
-extern int security_get_boolean_active(const char *name);
-
-extern int security_set_boolean(const char *name, int value);
-
-extern int security_commit_booleans(void);
+.BI "int security_load_booleans(char *" path ");"
+.sp 
+.BI "int security_get_boolean_names(char ***" names ", int *" len ");"
+.sp
+.BI "int security_get_boolean_pending(const char *" name ");"
+.sp
+.BI "int security_get_boolean_active(const char *" name ");"
+.sp
+.BI "int security_set_boolean(const char *" name ", int " value ");"
+.sp
+.BI "int security_set_boolean_list(size_t " boolcnt ", SELboolean *" boollist ", int " permanent ");"
+.sp
+.BI "int security_commit_booleans(void);"
 
 
 .SH "DESCRIPTION"
@@ -26,31 +28,41 @@ disabled based on the current values of 
 These policy booleans allow runtime modification of the security
 policy without having to load a new policy.  
 
-The SELinux API allows for a transaction based update.  So you can set several boolean values and the commit them all at once.
+The SELinux API allows for a transaction based update. So you can
+set several boolean values and then commit them all at once.
+
+.B security_load_booleans
+
+loads policy boolean settings. Path may be NULL, in which case the
+booleans are loaded from the active policy boolean configuration file.
+
+.B security_get_boolean_names
 
-security_load_booleans
+provides a list of boolean names, currently supported by the loaded policy.
 
-Load policy boolean settings. Path may be NULL, in which case the booleans are loaded from the active policy boolean configuration file.
+.B security_get_boolean_pending
 
-security_get_boolean_names
+returns the pending value for boolean or \-1 on failure.
 
-Returns a list of boolean names, currently supported by the loaded policy.
+.B security_get_boolean_active
 
-security_set_boolean 
+returns the active value for boolean or \-1 on failure.
 
-Sets the pending value for boolean 
+.B security_set_boolean 
 
-security_get_boolean_pending
+sets the pending value for boolean 
 
-Return pending value for boolean
+.B security_set_boolean_list
 
-security_get_boolean_active
+saves a list of booleans in a single transaction.
 
-Return active value for boolean
+.B security_commit_booleans
 
-security_commit_booleans
+commits all pending values for the booleans.
 
-Commit all pending values for the booleans.
+.SH "RETURN VALUE"
+Where not otherwise stated, functions described in this manual page return
+zero on success or \-1 on error. 
 
 .SH AUTHOR	
 This manual page was written by Dan Walsh <dwalsh@xxxxxxxxxx>.
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_load_policy.3 selinux-dev-211109-patched/libselinux/man/man3/security_load_policy.3
--- selinux-dev-211109/libselinux/man/man3/security_load_policy.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_load_policy.3	2009-11-21 20:34:35.000000000 +0100
@@ -1,15 +1,58 @@
-.TH "security_load_policy" "3" "1 January 2004" "russell@xxxxxxxxxxxx" "SELinux API documentation"
+.TH "security_load_policy" "3" "3 November 2009" "guido@xxxxxxxxxxxxxxxx" "SELinux API documentation"
 .SH "NAME"
 security_load_policy \- load a new SELinux policy
+
 .SH "SYNOPSIS"
 .B #include <selinux/selinux.h>
 .sp
 .BI "int security_load_policy(void *" data ", size_t "len );
+.sp
+.BI "int selinux_mkload_policy(int " preservebools ");"
+.sp
+.BI "int selinux_init_load_policy(int *" enforce ");"
 
 .SH "DESCRIPTION"
 .B security_load_policy
-loads a new policy, returns 0 for success and -1 for error.
+loads a new policy, returns 0 for success and \-1 for error.
+
+.B selinux_mkload_policy
+makes a policy image and loads it. This function provides a higher level
+interface for loading policy than
+.B security_load_policy,
+internally determining the right policy version, locating and opening
+the policy file, mapping it into memory, manipulating it as needed for
+current boolean settings and/or local definitions, and then calling
+security_load_policy to load it.
+.I preservebools
+is a boolean flag indicating whether current policy boolean values should
+be preserved into the new policy (if 1) or reset to the saved policy
+settings (if 0). The former case is the default for policy reloads, while
+the latter case is an option for policy reloads but is primarily used for
+the initial policy load.
+.B selinux_init_load_policy
+performs the initial policy load. This function determines the desired
+enforcing mode, sets the
+.I enforce
+argument accordingly for the caller to use, sets the SELinux kernel
+enforcing status to match it, and loads the policy. It also internally
+handles the initial selinuxfs mount required to perform these actions.
+.sp
+It should also be noted that after the initial policy load, the SELinux
+kernel code cannot anymore be disabled and the selinuxfs cannot be
+unmounted using a call to
+.B security_disable(3).
+Therefore, after the initial policy load, the only operational changes
+are those permitted by
+.B setenforce(3)
+(i.e. eventually setting the framework in permissive mode rather than
+in enforcing one).
+
+.SH "RETURN VALUE"
+returns zero on success or \-1 on error.
+
+.SH "AUTHOR"
+This manual page has been written by Guido Trentalancia <guido@xxxxxxxxxxxxxxxx>
 
 .SH "SEE ALSO"
-.BR selinux "(8)"
+.BR selinux "(8), " security_disable "(3), " setenforce "(1)
 
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/security_mkload_policy.3 selinux-dev-211109-patched/libselinux/man/man3/security_mkload_policy.3
--- selinux-dev-211109/libselinux/man/man3/security_mkload_policy.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/security_mkload_policy.3	2009-11-21 16:19:43.000000000 +0100
@@ -0,0 +1 @@
+.so man3/security_load_policy.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/selinux_binary_policy_path.3 selinux-dev-211109-patched/libselinux/man/man3/selinux_binary_policy_path.3
--- selinux-dev-211109/libselinux/man/man3/selinux_binary_policy_path.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/selinux_binary_policy_path.3	2009-11-21 17:30:50.000000000 +0100
@@ -68,7 +68,7 @@ selinux_x_context_path() - file containi
 .sp
 selinux_netfilter_context_path - default netfilter context 
 .sp
-selinux_file_context_path() - default sysstem file contexts configuration
+selinux_file_context_path() - default system file contexts configuration
 .sp
 selinux_file_context_local_path() - local customization file contexts configuration
 .sp
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/selinux_check_passwd_access.3 selinux-dev-211109-patched/libselinux/man/man3/selinux_check_passwd_access.3
--- selinux-dev-211109/libselinux/man/man3/selinux_check_passwd_access.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/selinux_check_passwd_access.3	2009-11-21 20:46:06.000000000 +0100
@@ -0,0 +1 @@
+.so man3/security_compute_av.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/selinux_file_context_cmp.3 selinux-dev-211109-patched/libselinux/man/man3/selinux_file_context_cmp.3
--- selinux-dev-211109/libselinux/man/man3/selinux_file_context_cmp.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/selinux_file_context_cmp.3	2009-11-21 18:38:56.000000000 +0100
@@ -1 +1,25 @@
-.so man3/matchpathcon.3
+.TH "selinux_file_context_cmp" "3" "21 November 2009" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
+.SH "NAME"
+selinux_file_context_cmp, selinux_file_context_verify \- comparison of two file contexts.
+
+.SH "SYNOPSIS"
+.B #include <selinux/selinux.h>
+.sp
+
+.BI "int selinux_file_context_cmp(const security_context_t " a ", const security_context_t " b ");"
+
+.BI "int selinux_file_context_verify(const char *" path ", mode_t " mode ");"
+
+.SH "DESCRIPTION"
+.B selinux_file_context_cmp
+compares two file contexts to see if their differences are "significant", the function runs the strcmp function ignoring the user componant of the file context.  
+.sp
+.B selinux_file_context_verify
+compares the file context on disk to the system default.
+.sp
+
+.SH "RETURN VALUE"
+Returns zero on success or \-1 otherwise.
+
+.SH "SEE ALSO"
+.BR selinux "(8), " selinux_lsetfilecon "(3), " matchpathcon "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/selinux_file_context_verify.3 selinux-dev-211109-patched/libselinux/man/man3/selinux_file_context_verify.3
--- selinux-dev-211109/libselinux/man/man3/selinux_file_context_verify.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/selinux_file_context_verify.3	2009-11-21 17:33:54.000000000 +0100
@@ -1 +1 @@
-.so man3/matchpathcon.3
+.so man3/selinux_file_context_cmp.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/selinux_lsetfilecon_default.3 selinux-dev-211109-patched/libselinux/man/man3/selinux_lsetfilecon_default.3
--- selinux-dev-211109/libselinux/man/man3/selinux_lsetfilecon_default.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/selinux_lsetfilecon_default.3	2009-11-21 17:46:14.000000000 +0100
@@ -0,0 +1,20 @@
+.TH "selinux_lsetfilecon_default" "3" "21 November 2009" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
+.SH "NAME"
+selinux_lsetfilecon_default \- set the file context to the system defaults.
+
+.SH "SYNOPSIS"
+.B #include <selinux/selinux.h>
+.sp
+
+.BI "int selinux_lsetfilecon_default(const char *" path ");"
+
+.SH "DESCRIPTION"
+.B selinux_lsetfilecon_default
+sets the file context to the system defaults.
+.sp
+
+.SH "RETURN VALUE"
+Returns zero on success or \-1 otherwise.
+
+.SH "SEE ALSO"
+.BR selinux "(8), " selinux_file_context_cmp "(3), " selinux_file_context_verify "(3), " matchpathcon "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/set_matchpathcon_flags.3 selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_flags.3
--- selinux-dev-211109/libselinux/man/man3/set_matchpathcon_flags.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_flags.3	2009-11-21 18:38:38.000000000 +0100
@@ -1 +1,62 @@
-.so man3/matchpathcon.3
+.TH "set_matchpathcon_flags" "3" "21 November 2009" "sds@xxxxxxxxxxxxx" "SELinux API documentation"
+.SH "NAME"
+set_matchpathcon_flags, set_matchpathcon_invalidcon, set_matchpathcon_printf \- set flags controlling the operation of matchpathcon or matchpathcon_index and configure the behaviour of validity checking and error displaying.
+
+.SH "SYNOPSIS"
+.B #include <selinux/selinux.h>
+.sp
+
+.BI "void set_matchpathcon_flags(unsigned int " flags ");"
+
+.BI "void set_matchpathcon_invalidcon(int (*" f ")(const char *" path ", unsigned " lineno ", char * " context "));"
+
+.BI "void set_matchpathcon_printf(void (*" f ")(const char *" fmt ", ...));"
+
+.SH "DESCRIPTION"
+.B set_matchpathcon_flags
+sets the flags controlling the operation of 
+.B matchpathcon_init
+and subsequently
+.B matchpathcon_index
+or
+.B matchpathcon.
+If the 
+.B MATCHPATHCON_BASEONLY
+flag is set, then only the base file contexts configuration file
+will be processed, not any dynamically generated entries or local customizations.
+.sp
+
+.B set_matchpathcon_invalidcon
+sets the function used by 
+.B matchpathcon_init
+when checking the validity of a context in the file contexts
+configuration.  If not set, then this defaults to a test based 
+on 
+.B security_check_context(3),
+which checks validity against the active policy on a SELinux system.
+This can be set to instead perform checking based on a binary policy file,
+e.g. using 
+.B sepol_check_context(3),
+as is done by 
+.B setfiles \-c.
+The function is also responsible for reporting any such error, and
+may include the 
+.I path
+and
+.I lineno
+in such error messages.
+.sp
+
+.B set_matchpathcon_printf
+sets the function used by 
+.B matchpathcon_init
+when displaying errors about the file contexts configuration.  If not set, 
+then this defaults to fprintf(stderr, fmt, ...).  This can be set to redirect
+error reporting to a different destination.
+.sp
+
+.SH "RETURN VALUE"
+Returns zero on success or \-1 otherwise.
+
+.SH "SEE ALSO"
+.BR selinux "(8), " matchpathcon "(3), " matchpathcon_index "(3), " set_matchpathcon_invalidcon "(3), " set_matchpathcon_printf "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/set_matchpathcon_invalidcon.3 selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_invalidcon.3
--- selinux-dev-211109/libselinux/man/man3/set_matchpathcon_invalidcon.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_invalidcon.3	2009-11-21 18:38:26.000000000 +0100
@@ -0,0 +1 @@
+.so man3/set_matchpathcon_flags.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/set_matchpathcon_printf.3 selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_printf.3
--- selinux-dev-211109/libselinux/man/man3/set_matchpathcon_printf.3	2009-11-21 16:09:55.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/set_matchpathcon_printf.3	2009-11-21 17:11:09.000000000 +0100
@@ -1 +1 @@
-.so man3/matchpathcon.3
+.so man3/set_matchpathcon_flags.3
diff -pru --new-file selinux-dev-211109/libselinux/man/man3/set_selinuxmnt.3 selinux-dev-211109-patched/libselinux/man/man3/set_selinuxmnt.3
--- selinux-dev-211109/libselinux/man/man3/set_selinuxmnt.3	1970-01-01 01:00:00.000000000 +0100
+++ selinux-dev-211109-patched/libselinux/man/man3/set_selinuxmnt.3	2009-11-21 16:19:43.000000000 +0100
@@ -0,0 +1 @@
+.so man3/init_selinuxmnt.3

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux