[Asterisk-code-review] res_pjsip_stir_shaken.c: Fix enabled when not configured. (asterisk[19])
Benjamin Keith Ford
asteriskteam at digium.com
Tue Apr 26 10:25:28 CDT 2022
Benjamin Keith Ford has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18435 )
Change subject: res_pjsip_stir_shaken.c: Fix enabled when not configured.
......................................................................
res_pjsip_stir_shaken.c: Fix enabled when not configured.
There was an issue with the conditional where STIR/SHAKEN would be
enabled even when not configured. It has been changed to ensure that if
a profile does not exist and stir_shaken is not set in pjsip.conf, then
the conditional will return from the function without performing
STIR/SHAKEN operations.
ASTERISK-30024
Change-Id: I41286a3d35b033ccbfbe4129427a62cb793a86e6
---
M res/res_pjsip_stir_shaken.c
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/35/18435/1
diff --git a/res/res_pjsip_stir_shaken.c b/res/res_pjsip_stir_shaken.c
index 19e846f..82c8df0 100644
--- a/res/res_pjsip_stir_shaken.c
+++ b/res/res_pjsip_stir_shaken.c
@@ -225,8 +225,13 @@
}
profile = ast_stir_shaken_get_profile(session->endpoint->stir_shaken_profile);
+ /* Profile should be checked first as it takes priority over anything else.
+ * If there is a profile and it doesn't have verification enabled, do nothing.
+ * If there is no profile and the stir_shaken option is either not set or does
+ * not support verification, do nothing.
+ */
if ((profile && !ast_stir_shaken_profile_supports_verification(profile))
- && ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_VERIFY) == 0)) {
+ || (!profile && (session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_VERIFY) == 0)) {
return 0;
}
@@ -478,8 +483,13 @@
RAII_VAR(struct stir_shaken_profile *, profile, NULL, ao2_cleanup);
profile = ast_stir_shaken_get_profile(session->endpoint->stir_shaken_profile);
+ /* Profile should be checked first as it takes priority over anything else.
+ * If there is a profile and it doesn't have attestation enabled, do nothing.
+ * If there is no profile and the stir_shaken option is either not set or does
+ * not support attestation, do nothing.
+ */
if ((profile && !ast_stir_shaken_profile_supports_attestation(profile))
- && ((session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_ATTEST) == 0)) {
+ || (!profile && (session->endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_ATTEST) == 0)) {
return;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18435
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: I41286a3d35b033ccbfbe4129427a62cb793a86e6
Gerrit-Change-Number: 18435
Gerrit-PatchSet: 1
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220426/bfe9d806/attachment.html>
More information about the asterisk-code-review
mailing list