A user must call a constructor for one of sefs_fcfile_t, sefs_db_t, or sefs_filesystem_t to create a sefs_fclist_t object.
Jason Tang jtang@tresys.com
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file fclist.hh.
#include <sefs/entry.hh>
#include <sefs/query.hh>
#include <selinux/selinux.h>
#include <stdarg.h>
#include <apol/policy.h>
#include <stdexcept>
Go to the source code of this file.
Classes | |
| class | sefs_fclist |
| An abstract class the represents a list of file contexts. More... | |
Defines | |
| #define | SEFS_MSG_ERR 1 |
| #define | SEFS_MSG_WARN 2 |
| #define | SEFS_MSG_INFO 3 |
| #define | SEFS_ERR(fclist, format,) sefs_fclist_handleMsg(fclist, SEFS_MSG_ERR, format, __VA_ARGS__) |
| Invoke a sefs_fclist_t's callback for an error, passing it a format string and arguments. | |
| #define | SEFS_WARN(fclist, format,) sefs_fclist_handleMsg(fclist, SEFS_MSG_WARN, format, __VA_ARGS__) |
| Invoke a sefs_fclist_t's callback for a warning, passing it a format string and arguments. | |
| #define | SEFS_INFO(fclist, format,) sefs_fclist_handleMsg(fclist, SEFS_MSG_INFO, format, __VA_ARGS__) |
| Invoke a sefs_fclist's callback for an informational message, passing it a format string and arguments. | |
| #define | SEFS_MAP_FUNC_DEFINED |
Typedefs | |
| typedef void(* | sefs_callback_fn_t )(void *varg, const struct sefs_fclist *fclist, int level, const char *fmt, va_list argp) |
| typedef enum sefs_fclist_type | sefs_fclist_type_e |
| Possible types of fclist for use with sefs_fclist_get_data(). | |
| typedef int(* | sefs_fclist_map_fn_t )(sefs_fclist *, const sefs_entry *, void *) |
| Function invoked upon each matching file context entry during a query. | |
| typedef sefs_fclist | sefs_fclist_t |
Enumerations | |
| enum | sefs_fclist_type { SEFS_FCLIST_TYPE_NONE = 0, SEFS_FCLIST_TYPE_FILESYSTEM, SEFS_FCLIST_TYPE_FCFILE, SEFS_FCLIST_TYPE_DB } |
| Possible types of fclist for use with sefs_fclist_get_data(). More... | |
Functions | |
| void | sefs_fclist_handleMsg (const struct sefs_fclist *fclist, int level, const char *fmt,...) |
| __attribute__ ((format(printf, 3, 4))) void sefs_fclist_handleMsg(const struct sefs_fclist *fclist | |
| void | sefs_fclist_destroy (sefs_fclist_t **fclist) |
| Deallocate all memory associated with the referenced fclist object, and then set it to NULL. | |
| int | sefs_fclist_run_query_map (sefs_fclist_t *fclist, sefs_query_t *query, sefs_fclist_map_fn_t fn, void *data) |
| Perform a sefs query on the given file context list object. | |
| apol_vector_t * | sefs_fclist_run_query (sefs_fclist_t *fclist, sefs_query_t *query) |
| Perform a sefs query on the given file context list object. | |
| bool | sefs_fclist_get_is_mls (const sefs_fclist_t *fclist) |
| Determine if the contexts in the fclist contain MLS fields. | |
| void | sefs_fclist_associate_policy (sefs_fclist_t *fclist, apol_policy_t *policy) |
| Associate a policy with the fclist. | |
| sefs_fclist_type_e | sefs_fclist_get_fclist_type (const sefs_fclist_t *fclist) |
| Get the type of fclist object represented by fclist. | |
Variables | |
| int | level |
| int const char * | fmt |
|
|
Message describes a fatal error. Definition at line 47 of file fclist.hh. Referenced by sefs_handle_default_callback(). |
|
|
Message is issued as a warning but does not represent a fatal error. Definition at line 48 of file fclist.hh. Referenced by sefs_handle_default_callback(). |
|
|
Message is issued for inormational reasons and does not represent an atypical state. Definition at line 49 of file fclist.hh. Referenced by sefs_handle_default_callback(). |
|
|
|
Invoke a sefs_fclist_t's callback for a warning, passing it a format string and arguments.
Definition at line 77 of file fclist.hh. Referenced by filesystem_ftw_handler(), and sefs_db::sefs_db(). |
|
|
Invoke a sefs_fclist's callback for an informational message, passing it a format string and arguments.
Definition at line 83 of file fclist.hh. Referenced by sefs_db::sefs_db(). |
|
|
|
|
|
|
|
|
Possible types of fclist for use with sefs_fclist_get_data().
Referenced by sefs_fclist::fclist_type(), and sefs_fclist_get_fclist_type(). |
|
|
Function invoked upon each matching file context entry during a query.
|
|
|
|
Possible types of fclist for use with sefs_fclist_get_data().
Definition at line 59 of file fclist.hh. 00060 {
00061 SEFS_FCLIST_TYPE_NONE = 0, /*!< Not an actual type, used for error conditions */
00062 SEFS_FCLIST_TYPE_FILESYSTEM, /*!< get_data returns sefs_filesystem_t, a representation of a file system */
00063 SEFS_FCLIST_TYPE_FCFILE, /*!< get_data returns sefs_fcfile_t, a representation of a collection of file_context files */
00064 SEFS_FCLIST_TYPE_DB /*!< get_data returns sefs_db_t, a representation of a database of file system contexts */
00065 } sefs_fclist_type_e;
|
|
||||||||||||||||||||
|
Definition at line 455 of file fclist.cc. References fmt, sefs_fclist::handleMsg(), level, and sefs_handle_default_callback(). 00456 {
00457 va_list ap;
00458 va_start(ap, fmt);
00459 if (fclist == NULL)
00460 {
00461 sefs_handle_default_callback(NULL, NULL, level, fmt, ap);
00462 }
00463 else
00464 {
00465 fclist->handleMsg(level, fmt, ap);
00466 }
00467 va_end(ap);
00468 }
|
|
|
|
|
|
Deallocate all memory associated with the referenced fclist object, and then set it to NULL. This function does nothing if the fclist object is already NULL.
Definition at line 470 of file fclist.cc. References sefs_fclist_t. Referenced by sechk_lib_destroy(). 00471 {
00472 if (fclist != NULL && *fclist != NULL)
00473 {
00474 delete(*fclist);
00475 *fclist = NULL;
00476 }
00477 }
|
|
||||||||||||||||||||
|
Perform a sefs query on the given file context list object.
Definition at line 479 of file fclist.cc. References sefs_fclist::runQueryMap(), SEFS_ERR, sefs_fclist_t, and sefs_query_t. 00480 {
00481 if (fclist == NULL)
00482 {
00483 SEFS_ERR(NULL, "%s", strerror(EINVAL));
00484 errno = EINVAL;
00485 return -1;
00486 }
00487 int retval;
00488 try
00489 {
00490 retval = fclist->runQueryMap(query, fn, data);
00491 }
00492 catch(...)
00493 {
00494 return -1;
00495 }
00496 return retval;
00497 }
|
|
||||||||||||
|
Perform a sefs query on the given file context list object.
Definition at line 499 of file fclist.cc. References apol_vector_t, sefs_fclist::runQuery(), SEFS_ERR, sefs_fclist_t, and sefs_query_t. Referenced by sechk_lib_load_fc(). 00500 {
00501 if (fclist == NULL)
00502 {
00503 SEFS_ERR(NULL, "%s", strerror(EINVAL));
00504 errno = EINVAL;
00505 return NULL;
00506 }
00507 apol_vector_t *v = NULL;
00508 try
00509 {
00510 v = fclist->runQuery(query);
00511 }
00512 catch(...)
00513 {
00514 return NULL;
00515 }
00516 return v;
00517 }
|
|
|
Determine if the contexts in the fclist contain MLS fields.
Definition at line 519 of file fclist.cc. References sefs_fclist::isMLS(), SEFS_ERR, and sefs_fclist_t. 00520 {
00521 if (fclist == NULL)
00522 {
00523 SEFS_ERR(NULL, "%s", strerror(EINVAL));
00524 return false;
00525 }
00526 return fclist->isMLS();
00527 }
|
|
||||||||||||
|
Associate a policy with the fclist.
Definition at line 529 of file fclist.cc. References apol_policy_t, sefs_fclist::associatePolicy(), SEFS_ERR, and sefs_fclist_t. 00530 {
00531 if (fclist == NULL)
00532 {
00533 SEFS_ERR(NULL, "%s", strerror(EINVAL));
00534 errno = EINVAL;
00535 }
00536 else
00537 {
00538 fclist->associatePolicy(policy);
00539 }
00540 }
|
|
|
Get the type of fclist object represented by fclist.
Definition at line 542 of file fclist.cc. References sefs_fclist::fclist_type(), SEFS_ERR, sefs_fclist_t, and sefs_fclist_type_e. 00543 {
00544 if (fclist == NULL)
00545 {
00546 SEFS_ERR(NULL, "%s", strerror(EINVAL));
00547 return SEFS_FCLIST_TYPE_NONE;
00548 }
00549 return fclist->fclist_type();
00550 }
|
|
|
|
|
|
|