Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
Data Structures | Macros | Functions | Variables
common_config.c File Reference
#include "asterisk.h"
#include "asterisk/cli.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
#include "asterisk/stasis.h"
#include "asterisk/security_events.h"
#include "stir_shaken.h"
Include dependency graph for common_config.c:

Go to the source code of this file.

Data Structures

struct  enum_name_xref_entry
 

Macros

#define AST_API_MODULE
 
#define generate_bool_handler_functions(param_name)
 
#define generate_enum_string_functions(param_name, default_value, ...)
 
#define print_acl_cert_store(cfg, a, max_name_len)
 

Functions

char * canonicalize_tn (const char *tn, char *dest_tn)
 Canonicalize a TN. More...
 
char * canonicalize_tn_alloc (const char *tn)
 Canonicalize a TN into nre buffer. More...
 
static char * cli_verify_cert (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
int common_config_load (void)
 
int common_config_reload (void)
 
int common_config_unload (void)
 
int config_object_cli_show (void *obj, void *arg, void *data, int flags)
 Output configuration settings to the Asterisk CLI. More...
 
char * config_object_tab_complete_name (const char *word, struct ao2_container *container)
 Tab completion for name matching with STIR/SHAKEN CLI commands. More...
 
 generate_bool_handler_functions (check_tn_cert_public_url)
 
 generate_bool_handler_functions (load_system_certs)
 
 generate_bool_handler_functions (relax_x5u_path_restrictions)
 
 generate_bool_handler_functions (relax_x5u_port_scheme_restrictions)
 
 generate_bool_handler_functions (send_mky)
 
 generate_bool_handler_functions (use_rfc9410_responses)
 
 generate_enum_string_functions (attest_level, UNKNOWN, {attest_level_NOT_SET, "not_set"}, {attest_level_A, "A"}, {attest_level_B, "B"}, {attest_level_C, "C"},)
 
 generate_enum_string_functions (endpoint_behavior, OFF, {endpoint_behavior_OFF, "off"}, {endpoint_behavior_OFF, "none"}, {endpoint_behavior_ATTEST, "attest"}, {endpoint_behavior_VERIFY, "verify"}, {endpoint_behavior_ON, "on"}, {endpoint_behavior_ON, "both"})
 
 generate_enum_string_functions (stir_shaken_failure_action, CONTINUE, {stir_shaken_failure_action_CONTINUE, "continue"}, {stir_shaken_failure_action_REJECT_REQUEST, "reject_request"}, {stir_shaken_failure_action_CONTINUE_RETURN_REASON, "continue_return_reason"},)
 
struct ast_sorceryget_sorcery (void)
 Retrieve the stir/shaken sorcery context. More...
 
static void named_acl_changed_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message)
 
static void print_acl (int fd, struct ast_acl_list *acl_list, const char *prefix)
 
static const char * translate_value (const char *val)
 

Variables

static struct ast_cli_entry cli_commands []
 
struct stasis_subscriptionnamed_acl_changed_sub = NULL
 
static struct ast_sorcerysorcery
 

Macro Definition Documentation

◆ AST_API_MODULE

#define AST_API_MODULE

Definition at line 28 of file common_config.c.

◆ generate_bool_handler_functions

#define generate_bool_handler_functions (   param_name)

Definition at line 39 of file common_config.c.

◆ generate_enum_string_functions

#define generate_enum_string_functions (   param_name,
  default_value,
  ... 
)

Definition at line 77 of file common_config.c.

◆ print_acl_cert_store

#define print_acl_cert_store (   cfg,
  a,
  max_name_len 
)

Definition at line 151 of file common_config.c.

Function Documentation

◆ canonicalize_tn()

char * canonicalize_tn ( const char *  tn,
char *  dest_tn 
)

Canonicalize a TN.

Parameters
tnTN to canonicalize
dest_tnPointer to destination buffer to receive the new TN
Return values
dest_tnor NULL on failure

Definition at line 266 of file common_config.c.

