Collaboration diagram for Nuauth:
|
Files | |
| file | authsrv.c |
| Main file. | |
Modules | |
| Nuauth Core | |
| This is the main part of nuauth, real core is search_and_fill(). | |
| Cache system | |
| Fixed timeout connections handling | |
| Hello Authentication | |
| Nuauth Modules | |
| Modules are used for every interaction with the outside. They are implemented using Glib modules. | |
| TLS servers | |
Data Structures | |
| struct | command_line_params_t |
Defines | |
| #define | OVERWRITE_DATA(x) |
Functions | |
| void | cleanup_func_push (cleanup_func_t func) |
| void | cleanup_func_remove (cleanup_func_t func) |
| void | wait_thread_pool (const char *name, GThreadPool *pool) |
| void | wait_all_thread_pools () |
| void | block_thread_pools () |
| void | release_thread_pools () |
| void | start_all_thread_pools () |
| void | stop_thread_pool (const char *name, GThreadPool **pool) |
| void | stop_all_thread_pools (gboolean soft) |
| void | stop_threads (gboolean wait) |
| void | free_threads () |
| void | clear_push_queue () |
| void | nuauth_deinit (gboolean soft) |
| void | nuauth_ask_exit () |
| void | nuauth_atexit () |
| void | nuauth_cleanup (int recv_signal) |
| void | daemonize () |
| void | print_usage () |
| void | parse_options (int argc, char **argv, command_line_params_t *params) |
| void | no_action_signals (int recv_signal) |
| void | nuauth_install_signals (gboolean sig_action) |
| static void | nuauthconf_from_cmdline (command_line_params_t *params) |
| void | configure_app (int argc, char **argv) |
| void | init_nuauthdata () |
| void | main_cleanup () |
| void | nuauth_main_loop () |
| int | main (int argc, char *argv[]) |
Variables | |
| int | nuauth_running = 1 |
| GList * | cleanup_func_list = NULL |
| #define OVERWRITE_DATA | ( | x | ) |
Value:
if (params->x) { \ g_free(nuauthconf->x); \ nuauthconf->x = g_strdup(params->x); \ }
Definition at line 652 of file authsrv.c.
Referenced by nuauthconf_from_cmdline().
| void block_thread_pools | ( | ) |
Definition at line 114 of file authsrv.c.
References nuauth_datas::need_reload, and nuauthdatas.
Referenced by init_nuauthdata(), and nuauth_reload().
| void cleanup_func_push | ( | cleanup_func_t | func | ) |
Add a cleanup function: it would be called every second. Functions are stored in cleanup_func_list list.
See also cleanup_func_remove()
Definition at line 67 of file authsrv.c.
References cleanup_func_list.
Referenced by g_module_check_init(), nuauth_main_loop(), and tls_user_init().
| void cleanup_func_remove | ( | cleanup_func_t | func | ) |
Remove a cleanup function from cleanup_func_list list.
See also cleanup_func_push()
Definition at line 77 of file authsrv.c.
References cleanup_func_list.
Referenced by g_module_unload().
| void clear_push_queue | ( | ) |
Delete all items (call g_free()) of nuauthdatas->tls_push_queue queue.
Definition at line 305 of file authsrv.c.
References internal_message::datas, INSERT_MESSAGE, nuauthdatas, nuauth_datas::tls_push_queue, internal_message::type, and WARN_MESSAGE.
Referenced by nuauth_deinit().
| void configure_app | ( | int | argc, | |
| char ** | argv | |||
| ) |
Configure NuAuth:
Definition at line 680 of file authsrv.c.
References command_line_params_t::authreq_port, build_prenuauthconf(), command_line_params_t::client_srv, nuauth_params::configfile, command_line_params_t::configfile, daemonize(), command_line_params_t::daemonize, DEBUG_AREA_MAIN, nuauth_params::debug_areas, nuauth_params::debug_level, command_line_params_t::debug_level, DEBUG_LEVEL_FATAL, DEFAULT_CONF_FILE, DEFAULT_DEBUG_AREAS, DEFAULT_DEBUG_LEVEL, gcry_threads_gthread, init_nuauthconf(), nuauth_datas::is_starting, log_area_printf(), log_message, MAX_DEBUG_LEVEL, MIN_DEBUG_LEVEL, nuauthconf, nuauthconf_from_cmdline(), nuauthdatas, command_line_params_t::nufw_srv, nussl_init(), NUSSL_OK, parse_configuration(), parse_options(), nuauth_datas::program_fullpath, nuauth_datas::reload_cond, nuauth_datas::reload_cond_mutex, TRUE, command_line_params_t::userpckt_port, and nuauth_params::uses_utf8.
Referenced by main().
Here is the call graph for this function:

| void daemonize | ( | ) |
Daemonize the process:
Definition at line 432 of file authsrv.c.
References DEBUG_AREA_MAIN, log_message, NUAUTH_PID_FILE, and set_glib_loghandlers().
Referenced by configure_app(), and main().
Here is the call graph for this function:

| void free_threads | ( | ) |
Definition at line 289 of file authsrv.c.
References nuauth_params::hello_authentication, nuauth_datas::limited_connections_handler, nuauth_datas::localid_auth_thread, nuauthconf, nuauthdatas, nuauth_params::push, nuauth_datas::search_and_fill_worker, thread_destroy(), thread_list_destroy(), nuauth_datas::tls_auth_servers, nuauth_datas::tls_nufw_servers, and nuauth_datas::tls_pusher.
Referenced by nuauth_deinit().
Here is the call graph for this function:

| void init_nuauthdata | ( | ) |
Initialize all data:
Other queue, threads, etc. are created elsewhere:
Definition at line 846 of file authsrv.c.
References nuauth_params::acl_cache, nuauth_datas::aclqueue, block_thread_pools(), nuauth_datas::command_thread, conn_list, nuauth_datas::connections_queue, DEBUG_AREA_MAIN, FALSE, free_connection(), hash_connection(), nuauth_params::hello_authentication, init_acl_cache(), init_modules_system(), init_periods(), init_user_cache(), insert_mutex, nuauth_datas::is_starting, limited_connection_handler(), nuauth_datas::limited_connections_handler, load_modules(), localid_auth(), nuauth_datas::localid_auth_queue, nuauth_datas::localid_auth_thread, log_message, nuauthconf, nuauthdatas, nuauth_params::nufw_has_conntrack, null_message, null_queue_datas, nuauth_params::periods, nuauth_params::push, push_worker(), release_thread_pools(), search_and_fill(), nuauth_datas::search_and_fill_worker, start_all_thread_pools(), thread_new(), nuauth_datas::tls_auth_servers, tls_common_init(), nuauth_datas::tls_nufw_servers, tls_nufw_start_servers(), nuauth_datas::tls_push_queue, nuauth_datas::tls_pusher, tls_user_start_servers(), tracking_equal(), nuauth_params::user_cache, and nuauth_datas::userqueue.
Referenced by main().
Here is the call graph for this function:

| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
NuAuth entry point:
Definition at line 1062 of file authsrv.c.
References configure_app(), init_audit(), init_nuauthdata(), nuauth_install_signals(), nuauth_main_loop(), and TRUE.
Here is the call graph for this function:

| void main_cleanup | ( | ) |
Function called every second to cleanup things:
Definition at line 947 of file authsrv.c.
References nuauth_datas::acl_cache, nuauth_params::acl_cache, act_on_loggers_processing(), clean_connections_list(), conn_list, DEBUG_AREA_MAIN, DEBUG_LEVEL_INFO, DEBUG_OR_NOT, nuauth_params::hello_authentication, nuauth_datas::limited_connections_queue, nuauth_datas::localid_auth_queue, nuauthconf, nuauthdatas, nuauth_params::nufw_has_conntrack, nuauth_params::push, cache_class_t::queue, REFRESH_MESSAGE, internal_message::type, cache_message::type, and nuauth_datas::user_checkers.
Referenced by nuauth_main_loop().
Here is the call graph for this function:

| void no_action_signals | ( | int | recv_signal | ) |
Definition at line 629 of file authsrv.c.
References DEBUG_AREA_MAIN, log_message, and tls_common_deinit().
Referenced by nuauth_install_signals().
Here is the call graph for this function:

| void nuauth_ask_exit | ( | ) |
Call this function to stop nuauth.
Definition at line 375 of file authsrv.c.
References nuauth_running.
Referenced by tls_common_init(), tls_nufw_authsrv(), tls_nufw_main_loop(), tls_nufw_start_servers(), tls_user_authsrv(), tls_user_main_loop(), and tls_user_start_servers().
| void nuauth_atexit | ( | ) |
This is exit() handler. It's used on fatal error of NuAuth. nuauth_cleanup() also call it, but this call is ignored, because nuauth_cleanup() set nuauth_running to 0.
Definition at line 387 of file authsrv.c.
References DEBUG_AREA_MAIN, FALSE, log_message, nuauth_deinit(), and nuauth_running.
Referenced by nuauth_install_signals().
Here is the call graph for this function:

| void nuauth_cleanup | ( | int | recv_signal | ) |
Function called when a SIGTERM or SIGINT is received:
| recv_signal | Code of raised signal |
Definition at line 403 of file authsrv.c.
References DEBUG_AREA_MAIN, FALSE, log_message, nuauth_deinit(), nuauth_install_signals(), nuauth_running, and TRUE.
Referenced by nuauth_install_signals().
Here is the call graph for this function:

| void nuauth_deinit | ( | gboolean | soft | ) |
Deinit NuAuth:
Definition at line 331 of file authsrv.c.
References nuauth_datas::acl_cache, nuauth_params::acl_cache, cache_destroy(), clear_push_queue(), conn_list, DEBUG_AREA_MAIN, end_audit(), free_nuauth_params(), free_threads(), insert_mutex, log_message, NUAUTH_PID_FILE, nuauthconf, nuauthdatas, nuauth_datas::program_fullpath, stop_threads(), unload_modules(), nuauth_datas::user_cache, and nuauth_params::user_cache.
Referenced by nuauth_atexit(), and nuauth_cleanup().
Here is the call graph for this function:

| void nuauth_install_signals | ( | gboolean | sig_action | ) |
Install all signals used in NuAuth:
Definition at line 586 of file authsrv.c.
References DEBUG_AREA_MAIN, log_message, no_action_signals(), nuauth_atexit(), nuauth_cleanup(), nuauth_reload(), nuauthdatas, nuauth_datas::old_sighup_hdl, nuauth_datas::old_sigint_hdl, and nuauth_datas::old_sigterm_hdl.
Referenced by main(), nuauth_cleanup(), and nuauth_reload().
Here is the call graph for this function:

| void nuauth_main_loop | ( | ) |
Main loop: refresh connection queue and all other queues
Definition at line 1006 of file authsrv.c.
References cleanup_func_list, cleanup_func_push(), DEBUG_AREA_MAIN, log_message, and main_cleanup().
Referenced by main().
Here is the call graph for this function:

| static void nuauthconf_from_cmdline | ( | command_line_params_t * | params | ) | [static] |
Definition at line 658 of file authsrv.c.
References authreq_port, command_line_params_t::debug_level, nuauth_params::debug_level, nuauthconf, and OVERWRITE_DATA.
Referenced by configure_app().
| void parse_options | ( | int | argc, | |
| char ** | argv, | |||
| command_line_params_t * | params | |||
| ) |
Parse command line options using getopt library.
Definition at line 507 of file authsrv.c.
References command_line_params_t::authreq_port, command_line_params_t::client_srv, command_line_params_t::configfile, command_line_params_t::daemonize, command_line_params_t::debug_level, NUAUTH_FULL_VERSION, nuauthconf, command_line_params_t::nufw_srv, nuauth_params::packet_timeout, print_usage(), and command_line_params_t::userpckt_port.
Referenced by configure_app().
Here is the call graph for this function:

