[asterisk-commits] russell: branch group/security_events r199585 - /team/group/security_events/c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 8 08:27:27 CDT 2009


Author: russell
Date: Mon Jun  8 08:27:23 2009
New Revision: 199585

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199585
Log:
Add chan_sip helper function for reporting invalid username

Modified:
    team/group/security_events/channels/chan_sip.c

Modified: team/group/security_events/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_sip.c?view=diff&rev=199585&r1=199584&r2=199585
==============================================================================
--- team/group/security_events/channels/chan_sip.c (original)
+++ team/group/security_events/channels/chan_sip.c Mon Jun  8 08:27:23 2009
@@ -2484,6 +2484,15 @@
 static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target);
 static int do_magic_pickup(struct ast_channel *channel, const char *extension, const char *context);
 
+/* ------ Security Event Handling ------ */
+static enum ast_security_event_transport_type security_event_transport_type(
+		const enum sip_transport sip_transport);
+static void report_failed_acl(const struct sip_peer *peer, const struct sip_pvt *pvt,
+		const struct sockaddr_in *sin_remote, const char *acl_name);
+/*! XXX \todo Use this in the proper places in chan_sip */
+static void attribute_unused report_invalid_peer(const char *peer_name, const struct sip_pvt *pvt,
+		const struct sockaddr_in *sin_remote);
+
 /*!
  * \brief generic function for determining if a correct transport is being 
  * used to contact a peer
@@ -11928,6 +11937,32 @@
 	};
 
 	ast_security_event_report(AST_SEC_EVT(&failed_acl_event));
+}
+
+static void report_invalid_peer(const char *peer_name, const struct sip_pvt *pvt,
+		const struct sockaddr_in *sin_remote)
+{
+	struct sockaddr_in sin_local = { 0, };
+	const struct ast_security_event_inval_acct_id inval_acct_id = {
+		.common.event_type = AST_SECURITY_EVENT_INVAL_ACCT_ID,
+		.common.version    = AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION,
+		.common.service    = "SIP",
+
+		.module     = AST_MODULE,
+		.account_id = peer_name,
+		.session_id = pvt->callid,
+		.session_tv = &pvt->session_tv,
+		.local_addr = {
+			.sin       = encode_sin_local(&sin_local, pvt),
+			.transport = security_event_transport_type(pvt->socket.type),
+		},
+		.remote_addr = {
+			.sin       = sin_remote,
+			.transport = security_event_transport_type(pvt->socket.type),
+		},
+	};
+
+	ast_security_event_report(AST_SEC_EVT(&inval_acct_id));
 }
 
 /*! \brief Parse contact header and save registration (peer registration) */




More information about the asterisk-commits mailing list