[Asterisk-code-review] testing only (asterisk[master])

Benjamin Keith Ford asteriskteam at digium.com
Thu Jul 23 10:28:49 CDT 2020


Benjamin Keith Ford has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14694 )


Change subject: testing only
......................................................................

testing only

Change-Id: I74992fdb1fed8bc83969f6dfafc13f1d0734f290
---
M res/res_pjsip_stir_shaken.c
M res/res_stir_shaken.c
M res/res_stir_shaken/curl.c
3 files changed, 10 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/14694/1

diff --git a/res/res_pjsip_stir_shaken.c b/res/res_pjsip_stir_shaken.c
index 60dfdc4..322ba7e 100644
--- a/res/res_pjsip_stir_shaken.c
+++ b/res/res_pjsip_stir_shaken.c
@@ -149,6 +149,7 @@
 	encoded_val = strtok_r(identity_hdr_val, ".", &identity_hdr_val);
 	header = ast_base64decode_string(encoded_val);
 	if (ast_strlen_zero(header)) {
+		ast_log(LOG_NOTICE, "ssdebug: no 'header'\n");
 		ast_stir_shaken_add_verification(chan, caller_id, "", AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED);
 		return 0;
 	}
@@ -156,6 +157,7 @@
 	encoded_val = strtok_r(identity_hdr_val, ".", &identity_hdr_val);
 	payload = ast_base64decode_string(encoded_val);
 	if (ast_strlen_zero(payload)) {
+		ast_log(LOG_NOTICE, "ssdebug: no 'payload'\n");
 		ast_stir_shaken_add_verification(chan, caller_id, "", AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED);
 		return 0;
 	}
@@ -163,6 +165,7 @@
 	/* It's fine to leave the signature encoded */
 	signature = strtok_r(identity_hdr_val, ";", &identity_hdr_val);
 	if (ast_strlen_zero(signature)) {
+		ast_log(LOG_NOTICE, "ssdebug: no 'signatutre'\n");
 		ast_stir_shaken_add_verification(chan, caller_id, "", AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED);
 		return 0;
 	}
@@ -177,6 +180,7 @@
 
 	algorithm = strtok_r(identity_hdr_val, ";", &identity_hdr_val);
 	if (ast_strlen_zero(algorithm)) {
+		ast_log(LOG_NOTICE, "ssdebug: no 'algorithm'\n");
 		ast_stir_shaken_add_verification(chan, caller_id, "", AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED);
 		return 0;
 	}
@@ -185,6 +189,7 @@
 
 	ss_payload = ast_stir_shaken_verify(header, payload, signature, algorithm, public_key_url);
 	if (!ss_payload) {
+		ast_log(LOG_NOTICE, "ssdebug: verify failed\n");
 		ast_stir_shaken_add_verification(chan, caller_id, attestation, AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED);
 		return 0;
 	}
diff --git a/res/res_stir_shaken.c b/res/res_stir_shaken.c
index 7a141f7..c08f833 100644
--- a/res/res_stir_shaken.c
+++ b/res/res_stir_shaken.c
@@ -676,11 +676,13 @@
 		/* Set up the default path */
 		filename = basename(public_key_url);
 		if (ast_asprintf(&file_path, "%s/keys/%s/%s", ast_config_AST_DATA_DIR, STIR_SHAKEN_DIR_NAME, filename) < 0) {
+			ast_log(LOG_NOTICE, "ssdebug: 1\n");
 			return NULL;
 		}
 
 		/* Download to the default path */
 		if (run_curl(public_key_url, file_path)) {
+			ast_log(LOG_NOTICE, "ssdebug: 2\n");
 			return NULL;
 		}
 
@@ -702,6 +704,7 @@
 
 		/* If this fails, then there's nothing we can do */
 		if (curl_and_check_expiration(public_key_url, file_path, &curl)) {
+			ast_log(LOG_NOTICE, "ssdebug: 3\n");
 			return NULL;
 		}
 	}
@@ -716,6 +719,7 @@
 		remove_public_key_from_astdb(public_key_url);
 
 		if (curl_and_check_expiration(public_key_url, file_path, &curl)) {
+			ast_log(LOG_NOTICE, "ssdebug: 4\n");
 			return NULL;
 		}
 
diff --git a/res/res_stir_shaken/curl.c b/res/res_stir_shaken/curl.c
index 634c2bf..ab29e3d 100644
--- a/res/res_stir_shaken/curl.c
+++ b/res/res_stir_shaken/curl.c
@@ -41,7 +41,7 @@
 {
 	struct curl_cb_data *data;
 
-	data = ast_calloc(1, sizeof(data));
+	data = ast_calloc(1, sizeof(*data));
 
 	return data;
 }

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14694
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I74992fdb1fed8bc83969f6dfafc13f1d0734f290
Gerrit-Change-Number: 14694
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/20200723/cbae200b/attachment.html>


More information about the asterisk-code-review mailing list