summaryrefslogtreecommitdiff
path: root/channels/sip/security_events.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2015-08-12 12:59:53 -0500
committerKevin Harwell <kharwell@digium.com>2015-08-13 15:01:30 -0500
commit25af2d71c863062868b8bda6cf83515a1935d27e (patch)
tree861f2b2b75bc8b9626959f1a3abd1167ec6de0b6 /channels/sip/security_events.c
parent0bc6fe6f7d2fdc994a5ed359c1a067ebb5d8e09d (diff)
chan_sip.c: wrong peer searched in sip_report_security_event
In chan_sip, after handling an incoming invite a security event is raised describing authorization (success, failure, etc...). However, it was doing a lookup of the peer by extension. This is fine for register messages, but in the case of an invite it may search and find the wrong peer, or a non existent one (for instance, in the case of call pickup). Also, if the peers are configured through realtime this may cause an unnecessary database lookup when caching is enabled. This patch makes it so that sip_report_security_event searches by IP address when looking for a peer instead of by extension after an invite is processed. ASTERISK-25320 #close Change-Id: I9b3f11549efb475b6561c64f0e6da1a481d98bc4
Diffstat (limited to 'channels/sip/security_events.c')
-rw-r--r--channels/sip/security_events.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/sip/security_events.c b/channels/sip/security_events.c
index 691c5bde1..9f5d94f97 100644
--- a/channels/sip/security_events.c
+++ b/channels/sip/security_events.c
@@ -270,7 +270,8 @@ void sip_report_inval_transport(const struct sip_pvt *p, const char *transport)
ast_security_event_report(AST_SEC_EVT(&inval_transport));
}
-int sip_report_security_event(const struct sip_pvt *p, const struct sip_request *req, const int res) {
+int sip_report_security_event(const char *peer, struct ast_sockaddr *addr, const struct sip_pvt *p,
+ const struct sip_request *req, const int res) {
struct sip_peer *peer_report;
enum check_auth_result res_report = res;
@@ -288,7 +289,7 @@ int sip_report_security_event(const struct sip_pvt *p, const struct sip_request
[K_LAST] = { NULL, NULL}
};
- peer_report = sip_find_peer(p->exten, NULL, TRUE, FINDPEERS, FALSE, 0);
+ peer_report = sip_find_peer(peer, addr, TRUE, FINDPEERS, FALSE, p->socket.type);
switch(res_report) {
case AUTH_DONT_KNOW: