Asterisk - The Open Source Telephony Project GIT-master-fe341c2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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 (ignore_sip_date_header)
 
 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 78 of file common_config.c.

◆ print_acl_cert_store

#define print_acl_cert_store (   cfg,
  a,
  max_name_len 
)

Definition at line 152 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 267 of file common_config.c.

268{
269 int i;
270 const char *s = tn;
271 size_t len = tn ? strlen(tn) : 0;
272 char *new_tn = dest_tn;
273 SCOPE_ENTER(3, "tn: %s\n", S_OR(tn, "(null)"));
274
275 if (ast_strlen_zero(tn)) {
276 *dest_tn = '\0';
277 SCOPE_EXIT_RTN_VALUE(NULL, "Empty TN\n");
278 }
279
280 if (!dest_tn) {
281 SCOPE_EXIT_RTN_VALUE(NULL, "No destination buffer\n");
282 }
283
284 for (i = 0; i < len; i++) {
285 if (isdigit(*s) || *s == '#' || *s == '*') { /* Only characters allowed */
286 *new_tn++ = *s;
287 }
288 s++;
289 }
290 *new_tn = '\0';
291 SCOPE_EXIT_RTN_VALUE(dest_tn, "Canonicalized '%s' -> '%s'\n", tn, dest_tn);
292}
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 294 of file common_config.c.

295{
296 char *canon_tn = ast_strlen_zero(tn) ? NULL : ast_malloc(strlen(tn) + 1);
297 if (!canon_tn) {
298 return NULL;
299 }
300 return canonicalize_tn(tn, canon_tn);
301}
#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 303 of file common_config.c.

304{
305 RAII_VAR(struct profile_cfg *, profile, NULL, ao2_cleanup);
306 RAII_VAR(struct verification_cfg *, vs_cfg, NULL, ao2_cleanup);
307 struct crypto_cert_store *tcs;
308 X509 *cert = NULL;
309 const char *errmsg = NULL;
310
311 switch(cmd) {
312 case CLI_INIT:
313 e->command = "stir_shaken verify certificate_file";
314 e->usage =
315 "Usage: stir_shaken verify certificate_file <certificate_file> [ <profile> ]\n"
316 " Verify an external certificate file against the global or profile verification store\n";
317 return NULL;
318 case CLI_GENERATE:
319 if (a->pos == 4) {
321 } else {
322 return NULL;
323 }
324 }
325
326 if (a->argc < 4) {
327 return CLI_SHOWUSAGE;
328 }
329
330 if (a->argc == 5) {
331 profile = profile_get_cfg(a->argv[4]);
332 if (!profile) {
333 ast_cli(a->fd, "Profile %s doesn't exist\n", a->argv[4]);
334 return CLI_SUCCESS;
335 }
336 if (!profile->vcfg_common.tcs) {
337 ast_cli(a->fd,"Profile %s doesn't have a certificate store\n", a->argv[4]);
338 return CLI_SUCCESS;
339 }
340 tcs = profile->vcfg_common.tcs;
341 } else {
342 vs_cfg = vs_get_cfg();
343 if (!vs_cfg) {
344 ast_cli(a->fd, "No verification store found\n");
345 return CLI_SUCCESS;
346 }
347 tcs = vs_cfg->vcfg_common.tcs;
348 }
349
350 cert = crypto_load_cert_from_file(a->argv[3]);
351 if (!cert) {
352 ast_cli(a->fd, "Failed to load certificate from %s. See log for details\n", a->argv[3]);
353 return CLI_SUCCESS;
354 }
355
356 if (crypto_is_cert_trusted(tcs, cert, &errmsg)) {
357 ast_cli(a->fd, "Certificate %s trusted\n", a->argv[3]);
358 } else {
359 ast_cli(a->fd, "Certificate %s NOT trusted: %s\n", a->argv[3], errmsg);
360 }
361 X509_free(cert);
362
363 return CLI_SUCCESS;
364}
#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 421 of file common_config.c.

422{
423 SCOPE_ENTER(2, "Stir Shaken Load\n");
424
425 if (!(sorcery = ast_sorcery_open())) {
427 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken sorcery load failed\n");
428 }
429
430 if (vs_load()) {
432 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken VS load failed\n");
433 }
434
435 if (as_load()) {
437 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken AS load failed\n");
438 }
439
440 if (tn_config_load()) {
442 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken TN load failed\n");
443 }
444
445 if (profile_load()) {
447 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken profile load failed\n");
448 }
449
455 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken acl change subscribe failed\n");
456 }
459 }
460
462
463 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_SUCCESS, "Stir Shaken Load Done\n");
464}
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:1050
#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 370 of file common_config.c.