267{
268 int i;
269 const char *s = tn;
270 size_t len = tn ? strlen(tn) : 0;
271 char *new_tn = dest_tn;
272 SCOPE_ENTER(3, "tn: %s\n", S_OR(tn, "(null)"));
273
274 if (ast_strlen_zero(tn)) {
275 *dest_tn = '\0';
276 SCOPE_EXIT_RTN_VALUE(NULL, "Empty TN\n");
277 }
278
279 if (!dest_tn) {
280 SCOPE_EXIT_RTN_VALUE(NULL, "No destination buffer\n");
281 }
282
283 for (i = 0; i < len; i++) {
284 if (isdigit(*s) || *s == '#' || *s == '*') { /* Only characters allowed */
285 *new_tn++ = *s;
286 }
287 s++;
288 }
289 *new_tn = '\0';
290 SCOPE_EXIT_RTN_VALUE(dest_tn, "Canonicalized '%s' -> '%s'\n", tn, dest_tn);
291}
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_ENTER(level,...)
#define NULL
Definition: resample.c:96
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65

References ast_strlen_zero(), len(), NULL, S_OR, SCOPE_ENTER, and SCOPE_EXIT_RTN_VALUE.

Referenced by canonicalize_tn_alloc().

◆ canonicalize_tn_alloc()

char * canonicalize_tn_alloc ( const char *  tn)

Canonicalize a TN into nre buffer.

Parameters
tnTN to canonicalize
Return values
dest_tn(which must be freed with ast_free) or NULL on failure

Definition at line 293 of file common_config.c.

294{
295 char *canon_tn = ast_strlen_zero(tn) ? NULL : ast_malloc(strlen(tn) + 1);
296 if (!canon_tn) {
297 return NULL;
298 }
299 return canonicalize_tn(tn, canon_tn);
300}
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:191
char * canonicalize_tn(const char *tn, char *dest_tn)
Canonicalize a TN.

References ast_malloc, ast_strlen_zero(), canonicalize_tn(), and NULL.

Referenced by ast_stir_shaken_as_ctx_create(), and ast_stir_shaken_vs_ctx_create().

◆ cli_verify_cert()

static char * cli_verify_cert ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
)
static

Definition at line 302 of file common_config.c.

303{
304 RAII_VAR(struct profile_cfg *, profile, NULL, ao2_cleanup);
305 RAII_VAR(struct verification_cfg *, vs_cfg, NULL, ao2_cleanup);
306 struct crypto_cert_store *tcs;
307 X509 *cert = NULL;
308 const char *errmsg = NULL;
309
310 switch(cmd) {
311 case CLI_INIT:
312 e->command = "stir_shaken verify certificate_file";
313 e->usage =
314 "Usage: stir_shaken verify certificate_file <certificate_file> [ <profile> ]\n"
315 " Verify an external certificate file against the global or profile verification store\n";
316 return NULL;
317 case CLI_GENERATE:
318 if (a->pos == 4) {
320 } else {
321 return NULL;
322 }
323 }
324
325 if (a->argc < 4) {
326 return CLI_SHOWUSAGE;
327 }
328
329 if (a->argc == 5) {
330 profile = profile_get_cfg(a->argv[4]);
331 if (!profile) {
332 ast_cli(a->fd, "Profile %s doesn't exist\n", a->argv[4]);
333 return CLI_SUCCESS;
334 }
335 if (!profile->vcfg_common.tcs) {
336 ast_cli(a->fd,"Profile %s doesn't have a certificate store\n", a->argv[4]);
337 return CLI_SUCCESS;
338 }
339 tcs = profile->vcfg_common.tcs;
340 } else {
341 vs_cfg = vs_get_cfg();
342 if (!vs_cfg) {
343 ast_cli(a->fd, "No verification store found\n");
344 return CLI_SUCCESS;
345 }
346 tcs = vs_cfg->vcfg_common.tcs;
347 }
348
349 cert = crypto_load_cert_from_file(a->argv[3]);
350 if (!cert) {
351 ast_cli(a->fd, "Failed to load certificate from %s. See log for details\n", a->argv[3]);
352 return CLI_SUCCESS;
353 }
354
355 if (crypto_is_cert_trusted(tcs, cert, &errmsg)) {
356 ast_cli(a->fd, "Certificate %s trusted\n", a->argv[3]);
357 } else {
358 ast_cli(a->fd, "Certificate %s NOT trusted: %s\n", a->argv[3], errmsg);
359 }
360 X509_free(cert);
361
362 return CLI_SUCCESS;
363}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define CLI_SUCCESS
Definition: cli.h:44
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
char * config_object_tab_complete_name(const char *word, struct ao2_container *container)
Tab completion for name matching with STIR/SHAKEN CLI commands.
struct verification_cfg * vs_get_cfg(void)
struct profile_cfg * profile_get_cfg(const char *id)
struct ao2_container * profile_get_all(void)
int crypto_is_cert_trusted(struct crypto_cert_store *store, X509 *cert, const char **err_msg)
Check if the cert is trusted.
Definition: crypto_utils.c:740
X509 * crypto_load_cert_from_file(const char *filename)
Load an X509 Cert from a file.
Definition: crypto_utils.c:189
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
ao2 object wrapper for X509_STORE that provides locking and refcounting
Definition: crypto_utils.h:179
Profile configuration for stir/shaken.
static struct test_val a
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References a, ao2_cleanup, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, config_object_tab_complete_name(), crypto_is_cert_trusted(), crypto_load_cert_from_file(), NULL, profile_get_all(), profile_get_cfg(), RAII_VAR, ast_cli_entry::usage, and vs_get_cfg().

◆ common_config_load()

int common_config_load ( void  )

Definition at line 420 of file common_config.c.

421{
422 SCOPE_ENTER(2, "Stir Shaken Load\n");
423
424 if (!(sorcery = ast_sorcery_open())) {
426 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken sorcery load failed\n");
427 }
428
429 if (vs_load()) {
431 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken VS load failed\n");
432 }
433
434 if (as_load()) {
436 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken AS load failed\n");
437 }
438
439 if (tn_config_load()) {
441 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken TN load failed\n");
442 }
443
444 if (profile_load()) {
446 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken profile load failed\n");
447 }
448
454 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken acl change subscribe failed\n");
455 }
458 }
459
461
462 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_SUCCESS, "Stir Shaken Load Done\n");
463}
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs
int as_load()
Load the stir/shaken attestation service.
Definition: attestation.c:440
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
int common_config_unload(void)
static struct ast_cli_entry cli_commands[]
struct stasis_subscription * named_acl_changed_sub
Definition: common_config.c:32
static void named_acl_changed_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static struct ast_sorcery * sorcery
Definition: common_config.c:31
int profile_load(void)
int tn_config_load(void)
Definition: tn_config.c:268
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
#define ast_sorcery_open()
Open a new sorcery structure.
Definition: sorcery.h:406
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
Definition: stasis.c:1024
#define stasis_subscribe(topic, callback, data)
Definition: stasis.h:649
#define ARRAY_LEN(a)
Definition: utils.h:666
int vs_load()
Load the stir/shaken verification service.

References ARRAY_LEN, as_load(), ast_cli_register_multiple, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_named_acl_change_type(), ast_security_topic(), ast_sorcery_open, cli_commands, common_config_unload(), named_acl_changed_cb(), named_acl_changed_sub, NULL, profile_load(), SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, sorcery, stasis_subscribe, stasis_subscription_accept_message_type(), tn_config_load(), and vs_load().

Referenced by load_module().

◆ common_config_reload()

int common_config_reload ( void  )

Definition at line 369 of file common_config.c.

