mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
res_stir_shaken: Check for disabled before param validation
For both attestation and verification, we now check whether they've
been disabled either globally or by the profile before validating
things like callerid, orig_tn, dest_tn, etc. This prevents useless
error messages.
Resolves: #879
(cherry picked from commit 7773327546
)
This commit is contained in:
committed by
Asterisk Development Team
parent
9a1ff05b0e
commit
41bcc40fc5
@@ -660,14 +660,10 @@ enum ast_stir_shaken_vs_response_code
|
||||
const char *t = S_OR(tag, S_COR(chan, ast_channel_name(chan), ""));
|
||||
SCOPE_ENTER(3, "%s: Enter\n", t);
|
||||
|
||||
if (ast_strlen_zero(tag)) {
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_INVALID_ARGUMENTS,
|
||||
LOG_ERROR, "%s: Must provide tag\n", t);
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(canon_caller_id)) {
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_INVALID_ARGUMENTS,
|
||||
LOG_ERROR, "%s: Must provide caller_id\n", t);
|
||||
vs = vs_get_cfg();
|
||||
if (vs->global_disable) {
|
||||
SCOPE_EXIT_RTN_VALUE(AST_STIR_SHAKEN_VS_DISABLED,
|
||||
"%s: Globally disabled\n", t);
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(profile_name)) {
|
||||
@@ -675,12 +671,6 @@ enum ast_stir_shaken_vs_response_code
|
||||
"%s: Disabled due to missing profile name\n", t);
|
||||
}
|
||||
|
||||
vs = vs_get_cfg();
|
||||
if (vs->global_disable) {
|
||||
SCOPE_EXIT_RTN_VALUE(AST_STIR_SHAKEN_VS_DISABLED,
|
||||
"%s: Globally disabled\n", t);
|
||||
}
|
||||
|
||||
profile = eprofile_get_cfg(profile_name);
|
||||
if (!profile) {
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_DISABLED,
|
||||
@@ -690,7 +680,17 @@ enum ast_stir_shaken_vs_response_code
|
||||
|
||||
if (!PROFILE_ALLOW_VERIFY(profile)) {
|
||||
SCOPE_EXIT_RTN_VALUE(AST_STIR_SHAKEN_VS_DISABLED,
|
||||
"%s: Disabled by profile\n", t);
|
||||
"%s: Disabled by profile '%s'\n", t, profile_name);
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(tag)) {
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_INVALID_ARGUMENTS,
|
||||
LOG_ERROR, "%s: Must provide tag\n", t);
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(canon_caller_id)) {
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_INVALID_ARGUMENTS,
|
||||
LOG_ERROR, "%s: Must provide caller_id\n", t);
|
||||
}
|
||||
|
||||
ctx = ao2_alloc_options(sizeof(*ctx), ctx_destructor,
|
||||
|
Reference in New Issue
Block a user