42 .category =
"general",
54 if (!strcasecmp(var->
name,
"pretty")) {
70 if (strcasecmp(var->
value,
"plain") == 0) {
72 }
else if (strcasecmp(var->
value,
"crypt") == 0) {
98 ast_debug(3,
"Allocating user %s\n", cat);
107 if (!
user->username) {
116 static int user_sort_cmp(
const void *obj_left,
const void *obj_right,
int flags)
120 const char *key_right = obj_right;
128 cmp = strcasecmp(user_left->
username, key_right);
135 cmp = strncasecmp(user_left->
username, key_right, strlen(key_right));
160 .category =
"general",
161 .matchfield =
"type",
162 .matchvalue =
"user",
214 #define CONF_FILENAME "ari.conf" 221 .types =
ACO_TYPES(&general_option, &user_option),
256 "User '%s' missing password; authentication failed\n",
261 switch (
user->password_format) {
263 is_valid = strcmp(password,
user->password) == 0;
310 if (
conf->general->enabled) {
void ast_ari_config_destroy(void)
Destroy the ARI configuration.
static struct aco_type user_option
static struct aco_file conf_file
The conf file that's processed for the module.
static struct aco_type general_option
Mapping of the ARI conf struct's globals to the general context in the config file.
Asterisk main include file. File version handling, generic pbx functions.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
static void * user_find(struct ao2_container *tmp_container, const char *cat)
aco_type item_find function
static int password_format_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Parses the ast_ari_password_format enum from a config file.
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
struct ast_ari_conf * ast_ari_config_get(void)
Get the current ARI configuration.
The arg parameter is a search key, but is not an object.
static void user_dtor(void *obj)
Destructor for ast_ari_conf_user.
static struct aco_type * general_options[]
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
struct ast_ari_conf_general * general
#define ao2_callback(c, flags, cb_fn, arg)
All configuration options for ARI.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
static int process_config(int reload)
Load (or reload) configuration.
Structure for variables, used for configurations and for channel variables.
#define ARI_PASSWORD_LEN
User's password mx length.
Type for a default handler that should do nothing.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
int ast_ari_config_reload(void)
Reload the ARI configuration.
#define ao2_global_obj_ref(holder)
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ast_strdup(str)
A wrapper for strdup()
The representation of a single configuration file to be processed.
list of users found in the config file
void ast_channel_set_ari_vars(size_t varc, char **vars)
Sets the variables to be stored in the ari_vars field of all snapshots.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
static struct ast_str * password
#define ast_strlen_zero(foo)
All configuration options for statsd client.
Type for default option handler for character array strings.
#define ast_debug(level,...)
Log a DEBUG message.
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
Global configuration options for ARI.
static int channelvars_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
General Asterisk PBX channel definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ARI_AUTH_REALM_LEN
#define ao2_ref(o, delta)
#define ast_strdupa(s)
duplicate a string in memory from the stack
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
The config had not been edited and no changes applied.
Their was an error and no changes were applied.
Configuration option-handling.
static int user_sort_cmp(const void *obj_left, const void *obj_right, int flags)
Sorting function for use with red/black tree.
Per-user configuration options.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
enum ast_json_encoding_format format
Internal API's for res_ari.
static int validate_user_cb(void *obj, void *arg, int flags)
Callback to validate a user object.
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
#define ao2_global_obj_release(holder)
Type for default option handler for bools (ast_true/ast_false)
char password[ARI_PASSWORD_LEN]
CONFIG_INFO_STANDARD(cfg_info, confs, conf_alloc,.files=ACO_FILES(&conf_file))
int ast_ari_config_init(void)
Initialize the ARI configuration.
static void * conf_alloc(void)
Allocate an ast_ari_conf for config parsing.
static void parse(struct mgcp_request *req)
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
The config was processed and applied.
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
#define ao2_find(container, arg, flags)
static AO2_GLOBAL_OBJ_STATIC(confs)
Locking container for safe configuration access.
structure to hold users read from users.conf
enum ast_ari_password_format password_format
static void * user_alloc(const char *cat)
Allocate an ast_ari_conf_user for config parsing.
The arg parameter is an object of the same type.
Replace objects with duplicate keys in container.
Type information about a category-level configurable object.
int ast_crypt_validate(const char *key, const char *expected)
Asterisk wrapper around crypt(3) for validating passwords.
#define AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR
Default websocket write timeout, in ms (as a string)
Type for default option handler for stringfields.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
struct ast_ari_conf_user * ast_ari_config_validate_user(const char *username, const char *password)
Validated a user's credentials.
Search option field mask.
Type for default option handler for signed integers.
static void conf_destructor(void *obj)
ast_ari_conf destructor.
static void conf_general_dtor(void *obj)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static int encoding_format_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Encoding format handler converts from boolean to enum.
static struct aco_type * global_user[]
struct ao2_container * users
#define AST_APP_ARG(name)
Define an application argument.