370{
371 SCOPE_ENTER(2, "Stir Shaken Reload\n");
372 if (vs_reload()) {
373 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken VS Reload failed\n");
374 }
375
376 if (as_reload()) {
377 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken AS Reload failed\n");
378 }
379
380 if (tn_config_reload()) {
381 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken TN Reload failed\n");
382 }
383
384 if (profile_reload()) {
385 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken Profile Reload failed\n");
386 }
387
388 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_SUCCESS, "Stir Shaken Reload Done\n");
389}
int as_reload()
Load the stir/shaken attestation service.
Definition: attestation.c:427
int tn_config_reload(void)
Definition: tn_config.c:253
int profile_reload(void)
int vs_reload()
Reload the stir/shaken verification service.

References as_reload(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, profile_reload(), SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, tn_config_reload(), and vs_reload().

Referenced by named_acl_changed_cb(), and reload_module().

◆ common_config_unload()

int common_config_unload ( void  )

Definition at line 391 of file common_config.c.

392{
394
397 as_unload();
398 vs_unload();
399
403 }
405 sorcery = NULL;
406
407 return 0;
408}
int as_unload()
Load the stir/shaken attestation service.
Definition: attestation.c:434
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
int profile_unload(void)
int tn_config_unload(void)
Definition: tn_config.c:260
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
Definition: sorcery.h:1500
struct stasis_subscription * stasis_unsubscribe(struct stasis_subscription *subscription)
Cancel a subscription.
Definition: stasis.c:972
int vs_unload()
Unload the stir/shaken verification service.

References ARRAY_LEN, as_unload(), ast_cli_unregister_multiple(), ast_sorcery_unref, cli_commands, named_acl_changed_sub, NULL, profile_unload(), sorcery, stasis_unsubscribe(), tn_config_unload(), and vs_unload().

Referenced by common_config_load(), and unload_module().

◆ config_object_cli_show()

int config_object_cli_show ( void *  obj,
void *  arg,
void *  data,
int  flags 
)

Output configuration settings to the Asterisk CLI.

Parameters
objA sorcery object containing configuration data
argAsterisk CLI argument object
flagsao2 container flags
Return values
0

Definition at line 172 of file common_config.c.

173{
174 struct ast_cli_args *a = arg;
175 struct config_object_cli_data *cli_data = data;
176 struct ast_variable *options;
177 struct ast_variable *i;
178 const char *title = NULL;
179 const char *cfg_name = NULL;
180 int max_name_len = 0;
181
182 if (!obj) {
183 ast_cli(a->fd, "No stir/shaken configuration found\n");
184 return 0;
185 }
186
187 if (!ast_strlen_zero(cli_data->title)) {
188 title = cli_data->title;
189 } else {
190 title = ast_sorcery_object_get_type(obj);
191 }
192 max_name_len = strlen(title);
193
195 || cli_data->object_type == config_object_type_tn) {
196 cfg_name = ast_sorcery_object_get_id(obj);
197 max_name_len += strlen(cfg_name) + 2 /* ": " */;
198 }
199
202 if (!options) {
203 return 0;
204 }
205
206 for (i = options; i; i = i->next) {
207 int nlen = strlen(i->name);
208 max_name_len = (nlen > max_name_len) ? nlen : max_name_len;
209 }
210
211 ast_cli(a->fd, "\n==============================================================================\n");
212 if (ast_strlen_zero(cfg_name)) {
213 ast_cli(a->fd, "%s\n", title);
214 } else {
215 ast_cli(a->fd, "%s: %s\n", title, cfg_name);
216 }
217 ast_cli(a->fd, "------------------------------------------------------------------------------\n");
218
219 for (i = options; i; i = i->next) {
220 if (!ast_strings_equal(i->name, "x5u_acl")) {
221 ast_cli(a->fd, "%-*s: %s\n", max_name_len, i->name,
223 }
224 }
225
227
228 if (cli_data->object_type == config_object_type_profile) {
229 struct profile_cfg *cfg = obj;
230 print_acl_cert_store(cfg, a, max_name_len);
231 } else if (cli_data->object_type == config_object_type_verification) {
232 struct verification_cfg *cfg = obj;
233 print_acl_cert_store(cfg, a, max_name_len);
234 }
235 ast_cli(a->fd, "---------------------------------------------\n\n"); \
236
237 return 0;
238}
static const char * translate_value(const char *val)
#define print_acl_cert_store(cfg, a, max_name_len)
struct ast_sorcery * get_sorcery(void)
Retrieve the stir/shaken sorcery context.
Definition: common_config.c:34
@ config_object_type_tn
@ config_object_type_profile
@ config_object_type_verification
struct ast_variable * ast_variable_list_sort(struct ast_variable *head)
Performs an in-place sort on the variable list by ascending name.
Definition: main/config.c:621
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1262
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Definition: sorcery.c:2317
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
Definition: sorcery.c:2329
@ AST_HANDLER_ONLY_STRING
Use string handler only.
Definition: sorcery.h:137
struct ast_variable * ast_sorcery_objectset_create2(const struct ast_sorcery *sorcery, const void *object, enum ast_sorcery_field_handler_flags flags)
Create an object set (KVP list) for an object.
Definition: sorcery.c:1511
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
Definition: strings.c:238
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
enum config_object_type object_type
static struct test_options options

