[asterisk-commits] mmichelson: trunk r405299 - in /trunk: ./ res/res_pjsip/security_events.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 10 14:00:18 CST 2014
Author: mmichelson
Date: Fri Jan 10 14:00:16 2014
New Revision: 405299
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405299
Log:
Print "<unknown>" for artificial endpoint in PJSIP security events.
Previously, this printed a UUID, which was not very clear when dealing
with an artificial endpoint.
Review: https://reviewboard.asterisk.org/r/3113
........
Merged revisions 405298 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/res/res_pjsip/security_events.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: trunk/res/res_pjsip/security_events.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/security_events.c?view=diff&rev=405299&r1=405298&r2=405299
==============================================================================
--- trunk/res/res_pjsip/security_events.c (original)
+++ trunk/res/res_pjsip/security_events.c Fri Jan 10 14:00:16 2014
@@ -67,6 +67,13 @@
ast_sockaddr_set_port(remote, rdata->pkt_info.src_port);
}
+static const char *get_account_id(struct ast_sip_endpoint *endpoint)
+{
+ RAII_VAR(struct ast_sip_endpoint *, artificial, ast_sip_get_artificial_endpoint(), ao2_cleanup);
+
+ return endpoint == artificial ? "<unknown>" : ast_sorcery_object_get_id(endpoint);
+}
+
void ast_sip_report_invalid_endpoint(const char *name, pjsip_rx_data *rdata)
{
enum ast_transport transport = security_event_get_transport(rdata);
@@ -104,7 +111,7 @@
.common.event_type = AST_SECURITY_EVENT_FAILED_ACL,
.common.version = AST_SECURITY_EVENT_FAILED_ACL_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
@@ -129,12 +136,13 @@
char call_id[pj_strlen(&rdata->msg_info.cid->id) + 1];
char nonce[64] = "", response[256] = "";
struct ast_sockaddr local, remote;
+ RAII_VAR(struct ast_sip_endpoint *, artificial, ast_sip_get_artificial_endpoint(), ao2_cleanup);
struct ast_security_event_chal_resp_failed chal_resp_failed = {
.common.event_type = AST_SECURITY_EVENT_CHAL_RESP_FAILED,
.common.version = AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
@@ -148,7 +156,7 @@
.challenge = nonce,
.response = response,
.expected_response = "",
- };
+ };
if (auth && !pj_strcmp2(&auth->scheme, "Digest")) {
ast_copy_pj_str(nonce, &auth->credential.digest.nonce, sizeof(nonce));
@@ -171,7 +179,7 @@
.common.event_type = AST_SECURITY_EVENT_SUCCESSFUL_AUTH,
.common.version = AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
@@ -200,7 +208,7 @@
.common.event_type = AST_SECURITY_EVENT_CHAL_SENT,
.common.version = AST_SECURITY_EVENT_CHAL_SENT_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
@@ -233,7 +241,7 @@
.common.event_type = AST_SECURITY_EVENT_REQ_NO_SUPPORT,
.common.version = AST_SECURITY_EVENT_REQ_NO_SUPPORT_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
@@ -261,7 +269,7 @@
.common.event_type = AST_SECURITY_EVENT_MEM_LIMIT,
.common.version = AST_SECURITY_EVENT_MEM_LIMIT_VERSION,
.common.service = "PJSIP",
- .common.account_id = ast_sorcery_object_get_id(endpoint),
+ .common.account_id = get_account_id(endpoint),
.common.local_addr = {
.addr = &local,
.transport = transport,
More information about the asterisk-commits
mailing list