[asterisk-commits] russell: branch group/security_events r199737 - /team/group/security_events/m...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 9 07:42:24 CDT 2009


Author: russell
Date: Tue Jun  9 07:42:21 2009
New Revision: 199737

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199737
Log:
Report session limit for AMI

Modified:
    team/group/security_events/main/manager.c

Modified: team/group/security_events/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/main/manager.c?view=diff&rev=199737&r1=199736&r2=199737
==============================================================================
--- team/group/security_events/main/manager.c (original)
+++ team/group/security_events/main/manager.c Tue Jun  9 07:42:21 2009
@@ -1953,6 +1953,33 @@
 	ast_security_event_report(AST_SEC_EVT(&chal_resp_failed));
 }
 
+static void report_session_limit(const struct mansession *s)
+{
+	struct sockaddr_in sin_local = { 0, };
+	struct ast_str *session_id = ast_str_alloca(32);
+	struct ast_security_event_session_limit session_limit = {
+		.common.event_type = AST_SECURITY_EVENT_SESSION_LIMIT,
+		.common.version    = AST_SECURITY_EVENT_SESSION_LIMIT_VERSION,
+		.common.service    = "AMI",
+
+		.account_id = s->session->username,
+		.session_tv = &s->session->sessionstart_tv,
+		.local_addr = {
+			.sin       = mansession_encode_sin_local(s, &sin_local),
+			.transport = mansession_get_transport(s),
+		},
+		.remote_addr = {
+			.sin       = &s->session->sin,
+			.transport = mansession_get_transport(s),
+		},
+	};
+
+	ast_str_set(&session_id, 0, "%p", s->session);
+	session_limit.session_id = ast_str_buffer(session_id);
+
+	ast_security_event_report(AST_SEC_EVT(&session_limit));
+}
+
 /*
  * Here we start with action_ handlers for AMI actions,
  * and the internal functions used by them.
@@ -3798,7 +3825,7 @@
 	if (!allowmultiplelogin && !s->session->authenticated && user &&
 		(!strcasecmp(action, "Login") || !strcasecmp(action, "Challenge"))) {
 		if (check_manager_session_inuse(user)) {
-			/* XXX Session limit */
+			report_session_limit(s);
 			sleep(1);
 			mansession_lock(s);
 			astman_send_error(s, m, "Login Already In Use");




More information about the asterisk-commits mailing list