References a, ast_cli(), AST_HANDLER_ONLY_STRING, ast_sorcery_object_get_id(), ast_sorcery_object_get_type(), ast_sorcery_objectset_create2(), ast_strings_equal(), ast_strlen_zero(), ast_variable_list_sort(), ast_variables_destroy(), config_object_type_profile, config_object_type_tn, config_object_type_verification, get_sorcery(), ast_variable::name, ast_variable::next, NULL, config_object_cli_data::object_type, options, print_acl_cert_store, config_object_cli_data::title, translate_value(), and ast_variable::value.

Referenced by attestation_show(), cli_eprofile_show(), cli_eprofile_show_all(), cli_profile_show(), cli_profile_show_all(), cli_tn_show(), cli_tn_show_all(), and cli_verification_show().

◆ config_object_tab_complete_name()

char * config_object_tab_complete_name ( const char *  word,
struct ao2_container container 
)

Tab completion for name matching with STIR/SHAKEN CLI commands.

Parameters
wordThe word to tab complete on
containerThe sorcery container to iterate through
Return values
Thetab completion options

Definition at line 240 of file common_config.c.

241{
242 void *obj;
243 struct ao2_iterator it;
244 int wordlen = strlen(word);
245 int ret;
246
248 while ((obj = ao2_iterator_next(&it))) {
249 if (!strncasecmp(word, ast_sorcery_object_get_id(obj), wordlen)) {
251 if (ret) {
252 ao2_ref(obj, -1);
253 break;
254 }
255 }
256 ao2_ref(obj, -1);
257 }
259
260 return NULL;
261}
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
Definition: main/cli.c:2768
short word
struct ao2_container * container
Definition: res_fax.c:501
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821

References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli_completion_add(), ast_sorcery_object_get_id(), ast_strdup, container, and NULL.

Referenced by cli_eprofile_show(), cli_profile_show(), cli_tn_show(), and cli_verify_cert().

◆ generate_bool_handler_functions() [1/6]

generate_bool_handler_functions ( check_tn_cert_public_url  )

◆ generate_bool_handler_functions() [2/6]

generate_bool_handler_functions ( load_system_certs  )

◆ generate_bool_handler_functions() [3/6]

generate_bool_handler_functions ( relax_x5u_path_restrictions  )

◆ generate_bool_handler_functions() [4/6]

generate_bool_handler_functions ( relax_x5u_port_scheme_restrictions  )

◆ generate_bool_handler_functions() [5/6]

generate_bool_handler_functions ( send_mky  )

◆ generate_bool_handler_functions() [6/6]

generate_bool_handler_functions ( use_rfc9410_responses  )

◆ generate_enum_string_functions() [1/3]

generate_enum_string_functions ( attest_level  ,
UNKNOWN  ,
{attest_level_NOT_SET, "not_set"}  ,
{attest_level_A, "A"}  ,
{attest_level_B, "B"}  ,
{attest_level_C, "C"}   
)

