[svn-commits] russell: branch group/security_events r199732 - /team/group/security_events/m...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 9 07:18:23 CDT 2009


Author: russell
Date: Tue Jun  9 07:18:20 2009
New Revision: 199732

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199732
Log:
Report successful auth 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=199732&r1=199731&r2=199732
==============================================================================
--- team/group/security_events/main/manager.c (original)
+++ team/group/security_events/main/manager.c Tue Jun  9 07:18:20 2009
@@ -1833,6 +1833,33 @@
 	ast_security_event_report(AST_SEC_EVT(&inval_password));
 }
 
+static void report_auth_success(const struct mansession *s)
+{
+	struct sockaddr_in sin_local = { 0, };
+	struct ast_str *session_id = ast_str_alloca(32);
+	struct ast_security_event_successful_auth successful_auth = {
+		.common.event_type = AST_SECURITY_EVENT_SUCCESSFUL_AUTH,
+		.common.version    = AST_SECURITY_EVENT_SUCCESSFUL_AUTH_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);
+	successful_auth.session_id = ast_str_buffer(session_id);
+
+	ast_security_event_report(AST_SEC_EVT(&successful_auth));
+}
+
 /*
  * Here we start with action_ handlers for AMI actions,
  * and the internal functions used by them.
@@ -1900,8 +1927,6 @@
 
 	/* auth complete */
 
-	/* XXX Auth Successful */
-
 	ast_copy_string(s->session->username, username, sizeof(s->session->username));
 	s->session->readperm = user->readperm;
 	s->session->writeperm = user->writeperm;
@@ -1909,6 +1934,8 @@
 	s->session->sessionstart = time(NULL);
 	s->session->sessionstart_tv = ast_tvnow();
 	set_eventmask(s, astman_get_header(m, "Events"));
+
+	report_auth_success(s);
 
 	AST_RWLIST_UNLOCK(&users);
 	return 0;




More information about the svn-commits mailing list