Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Named Access Control Lists. More...
#include "asterisk.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/cli.h"
#include "asterisk/acl.h"
#include "asterisk/astobj2.h"
#include "asterisk/paths.h"
#include "asterisk/stasis.h"
#include "asterisk/json.h"
#include "asterisk/security_events.h"
Go to the source code of this file.
Data Structures | |
struct | named_acl |
struct | named_acl_config |
Macros | |
#define | ACL_FAMILY "acls" |
#define | AST_MODULE "acl" |
#define | NACL_CONFIG "acl.conf" |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | acl_order_comparator (struct ast_category *p, struct ast_category *q) |
static | AO2_GLOBAL_OBJ_STATIC (globals) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
struct ast_ha * | ast_named_acl_find (const char *name, int *is_realtime, int *is_undefined) |
Retrieve a named ACL. More... | |
static void | cli_display_named_acl (int fd, const char *name) |
static void | cli_display_named_acl_list (int fd) |
CONFIG_INFO_CORE ("named_acl", cfg_info, globals, named_acl_config_alloc,.files=ACO_FILES(&named_acl_conf),) | |
static void | destroy_named_acl (void *obj) |
Destroy a named ACL object. More... | |
static char * | handle_show_named_acl_cmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
ACL command show <name> More... | |
static int | load_module (void) |
static void * | named_acl_alloc (const char *cat) |
Create a named ACL structure. More... | |
static void * | named_acl_config_alloc (void) |
allocator callback for named_acl_config. Notice it returns void * since it is used by the backend config code More... | |
static void | named_acl_config_destructor (void *obj) |
destructor for named_acl_config More... | |
static void * | named_acl_find (struct ao2_container *container, const char *cat) |
Find a named ACL in a container by its name. More... | |
static struct named_acl * | named_acl_find_realtime (const char *name) |
static int | publish_acl_change (const char *name) |
static int | reload_module (void) |
STASIS_MESSAGE_TYPE_DEFN (ast_named_acl_change_type) | |
Message type for named ACL changes. More... | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = "acl" , .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Named ACL system" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CORE, .requires = "extconfig", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_named_acl [] |
struct aco_file | named_acl_conf |
static struct aco_type | named_acl_type |
struct aco_type * | named_acl_types [] = ACO_TYPES(&named_acl_type) |
Named Access Control Lists.
Definition in file named_acl.c.
#define ACL_FAMILY "acls" |
Definition at line 50 of file named_acl.c.
#define AST_MODULE "acl" |
Definition at line 33 of file named_acl.c.
#define NACL_CONFIG "acl.conf" |
Definition at line 49 of file named_acl.c.
|
static |
Definition at line 590 of file named_acl.c.
|
static |
Definition at line 590 of file named_acl.c.
|
static |
Definition at line 201 of file named_acl.c.
References ast_category_first(), ast_variable::name, ast_variable::next, and ast_variable::value.
Referenced by named_acl_find_realtime().
|
static |
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 590 of file named_acl.c.
struct ast_ha * ast_named_acl_find | ( | const char * | name, |
int * | is_realtime, | ||
int * | is_undefined | ||
) |
Retrieve a named ACL.
This function attempts to find a named ACL. If found, a copy of the requested ACL will be made which must be freed by the caller.
name | Name of the ACL sought | |
[out] | is_realtime | will be true if the ACL being returned is from realtime |
[out] | is_undefined | will be true if no ACL profile can be found for the requested name |
NULL | if no ACL could be found. |
Definition at line 293 of file named_acl.c.
References ACL_FAMILY, ao2_cleanup, ao2_global_obj_ref, ast_check_realtime(), ast_duplicate_ha_list(), ast_log, ast_realtime_is_mapping_defined(), globals, named_acl::ha, LOG_ERROR, LOG_NOTICE, LOG_WARNING, name, named_acl_find(), named_acl_find_realtime(), NULL, and RAII_VAR.
Referenced by ast_append_acl().
|
static |
Definition at line 412 of file named_acl.c.
References ao2_cleanup, ao2_global_obj_ref, ast_cli(), ast_ha_output(), ast_log, globals, named_acl::ha, LOG_ERROR, name, named_acl_find(), named_acl_find_realtime(), NULL, and RAII_VAR.
Referenced by handle_show_named_acl_cmd().
|
static |
Definition at line 447 of file named_acl.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli(), globals, named_acl::name, and RAII_VAR.
Referenced by handle_show_named_acl_cmd().
CONFIG_INFO_CORE | ( | "named_acl" | , |
cfg_info | , | ||
globals | , | ||
named_acl_config_alloc | , | ||
. | files = ACO_FILES(&named_acl_conf) |
||
) |
|
static |
Destroy a named ACL object.
Definition at line 148 of file named_acl.c.
References ast_free_ha(), and named_acl::ha.
Referenced by named_acl_alloc().
|
static |
ACL command show <name>
Definition at line 471 of file named_acl.c.
References a, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli_completion_add(), ast_strdup, cli_display_named_acl(), cli_display_named_acl_list(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, named_acl::name, named_acl_config::named_acl_list, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 564 of file named_acl.c.
References ACO_EXACT, aco_info_init(), aco_option_register, aco_process_config(), ARRAY_LEN, ast_cli_register_multiple, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_named_acl_change_type(), cli_named_acl, FLDSET, named_acl_types, NULL, OPT_ACL_T, and STASIS_MESSAGE_TYPE_INIT.
|
static |
Create a named ACL structure.
cat | name given to the ACL |
NULL | failure |
non-NULL | successfully allocated named ACL |
Definition at line 161 of file named_acl.c.
References ao2_alloc, ast_copy_string(), destroy_named_acl(), named_acl::name, and NULL.
Referenced by named_acl_find_realtime().
|
static |
allocator callback for named_acl_config. Notice it returns void * since it is used by the backend config code
Definition at line 126 of file named_acl.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, error(), named_acl_config_destructor(), named_acl_config::named_acl_list, and NULL.
|
static |
destructor for named_acl_config
Definition at line 117 of file named_acl.c.
References ao2_cleanup, and named_acl_config::named_acl_list.
Referenced by named_acl_config_alloc().
|
static |
Find a named ACL in a container by its name.
container | ao2container holding the named ACLs |
cat | name of the ACL wanted to be found |
pointer | to the named ACL if available. Null if not found. |
Definition at line 182 of file named_acl.c.
References ao2_find, ast_copy_string(), container, OBJ_POINTER, and tmp().
Referenced by ast_named_acl_find(), and cli_display_named_acl().
|
static |
Definition at line 240 of file named_acl.c.
References ACL_FAMILY, acl_order_comparator(), ast_append_ha(), ast_category_browse(), ast_config_AST_SYSTEM_NAME, ast_config_destroy(), ast_config_sort_categories(), ast_free_ha(), ast_load_realtime_multientry(), ast_log, ast_strlen_zero(), ast_variable_retrieve(), item, LOG_ERROR, name, named_acl_alloc(), NULL, order, and SENTINEL.
Referenced by ast_named_acl_find(), and cli_display_named_acl().
|
static |
Definition at line 371 of file named_acl.c.
References ao2_cleanup, ast_json_object_create(), ast_json_object_set(), ast_json_payload_create(), ast_json_string_create(), ast_json_unref(), ast_log, ast_named_acl_change_type(), ast_security_topic(), ast_strlen_zero(), LOG_ERROR, name, NULL, RAII_VAR, stasis_message_create(), and stasis_publish().
Referenced by reload_module().
|
static |
Definition at line 529 of file named_acl.c.
References aco_process_config(), ACO_PROCESS_ERROR, ACO_PROCESS_UNCHANGED, ast_log, LOG_WARNING, publish_acl_change(), and status.
STASIS_MESSAGE_TYPE_DEFN | ( | ast_named_acl_change_type | ) |
Message type for named ACL changes.
|
static |
Definition at line 553 of file named_acl.c.
References aco_info_destroy(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_named_acl_change_type(), cli_named_acl, globals, and STASIS_MESSAGE_TYPE_CLEANUP.
|
static |
Definition at line 590 of file named_acl.c.
|
static |
Definition at line 590 of file named_acl.c.
|
static |
Definition at line 525 of file named_acl.c.
Referenced by load_module(), and unload_module().
struct aco_file named_acl_conf |
Definition at line 98 of file named_acl.c.
|
static |
Definition at line 85 of file named_acl.c.
struct aco_type* named_acl_types[] = ACO_TYPES(&named_acl_type) |
Definition at line 96 of file named_acl.c.
Referenced by load_module().