◆ generate_enum_string_functions() [2/3]

generate_enum_string_functions ( endpoint_behavior  ,
OFF  ,
{endpoint_behavior_OFF, "off"}  ,
{endpoint_behavior_OFF, "none"}  ,
{endpoint_behavior_ATTEST, "attest"}  ,
{endpoint_behavior_VERIFY, "verify"}  ,
{endpoint_behavior_ON, "on"}  ,
{endpoint_behavior_ON, "both"}   
)

◆ generate_enum_string_functions() [3/3]

generate_enum_string_functions ( stir_shaken_failure_action  ,
CONTINUE  ,
{stir_shaken_failure_action_CONTINUE, "continue"}  ,
{stir_shaken_failure_action_REJECT_REQUEST, "reject_request"}  ,
{stir_shaken_failure_action_CONTINUE_RETURN_REASON, "continue_return_reason"}   
)

◆ get_sorcery()

struct ast_sorcery * get_sorcery ( void  )

◆ named_acl_changed_cb()

static void named_acl_changed_cb ( void *  data,
struct stasis_subscription sub,
struct stasis_message message 
)
static

Definition at line 410 of file common_config.c.

412{
414 return;
415 }
416 ast_log(LOG_NOTICE, "Named acl changed. Reloading verification and profile\n");
418}
#define ast_log
Definition: astobj2.c:42
int common_config_reload(void)
#define LOG_NOTICE
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.

References ast_log, ast_named_acl_change_type(), common_config_reload(), LOG_NOTICE, and stasis_message_type().

Referenced by common_config_load().

◆ print_acl()

static void print_acl ( int  fd,
struct ast_acl_list acl_list,
const char *  prefix 
)
static

Definition at line 135 of file common_config.c.

136{
137 struct ast_acl *acl;
138
139 AST_LIST_LOCK(acl_list);
140 AST_LIST_TRAVERSE(acl_list, acl, list) {
141 if (ast_strlen_zero(acl->name)) {
142 ast_cli(fd, "%s(permit/deny)\n", prefix);
143 } else {
144 ast_cli(fd, "%s%s\n", prefix, acl->name);
145 }
146 ast_ha_output(fd, acl->acl, prefix);
147 }
148 AST_LIST_UNLOCK(acl_list);
149}
void ast_ha_output(int fd, const struct ast_ha *ha, const char *prefix)
output an HA to the provided fd
Definition: acl.c:1103
static char prefix[MAX_PREFIX]
Definition: http.c:144
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:40
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:140
Definition: test_acl.c:111
an ast_acl is a linked list node of ast_ha structs which may have names.
Definition: acl.h:67
struct ast_ha * acl
Definition: acl.h:68
struct ast_acl::@180 list

References ast_acl::acl, ast_cli(), ast_ha_output(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), ast_acl::list, and prefix.

◆ translate_value()

static const char * translate_value ( const char *  val)
static

Definition at line 124 of file common_config.c.

125{
126 if (val[0] == '0'
127 || val[0] == '\0'
128 || strcmp(val, "not_set") == 0) {
129 return "";
130 }
131
132 return val;
133}
Definition: ast_expr2.c:325

Referenced by config_object_cli_show().

Variable Documentation

◆ cli_commands

struct ast_cli_entry cli_commands[]
static
Initial value:
= {
{ .handler = cli_verify_cert , .summary = "Verify a certificate file against the global or a profile verification store" ,},
}
static char * cli_verify_cert(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)

Definition at line 365 of file common_config.c.

Referenced by common_config_load(), and common_config_unload().

◆ named_acl_changed_sub

struct stasis_subscription* named_acl_changed_sub = NULL

Definition at line 32 of file common_config.c.

Referenced by common_config_load(), and common_config_unload().

◆ sorcery

struct ast_sorcery* sorcery
static

Definition at line 31 of file common_config.c.

Referenced by common_config_load(), common_config_unload(), and get_sorcery().