#include "dazuko_platform.h"
#include "dazuko_xp.h"
#include "dazukoio.h"
#include "dazuko_call.h"
Go to the source code of this file.
Defines | |
#define | NUM_SLOT_LISTS 5 |
#define | NUM_SLOTS 25 |
#define | SCAN_ON_OPEN (access_mask & DAZUKO_ON_OPEN) |
#define | SCAN_ON_CLOSE (access_mask & DAZUKO_ON_CLOSE) |
#define | SCAN_ON_EXEC (access_mask & DAZUKO_ON_EXEC) |
#define | SCAN_ON_CLOSE_MODIFIED (access_mask & DAZUKO_ON_CLOSE_MODIFIED) |
#define | DAZUKO_VSNPRINTF_PRINTSTRING |
#define | DAZUKO_VSNPRINT(type, name) dazuko_snprintf(request->reply_buffer + request->reply_buffer_size_used, (request->reply_buffer_size - request->reply_buffer_size_used) - 1, "%s%" #type , key, *((name *)value)) |
Functions | |
int | dazuko_vsnprintf (char *str, size_t size, const char *format, va_list ap) |
int | dazuko_snprintf (char *str, size_t size, const char *format,...) |
void | dazuko_bzero (void *p, int len) |
static int | dazuko_get_new_unique (void) |
static int | dazuko_slot_state (struct slot *s) |
static int | one_slot_state_not_condition (void *param) |
static int | two_slot_state_not_condition (void *param) |
static int | __dazuko_change_slot_state (struct slot *s, int from_state, int to_state) |
static int | dazuko_change_slot_state (struct slot *s, int from_state, int to_state, int release) |
static struct slot * | _dazuko_find_slot (struct daemon_id *did, int release, struct slot_list *sl) |
static struct slot * | dazuko_find_slot_and_slotlist (struct daemon_id *did, int release, struct slot_list *slist, struct slot_list **sl_result) |
static struct slot * | dazuko_find_slot (struct daemon_id *did, int release, struct slot_list *slist) |
static int | dazuko_insert_path_fs (struct path **list, char *fs_path, int fs_len) |
static void | dazuko_remove_all_hash (void) |
static void | dazuko_remove_all_paths (void) |
static int | _dazuko_unregister_daemon (struct daemon_id *did) |
int | dazuko_unregister_daemon (struct xp_daemon_id *xp_id) |
static int | dazuko_state_error (struct slot *s, int current_state) |
static int | dazuko_register_daemon (struct daemon_id *did, const char *reg_name, int string_length, int write_mode) |
static struct slot * | dazuko_get_an_access (struct daemon_id *did) |
static int | dazuko_return_access (struct daemon_id *did, int response, struct slot *s) |
static int | dazuko_isdigit (const char c) |
static long | dazuko_strtol (const char *string) |
static int | dazuko_strlen (const char *string) |
static const char * | dazuko_strchr (const char *haystack, char needle) |
static const char * | dazuko_strstr (const char *haystack, const char *needle) |
int | dazuko_get_value (const char *key, const char *string, char **value) |
static void | dazuko_clear_replybuffer (struct dazuko_request *request) |
static void | dazuko_close_replybuffer (struct dazuko_request *request) |
static void | dazuko_add_keyvalue_to_replybuffer (struct dazuko_request *request, const char *key, void *value, char vtype) |
static int | dazuko_printable (char c) |
static void | dazuko_add_esc_to_replybuffer (struct dazuko_request *request, const char *key, char **filename) |
static int | dazuko_set_option (struct daemon_id *did, int opt, void *param, int len) |
static int | dazuko_handle_request (struct dazuko_request *request, struct xp_daemon_id *xp_id) |
int | dazuko_handle_user_request (struct dazuko_request *user_request, struct xp_daemon_id *xp_id) |
int | dazuko_handle_user_request_compat12 (void *ptr, int cmd, struct xp_daemon_id *xp_id) |
static struct slot * | dazuko_get_and_hold_ready_slot (struct slot_list *sl) |
static int | get_ready_slot_condition (void *param) |
static int | dazuko_run_daemon_on_slotlist (int event, char *filename, int filenamelength, struct event_properties *event_p, struct file_properties *file_p, int prev_response, struct slot_list *sl) |
static int | dazuko_run_daemon (int event, char *filename, int filenamelength, struct event_properties *event_p, struct file_properties *file_p) |
int | dazuko_is_our_daemon (struct xp_daemon_id *xp_id) |
static int | dazuko_is_selected (struct dazuko_file_struct *kfs) |
static int | dazuko_add_hash (struct xp_file *file, char *filename, int len) |
static void | dazuko_mark_hash_dirty (struct xp_file *file) |
static struct hash * | dazuko_get_hash (struct xp_file *file) |
int | dazuko_get_filename_length (char *filename) |
static int | dazuko_should_scan (struct dazuko_file_struct *kfs) |
int | dazuko_sys_check (unsigned long event, int daemon_is_allowed, struct xp_daemon_id *xp_id) |
int | dazuko_sys_pre (unsigned long event, struct dazuko_file_struct *kfs, struct xp_file *file, struct event_properties *event_p) |
int | dazuko_sys_post (unsigned long event, struct dazuko_file_struct *kfs, struct xp_file *file, struct event_properties *event_p) |
int | dazuko_init (void) |
int | dazuko_exit (void) |
Variables | |
static int | unique_count = 1 |
static char | access_mask = 7 |
static struct slot_list_container | slot_lists [NUM_SLOT_LISTS] |
static struct path * | incl_paths = NULL |
static struct path * | excl_paths = NULL |
static struct hash * | hash = NULL |
static struct xp_rwlock | lock_hash |
static struct xp_rwlock | lock_lists |
static struct xp_atomic | active |
static struct xp_mutex | mutex_unique_count |
static struct xp_queue | wait_kernel_waiting_for_free_slot |
static struct xp_queue | wait_daemon_waiting_for_work |
static struct xp_queue | wait_kernel_waiting_while_daemon_works |
static struct xp_queue | wait_daemon_waiting_for_free |
|
Referenced by dazuko_add_keyvalue_to_replybuffer(). |
|
Value: for ( ; *s ; s++) \ { \ if (target == end) \ { \ overflow = 1; \ goto dazuko_vsnprintf_out; \ } \ *target = *s; \ target++; \ } Referenced by dazuko_vsnprintf(). |
|
Definition at line 42 of file dazuko_xp.c. |
|
Definition at line 43 of file dazuko_xp.c. Referenced by _dazuko_find_slot(), dazuko_exit(), dazuko_get_and_hold_ready_slot(), and dazuko_register_daemon(). |
|
Definition at line 46 of file dazuko_xp.c. Referenced by dazuko_sys_check(), and dazuko_sys_post(). |
|
Definition at line 48 of file dazuko_xp.c. Referenced by dazuko_sys_check(), and dazuko_sys_post(). |
|
Definition at line 47 of file dazuko_xp.c. |
|
Definition at line 45 of file dazuko_xp.c. Referenced by dazuko_sys_check(), dazuko_sys_post(), and dazuko_sys_pre(). |
|
Definition at line 329 of file dazuko_xp.c. References call_xp_notify(), DAZUKO_FREE, and DAZUKO_READY. Referenced by _dazuko_unregister_daemon(), dazuko_change_slot_state(), dazuko_register_daemon(), and dazuko_run_daemon_on_slotlist(). |
|
Definition at line 387 of file dazuko_xp.c. References call_xp_down(), call_xp_id_compare(), call_xp_print, call_xp_up(), slot::did, slot::mutex, NULL, NUM_SLOTS, slot_list::slots, daemon_id::unique, and daemon_id::xp_id. Referenced by dazuko_find_slot_and_slotlist(). |
|
Definition at line 632 of file dazuko_xp.c. References __dazuko_change_slot_state(), call_xp_atomic_dec(), call_xp_atomic_read(), call_xp_id_free(), call_xp_notify(), call_xp_print, call_xp_up(), dazuko_find_slot_and_slotlist(), DAZUKO_FREE, dazuko_remove_all_hash(), dazuko_remove_all_paths(), slot::did, DPRINT, slot::mutex, NULL, daemon_id::unique, slot_list::use_count, and daemon_id::xp_id. Referenced by dazuko_set_option(), and dazuko_unregister_daemon(). |
|
Definition at line 1223 of file dazuko_xp.c. References dazuko_add_keyvalue_to_replybuffer(), dazuko_printable(), dazuko_snprintf(), dazuko_request::reply_buffer, dazuko_request::reply_buffer_size, and dazuko_request::reply_buffer_size_used. Referenced by dazuko_handle_request(). |
|
Definition at line 2341 of file dazuko_xp.c. References call_xp_copy_file(), call_xp_malloc(), call_xp_write_lock(), call_xp_write_unlock(), hash::dirty, hash::file, hash::name, hash::namelen, hash::next, NULL, and XP_ERROR_FAULT. Referenced by dazuko_sys_post(). |
|
Definition at line 1187 of file dazuko_xp.c. References DAZUKO_VSNPRINT, dazuko_request::reply_buffer, and dazuko_request::reply_buffer_size_used. Referenced by dazuko_add_esc_to_replybuffer(), and dazuko_handle_request(). |
|
Definition at line 273 of file dazuko_xp.c. Referenced by dazuko_clear_replybuffer(), dazuko_init(), dazuko_is_selected(), dazuko_register_daemon(), dazuko_run_daemon_on_slotlist(), linux_dazuko_device_read(), rsbac_adf_request_daz(), and rsbac_adf_set_attr_daz(). |
|
Definition at line 361 of file dazuko_xp.c. References __dazuko_change_slot_state(), call_xp_down(), call_xp_up(), and slot::mutex. Referenced by dazuko_get_an_access(), dazuko_get_and_hold_ready_slot(), dazuko_return_access(), dazuko_run_daemon_on_slotlist(), and dazuko_state_error(). |
|
Definition at line 1175 of file dazuko_xp.c. References dazuko_bzero(), dazuko_request::reply_buffer, dazuko_request::reply_buffer_size, and dazuko_request::reply_buffer_size_used. Referenced by dazuko_handle_request(). |
|
Definition at line 1181 of file dazuko_xp.c. References dazuko_request::reply_buffer, and dazuko_request::reply_buffer_size_used. Referenced by dazuko_handle_request(). |
|
Definition at line 2837 of file dazuko_xp.c. References call_xp_atomic_read(), call_xp_destroy_mutex(), call_xp_destroy_queue(), call_xp_destroy_rwlock(), call_xp_free(), call_xp_print, call_xp_sys_unhook, dazuko_remove_all_hash(), dazuko_remove_all_paths(), slot_list_container::mutex, NULL, NUM_SLOTS, slot_list_container::slot_list, and VERSION. |
|
Definition at line 498 of file dazuko_xp.c. References dazuko_find_slot_and_slotlist(), and NULL. Referenced by dazuko_get_an_access(), dazuko_is_our_daemon(), dazuko_register_daemon(), dazuko_return_access(), and dazuko_set_option(). |
|
Definition at line 455 of file dazuko_xp.c. References _dazuko_find_slot(), call_xp_down(), call_xp_up(), NULL, and slot_list_container::slot_list. Referenced by _dazuko_unregister_daemon(), and dazuko_find_slot(). |
|
Definition at line 894 of file dazuko_xp.c. References call_xp_notify(), call_xp_print, call_xp_wait_until_condition(), DAZUKO_BROKEN, dazuko_change_slot_state(), dazuko_find_slot(), DAZUKO_READY, dazuko_register_daemon(), DAZUKO_WAITING, DAZUKO_WORKING, DPRINT, NULL, one_slot_state_not_condition(), one_slot_state_not_condition_param::slot, one_slot_state_not_condition_param::state, and daemon_id::unique. Referenced by dazuko_handle_request(), and dazuko_handle_user_request_compat12(). |
|
Definition at line 1991 of file dazuko_xp.c. References dazuko_change_slot_state(), DAZUKO_READY, DAZUKO_WAITING, NULL, NUM_SLOTS, and slot_list::slots. Referenced by get_ready_slot_condition(). |
|
Definition at line 2499 of file dazuko_xp.c. Referenced by xp_fill_file_struct(). |
|
Definition at line 2461 of file dazuko_xp.c. References call_xp_compare_file(), call_xp_write_lock(), call_xp_write_unlock(), hash::file, hash::next, and NULL. Referenced by dazuko_sys_post(). |
|
Definition at line 283 of file dazuko_xp.c. References call_xp_down(), call_xp_up(), and unique_count. Referenced by dazuko_register_daemon(). |
|
Definition at line 1141 of file dazuko_xp.c. References call_xp_malloc(), dazuko_strlen(), dazuko_strstr(), and NULL. Referenced by dazuko_handle_request(), and linux_dazuko_device_write(). |
|
|
Definition at line 1653 of file dazuko_xp.c. References dazuko_request::buffer, dazuko_request::buffer_size, call_xp_copyin(), call_xp_copyout(), call_xp_free(), call_xp_malloc(), dazuko_handle_request(), NULL, dazuko_request::reply_buffer, dazuko_request::reply_buffer_size, dazuko_request::reply_buffer_size_used, dazuko_request::type, XP_ERROR_FAULT, and XP_ERROR_PERMISSION. Referenced by linux_dazuko_device_write(). |
|
|
Definition at line 2807 of file dazuko_xp.c. References call_xp_atomic_set(), call_xp_init_mutex(), call_xp_init_queue(), call_xp_init_rwlock(), call_xp_print, call_xp_sys_hook, dazuko_bzero(), and VERSION. Referenced by rsbac_init_daz(). |
|
Definition at line 503 of file dazuko_xp.c. References call_xp_free(), call_xp_is_absolute_path(), call_xp_malloc(), call_xp_write_lock(), call_xp_write_unlock(), DPRINT, path::len, path::next, NULL, path::path, XP_ERROR_FAULT, and XP_ERROR_INVALID. Referenced by dazuko_set_option(). |
|
Definition at line 2218 of file dazuko_xp.c. References call_xp_id_copy(), call_xp_id_free(), dazuko_find_slot(), NULL, daemon_id::unique, and daemon_id::xp_id. Referenced by dazuko_sys_check(). |
|
Definition at line 2236 of file dazuko_xp.c. References dazuko_file_struct::aliases, call_xp_print, call_xp_read_lock(), call_xp_read_unlock(), dazuko_bzero(), dazuko_file_listnode::filename, dazuko_file_struct::filename, dazuko_file_struct::filename_length, dazuko_file_listnode::filename_length, path::len, path::next, dazuko_file_listnode::next, NULL, path::path, xp_free(), and xp_malloc(). Referenced by dazuko_should_scan(). |
|
Definition at line 1043 of file dazuko_xp.c. Referenced by dazuko_strtol(). |
|
Definition at line 2374 of file dazuko_xp.c. References call_xp_compare_file(), call_xp_write_lock(), call_xp_write_unlock(), hash::dirty, hash::file, hash::next, and NULL. Referenced by dazuko_sys_post(). |
|
Definition at line 1216 of file dazuko_xp.c. Referenced by dazuko_add_esc_to_replybuffer(). |
|
|
Definition at line 575 of file dazuko_xp.c. References call_xp_free(), call_xp_write_lock(), call_xp_write_unlock(), DPRINT, hash::name, and hash::next. Referenced by _dazuko_unregister_daemon(), and dazuko_exit(). |
|
Definition at line 596 of file dazuko_xp.c. References call_xp_free(), call_xp_write_lock(), call_xp_write_unlock(), DPRINT, path::next, and path::path. Referenced by _dazuko_unregister_daemon(), dazuko_exit(), and dazuko_set_option(). |
|
|
Definition at line 2170 of file dazuko_xp.c. References call_xp_down(), call_xp_up(), dazuko_run_daemon_on_slotlist(), NULL, slot_list_container::slot_list, event_properties::thrown, and XP_ERROR_INTERRUPT. Referenced by dazuko_sys_post(), and dazuko_sys_pre(). |
|
|
Definition at line 1276 of file dazuko_xp.c. References _dazuko_unregister_daemon(), access_mask, ADD_EXCLUDE_PATH, ADD_INCLUDE_PATH, call_xp_print, dazuko_find_slot(), dazuko_insert_path_fs(), dazuko_register_daemon(), dazuko_remove_all_paths(), NULL, REGISTER, REMOVE_ALL_PATHS, SET_ACCESS_MASK, UNREGISTER, and XP_ERROR_PERMISSION. Referenced by dazuko_handle_request(), and dazuko_handle_user_request_compat12(). |
|
Definition at line 2508 of file dazuko_xp.c. References call_xp_fill_file_struct(), dazuko_is_selected(), and dazuko_file_struct::should_scan. Referenced by dazuko_sys_post(), and dazuko_sys_pre(). |
|
Definition at line 299 of file dazuko_xp.c. References call_xp_down(), call_xp_up(), slot::mutex, slot::state, and XP_ERROR_INTERRUPT. Referenced by one_slot_state_not_condition(), and two_slot_state_not_condition(). |
|
Definition at line 261 of file dazuko_xp.c. References dazuko_vsnprintf(). Referenced by dazuko_add_esc_to_replybuffer(), and linux_dazuko_device_read(). |
|
Definition at line 723 of file dazuko_xp.c. References call_xp_notify(), DAZUKO_BROKEN, and dazuko_change_slot_state(). Referenced by dazuko_handle_user_request_compat12(). |
|
Definition at line 1101 of file dazuko_xp.c. References NULL. Referenced by dazuko_handle_request(). |
|
Definition at line 1088 of file dazuko_xp.c. References NULL. Referenced by dazuko_get_value(), and dazuko_handle_request(). |
|
Definition at line 1117 of file dazuko_xp.c. References NULL. Referenced by dazuko_get_value(). |
|
Definition at line 1048 of file dazuko_xp.c. References dazuko_isdigit(), and NULL. Referenced by dazuko_handle_request(). |
|
Definition at line 2563 of file dazuko_xp.c. References access_mask, call_xp_atomic_read(), dazuko_is_our_daemon(), DAZUKO_ON_CLOSE, DAZUKO_ON_OPEN, SCAN_ON_CLOSE, SCAN_ON_CLOSE_MODIFIED, and SCAN_ON_OPEN. Referenced by rsbac_adf_request_daz(), and rsbac_adf_set_attr_daz(). |
|
Definition at line 2726 of file dazuko_xp.c. References call_xp_atomic_read(), call_xp_free(), dazuko_add_hash(), dazuko_get_hash(), dazuko_mark_hash_dirty(), DAZUKO_ON_CLOSE, DAZUKO_ON_CLOSE_MODIFIED, DAZUKO_ON_OPEN, dazuko_run_daemon(), dazuko_should_scan(), hash::dirty, hash::name, hash::namelen, NULL, SCAN_ON_CLOSE, SCAN_ON_CLOSE_MODIFIED, and SCAN_ON_OPEN. Referenced by rsbac_adf_set_attr_daz(). |
|
|
Definition at line 705 of file dazuko_xp.c. References _dazuko_unregister_daemon(), call_xp_id_copy(), call_xp_id_free(), NULL, daemon_id::unique, and daemon_id::xp_id. Referenced by linux_dazuko_device_release(). |
|
Definition at line 149 of file dazuko_xp.c. References DAZUKO_VSNPRINTF_PRINTSTRING, and NULL. Referenced by dazuko_snprintf(), and xp_print(). |
|
Definition at line 2020 of file dazuko_xp.c. References call_xp_atomic_read(), dazuko_get_and_hold_ready_slot(), and NULL. Referenced by dazuko_run_daemon_on_slotlist(). |
|
Definition at line 315 of file dazuko_xp.c. References dazuko_slot_state(). Referenced by dazuko_get_an_access(), and dazuko_return_access(). |
|
Definition at line 321 of file dazuko_xp.c. References dazuko_slot_state(). Referenced by dazuko_run_daemon_on_slotlist(). |
|
Definition at line 133 of file dazuko_xp.c. Referenced by dazuko_handle_request(), dazuko_set_option(), and dazuko_sys_check(). |
|
Definition at line 140 of file dazuko_xp.c. |
|
Definition at line 136 of file dazuko_xp.c. |
|
Definition at line 137 of file dazuko_xp.c. |
|
Definition at line 135 of file dazuko_xp.c. |
|
Definition at line 138 of file dazuko_xp.c. |
|
Definition at line 139 of file dazuko_xp.c. |
|
Definition at line 141 of file dazuko_xp.c. |
|
Definition at line 134 of file dazuko_xp.c. |
|
Definition at line 132 of file dazuko_xp.c. Referenced by dazuko_get_new_unique(). |
|
Definition at line 146 of file dazuko_xp.c. |
|
Definition at line 144 of file dazuko_xp.c. |
|
Definition at line 143 of file dazuko_xp.c. |
|
Definition at line 145 of file dazuko_xp.c. |