371{
372 SCOPE_ENTER(2, "Stir Shaken Reload\n");
373 if (vs_reload()) {
374 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken VS Reload failed\n");
375 }
376
377 if (as_reload()) {
378 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken AS Reload failed\n");
379 }
380
381 if (tn_config_reload()) {
382 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken TN Reload failed\n");
383 }
384
385 if (profile_reload()) {
386 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_DECLINE, "Stir Shaken Profile Reload failed\n");
387 }
388
389 SCOPE_EXIT_RTN_VALUE(AST_MODULE_LOAD_SUCCESS, "Stir Shaken Reload Done\n");
390}
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 392 of file common_config.c.

393{
395
398 as_unload();
399 vs_unload();
400
404 }
406 sorcery = NULL;
407
408 return 0;
409}
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:998
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 173 of file common_config.c.

174{
175 struct ast_cli_args *a = arg;
176 struct config_object_cli_data *cli_data = data;
177 struct ast_variable *options;
178 struct ast_variable *i;
179 const char *title = NULL;
180 const char *cfg_name = NULL;
181 int max_name_len = 0;
182
183 if (!obj) {
184 ast_cli(a->fd, "No stir/shaken configuration found\n");
185 return 0;
186 }
187
188 if (!ast_strlen_zero(cli_data->title)) {
189 title = cli_data->title;
190 } else {
191 title = ast_sorcery_object_get_type(obj);
192 }
193 max_name_len = strlen(title);
194
196 || cli_data->object_type == config_object_type_tn) {
197 cfg_name = ast_sorcery_object_get_id(obj);
198 max_name_len += strlen(cfg_name) + 2 /* ": " */;
199 }
200
203 if (!options) {
204 return 0;
205 }
206
207 for (i = options; i; i = i->next) {
208 int nlen = strlen(i->name);
209 max_name_len = (nlen > max_name_len) ? nlen : max_name_len;
210 }
211
212 ast_cli(a->fd, "\n==============================================================================\n");
213 if (ast_strlen_zero(cfg_name)) {
214 ast_cli(a->fd, "%s\n", title);
215 } else {
216 ast_cli(a->fd, "%s: %s\n", title, cfg_name);
217 }
218 ast_cli(a->fd, "------------------------------------------------------------------------------\n");
219
220 for (i = options; i; i = i->next) {
221 if (!ast_strings_equal(i->name, "x5u_acl")) {
222 ast_cli(a->fd, "%-*s: %s\n", max_name_len, i->name,
224 }
225 }
226
228
229 if (cli_data->object_type == config_object_type_profile) {
230 struct profile_cfg *cfg = obj;
231 print_acl_cert_store(cfg, a, max_name_len);
232 } else if (cli_data->object_type == config_object_type_verification) {
233 struct verification_cfg *cfg = obj;
234 print_acl_cert_store(cfg, a, max_name_len);
235 }
236 ast_cli(a->fd, "---------------------------------------------\n\n"); \
237
238 return 0;
239}
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:706
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 241 of file common_config.c.

242{
243 void *obj;
244 struct ao2_iterator it;
245 int wordlen = strlen(word);
246 int ret;
247
249 while ((obj = ao2_iterator_next(&it))) {
250 if (!strncasecmp(word, ast_sorcery_object_get_id(obj), wordlen)) {
252 if (ret) {
253 ao2_ref(obj, -1);
254 break;
255 }
256 }
257 ao2_ref(obj, -1);
258 }
260
261 return NULL;
262}
#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:531
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/7]

generate_bool_handler_functions ( check_tn_cert_public_url  )

◆ generate_bool_handler_functions() [2/7]

generate_bool_handler_functions ( ignore_sip_date_header  )

◆ generate_bool_handler_functions() [3/7]

generate_bool_handler_functions ( load_system_certs  )

◆ generate_bool_handler_functions() [4/7]

generate_bool_handler_functions ( relax_x5u_path_restrictions  )

◆ generate_bool_handler_functions() [5/7]

generate_bool_handler_functions ( relax_x5u_port_scheme_restrictions  )

◆ generate_bool_handler_functions() [6/7]

generate_bool_handler_functions ( send_mky  )

◆ generate_bool_handler_functions() [7/7]

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 411 of file common_config.c.

413{
415 return;
416 }
417 ast_log(LOG_NOTICE, "Named acl changed. Reloading verification and profile\n");
419}
#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 136 of file common_config.c.

137{
138 struct ast_acl *acl;
139
140 AST_LIST_LOCK(acl_list);
141 AST_LIST_TRAVERSE(acl_list, acl, list) {
142 if (ast_strlen_zero(acl->name)) {
143 ast_cli(fd, "%s(permit/deny)\n", prefix);
144 } else {
145 ast_cli(fd, "%s%s\n", prefix, acl->name);
146 }
147 ast_ha_output(fd, acl->acl, prefix);
148 }
149 AST_LIST_UNLOCK(acl_list);
150}
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 125 of file common_config.c.

126{
127 if (val[0] == '0'
128 || val[0] == '\0'
129 || strcmp(val, "not_set") == 0) {
130 return "";
131 }
132
133 return val;
134}
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 366 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().