#include <entry.hh>
Note that the entry's contents (even upon a copy-constructed version of the entry) are always tied to its fclist, so do not access entries whose fclist has been destroyed.
Definition at line 51 of file entry.hh.
Public Member Functions | |
| sefs_entry (const sefs_entry *e) | |
| Perform a deep copy of an entry object. | |
| ~sefs_entry () | |
| const apol_context_t * | context () const |
| Get the context from a sefs entry. | |
| ino64_t | inode () const |
| Get the inode number associated with a sefs entry. | |
| const char * | dev () const |
| Get the device name associated with a sefs entry. | |
| uint32_t | objectClass () const |
| Get the object class associated with a sefs entry. | |
| const char * | path () const |
| Get the paths associated with a sefs entry. | |
| const char * | origin () const |
| Get the file from which a sefs entry originated. | |
| char * | toString () const throw (std::bad_alloc) |
| Return a string representation of this entry. | |
Private Member Functions | |
| sefs_entry (class sefs_fclist *fclist, const struct sefs_context_node *new_context, uint32_t new_objectClass, const char *new_path, const char *new_origin=NULL) | |
| Create a blank entry. | |
Private Attributes | |
| sefs_fclist * | _fclist |
| const struct sefs_context_node * | _context |
| ino64_t | _inode |
| const char * | _dev |
| uint32_t | _objectClass |
| const char * | _path |
| const char * | _origin |
Friends | |
| class | sefs_db |
| class | sefs_fcfile |
| class | sefs_filesystem |
|
|
Perform a deep copy of an entry object.
Definition at line 38 of file entry.cc. References _context, _dev, _fclist, _inode, _objectClass, _origin, and _path. 00039 {
00040 _fclist = e->_fclist;
00041 _context = e->_context;
00042 _inode = e->_inode;
00043 _dev = e->_dev;
00044 _objectClass = e->_objectClass;
00045 _path = e->_path;
00046 _origin = e->_origin;
00047 }
|
|
|
Definition at line 49 of file entry.cc. 00050 {
00051 // do nothing
00052 }
|
|
||||||||||||||||||||||||
|
Create a blank entry. The entity creating this entry is responsible for setting additional values as needed.
Definition at line 131 of file entry.cc. References _context, _dev, _fclist, _inode, _objectClass, _origin, and _path. 00133 {
00134 _fclist = fclist;
00135 _context = new_context;
00136 _objectClass = new_objectClass;
00137 _inode = 0;
00138 _dev = NULL;
00139 _path = new_path;
00140 _origin = new_origin;
00141 }
|
|
|
Get the context from a sefs entry.
If the entry has no context (such as being marked
Definition at line 54 of file entry.cc. References _context, apol_context_t, and sefs_context_node::context. Referenced by fcfile_query(), fcfile_query_map_user_lee(), replace_entry(), and sefs_entry_get_context().
|
|
|
Get the inode number associated with a sefs entry.
Definition at line 59 of file entry.cc. Referenced by db_create_from_filesystem(), and sefs_entry_get_inode(). 00060 {
00061 return _inode;
00062 }
|
|
|
Get the device name associated with a sefs entry. For example, if /dev/sda5 is mounted as /home, the device name for entry "/home/gburdell" will be "/dev/sda5".
Definition at line 64 of file entry.cc. Referenced by db_create_from_filesystem(), and sefs_entry_get_dev(). 00065 {
00066 return _dev;
00067 }
|
|
|
Get the object class associated with a sefs entry. The returned value will be one of one of QPOL_CLASS_ALL, QPOL_CLASS_FILE, etc., as defined in <qpol/genfscon_query.h>. If this returns QPOL_CLASS_ALL then the entry is associated with all object classes.
Definition at line 69 of file entry.cc. Referenced by db_create_from_filesystem(), fcfile_query(), and sefs_entry_get_object_class(). 00070 {
00071 return _objectClass;
00072 }
|
|
|
Get the paths associated with a sefs entry.
Definition at line 74 of file entry.cc. Referenced by db_create_from_filesystem(), fcfile_query(), replace_entry(), and sefs_entry_get_path(). 00075 {
00076 return _path;
00077 }
|
|
|
Get the file from which a sefs entry originated. This function is only meaningful when entries are returned from a query on a modular file context file.
Definition at line 79 of file entry.cc. Referenced by fcfile_query_map_user_lee(), and sefs_entry_get_origin(). 00080 {
00081 return _origin;
00082 }
|
|
|
Return a string representation of this entry. The string is suitable for printing to the screen or to a file_contexts file.
Definition at line 84 of file entry.cc. References _context, _fclist, _path, sefs_context_node::context_str, QPOL_CLASS_ALL, QPOL_CLASS_BLK_FILE, QPOL_CLASS_CHR_FILE, QPOL_CLASS_DIR, QPOL_CLASS_FIFO_FILE, QPOL_CLASS_FILE, QPOL_CLASS_LNK_FILE, QPOL_CLASS_SOCK_FILE, and SEFS_ERR. Referenced by fcfile_query(), print_entry(), and sefs_entry_to_string(). 00085 {
00086 char *class_str;
00087
00088 switch (_objectClass)
00089 {
00090 case QPOL_CLASS_ALL:
00091 class_str = " ";
00092 break;
00093 case QPOL_CLASS_BLK_FILE:
00094 class_str = "-b";
00095 break;
00096 case QPOL_CLASS_CHR_FILE:
00097 class_str = "-c";
00098 break;
00099 case QPOL_CLASS_DIR:
00100 class_str = "-d";
00101 break;
00102 case QPOL_CLASS_FIFO_FILE:
00103 class_str = "-p";
00104 break;
00105 case QPOL_CLASS_FILE:
00106 class_str = "--";
00107 break;
00108 case QPOL_CLASS_LNK_FILE:
00109 class_str = "-l";
00110 break;
00111 case QPOL_CLASS_SOCK_FILE:
00112 class_str = "-s";
00113 break;
00114 default:
00115 // should never get here
00116 assert(0);
00117 class_str = "-?";
00118 }
00119
00120 char *s = NULL;
00121 if (asprintf(&s, "%s\t%s\t%s", _path, class_str, _context->context_str) < 0)
00122 {
00123 SEFS_ERR(_fclist, "%s", strerror(errno));
00124 throw std::bad_alloc();
00125 }
00126 return s;
00127 }
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 156 of file entry.hh. Referenced by sefs_entry(), and toString(). |
|
|
Definition at line 157 of file entry.hh. Referenced by context(), sefs_db::getContextNode(), sefs_fcfile::runQueryMap(), sefs_entry(), and toString(). |
|
|
Definition at line 158 of file entry.hh. Referenced by sefs_filesystem::getEntry(), sefs_db::getEntry(), and sefs_entry(). |
|
|
Definition at line 159 of file entry.hh. Referenced by sefs_filesystem::getEntry(), sefs_db::getEntry(), and sefs_entry(). |
|
|
Definition at line 160 of file entry.hh. Referenced by sefs_fcfile::runQueryMap(), and sefs_entry(). |
|
|
Definition at line 161 of file entry.hh. Referenced by sefs_fcfile::runQueryMap(), sefs_entry(), and toString(). |
|
|
Definition at line 161 of file entry.hh. Referenced by sefs_entry(). |