Home | History | Annotate | Download | only in bus
      1 /* selinux.h  SELinux security check headers for D-BUS
      2  *
      3  * Author: Matthew Rickard <mjricka (at) epoch.ncsc.mil>
      4  *
      5  * Licensed under the Academic Free License version 2.1
      6  *
      7  * This program is free software; you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation; either version 2 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * This program is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program; if not, write to the Free Software
     19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     20  *
     21  */
     22 
     23 #ifndef BUS_SELINUX_H
     24 #define BUS_SELINUX_H
     25 
     26 #include <dbus/dbus-hash.h>
     27 #include <dbus/dbus-connection.h>
     28 #include "services.h"
     29 
     30 dbus_bool_t bus_selinux_pre_init (void);
     31 dbus_bool_t bus_selinux_full_init(void);
     32 void        bus_selinux_shutdown (void);
     33 
     34 dbus_bool_t bus_selinux_enabled  (void);
     35 
     36 void bus_selinux_id_ref    (BusSELinuxID *sid);
     37 void bus_selinux_id_unref  (BusSELinuxID *sid);
     38 
     39 DBusHashTable* bus_selinux_id_table_new    (void);
     40 BusSELinuxID*  bus_selinux_id_table_lookup (DBusHashTable    *service_table,
     41                                             const DBusString *service_name);
     42 dbus_bool_t    bus_selinux_id_table_insert (DBusHashTable    *service_table,
     43                                             const char       *service_name,
     44                                             const char       *service_context);
     45 void           bus_selinux_id_table_print  (DBusHashTable    *service_table);
     46 const char*    bus_selinux_get_policy_root (void);
     47 
     48 dbus_bool_t    bus_selinux_append_context      (DBusMessage    *message,
     49 						BusSELinuxID   *context,
     50 						DBusError      *error);
     51 
     52 dbus_bool_t bus_selinux_allows_acquire_service (DBusConnection *connection,
     53                                                 BusSELinuxID   *service_sid,
     54 						const char     *service_name,
     55 						DBusError      *error);
     56 
     57 dbus_bool_t bus_selinux_allows_send            (DBusConnection *sender,
     58                                                 DBusConnection *proposed_recipient,
     59 						const char     *msgtype, /* Supplementary audit data */
     60 						const char     *interface,
     61 						const char     *member,
     62 						const char     *error_name,
     63 						const char     *destination,
     64 						DBusError      *error);
     65 
     66 BusSELinuxID* bus_selinux_init_connection_id (DBusConnection *connection,
     67                                               DBusError      *error);
     68 
     69 
     70 void bus_selinux_audit_init(void);
     71 
     72 #endif /* BUS_SELINUX_H */
     73