| void print_usage | ( | ) |
Display all command line options of NuAuth
Definition at line 487 of file authsrv.c.
Referenced by parse_options().
| void release_thread_pools | ( | ) |
Definition at line 119 of file authsrv.c.
References nuauth_datas::need_reload, nuauthdatas, nuauth_datas::reload_cond, and nuauth_datas::reload_cond_mutex.
Referenced by init_nuauthdata(), and nuauth_reload().
| void start_all_thread_pools | ( | ) |
Definition at line 129 of file authsrv.c.
References acl_check_and_decide(), nuauth_datas::acl_checkers, DEBUG_AREA_MAIN, decisions_queue_work(), nuauth_datas::decisions_workers, nuauth_params::do_ip_authentication, external_ip_auth(), nuauth_datas::ip_authentication_workers, log_message, log_user_session_thread(), nuauth_params::log_users_sync, nuauth_params::nbacl_check, nuauth_params::nbipauth_check, nuauth_params::nbloggers, nuauth_params::nbuser_check, nuauthconf, nuauthdatas, POOL_TYPE, real_log_user_packet(), user_check_and_decide(), nuauth_datas::user_checkers, nuauth_datas::user_loggers, and nuauth_datas::user_session_loggers.
Referenced by init_nuauthdata().
Here is the call graph for this function:

| void stop_all_thread_pools | ( | gboolean | soft | ) |
Stop all nuauth thread pools If soft is true, destroy pools.
Definition at line 194 of file authsrv.c.
References nuauth_datas::acl_checkers, nuauth_datas::decisions_workers, nuauth_params::do_ip_authentication, nuauth_datas::ip_authentication_workers, nuauth_params::log_users_sync, nuauthconf, nuauthdatas, stop_thread_pool(), nuauth_datas::user_checkers, nuauth_datas::user_loggers, and nuauth_datas::user_session_loggers.
Referenced by stop_threads().
Here is the call graph for this function:

| void stop_thread_pool | ( | const char * | name, | |
| GThreadPool ** | pool | |||
| ) |
Stop one thread pool
Definition at line 182 of file authsrv.c.
References DEBUG, DEBUG_AREA_MAIN, log_message, and TRUE.
Referenced by compare_nuauthparams(), and stop_all_thread_pools().
| void stop_threads | ( | gboolean | wait | ) |
Ask all threads to stop (by locking their mutex), and then wait until they really stop (if wait is TRUE) using g_thread_join() and g_thread_pool_free().
| wait | If wait is TRUE, the function will block until all threads stopped. Else, it will just ask all threads to stop. |
Definition at line 223 of file authsrv.c.
References close_clients(), close_nufw_servers(), nuauth_datas::command_thread, DEBUG, DEBUG_AREA_MAIN, nuauth_params::hello_authentication, nuauth_datas::limited_connections_handler, nuauth_datas::localid_auth_thread, log_message, nuauthconf, nuauthdatas, nuauth_datas::pre_client_thread, nuauth_params::push, nuauth_datas::search_and_fill_worker, stop_all_thread_pools(), nuauth_thread_t::thread, thread_list_stop(), thread_list_wait_end(), thread_stop(), thread_wait_end(), nuauth_datas::tls_auth_servers, nuauth_datas::tls_nufw_servers, and nuauth_datas::tls_pusher.
Referenced by nuauth_deinit().
Here is the call graph for this function:

| void wait_all_thread_pools | ( | ) |
Definition at line 96 of file authsrv.c.
References nuauth_datas::acl_checkers, nuauth_datas::decisions_workers, nuauth_params::do_ip_authentication, nuauth_datas::ip_authentication_workers, nuauth_params::log_users_sync, nuauthconf, nuauthdatas, nuauth_datas::user_checkers, nuauth_datas::user_loggers, nuauth_datas::user_session_loggers, and wait_thread_pool().
Referenced by nuauth_reload().
Here is the call graph for this function:

| void wait_thread_pool | ( | const char * | name, | |
| GThreadPool * | pool | |||
| ) |
Definition at line 85 of file authsrv.c.
References DEBUG, DEBUG_AREA_MAIN, and log_message.
Referenced by wait_all_thread_pools().
| GList* cleanup_func_list = NULL |
Definition at line 59 of file authsrv.c.
Referenced by cleanup_func_push(), cleanup_func_remove(), and nuauth_main_loop().
| int nuauth_running = 1 |
Definition at line 57 of file authsrv.c.
Referenced by nuauth_ask_exit(), nuauth_atexit(), and nuauth_cleanup().
1.4.7