[asterisk-commits] russell: branch group/security_events r199281 - in /team/group/security_event...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 5 13:58:15 CDT 2009
Author: russell
Date: Fri Jun 5 13:58:10 2009
New Revision: 199281
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199281
Log:
Make code to handle mapping from helper structures to ast_events more generic.
Modified:
team/group/security_events/channels/chan_sip.c
team/group/security_events/include/asterisk/security_events.h
team/group/security_events/include/asterisk/security_events_defs.h
team/group/security_events/main/security_events.c
team/group/security_events/res/res_security_log.c
team/group/security_events/tests/test_security_events.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=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/channels/chan_sip.c (original)
+++ team/group/security_events/channels/chan_sip.c Fri Jun 5 13:58:10 2009
@@ -11917,9 +11917,14 @@
.session_id = pvt->callid,
.acl_name = acl_name,
.session_tv = &pvt->session_tv,
- .sin_local = encode_sin_local(&sin_local, pvt),
- .sin_remote = sin_remote,
- .transport = security_event_transport_type(pvt->socket.type),
+ .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(&failed_acl_event));
Modified: team/group/security_events/include/asterisk/security_events.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/include/asterisk/security_events.h?view=diff&rev=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/include/asterisk/security_events.h (original)
+++ team/group/security_events/include/asterisk/security_events.h Fri Jun 5 13:58:10 2009
@@ -53,6 +53,12 @@
*/
int ast_security_event_report(const struct ast_security_event_common *sec);
+struct ast_security_event_ie_type {
+ enum ast_event_ie_type ie_type;
+ /*! \brief For internal usage */
+ size_t offset;
+};
+
/*!
* \brief Get the list of required IEs for a given security event sub-type
*
@@ -63,7 +69,7 @@
*
* \since 1.6.3
*/
-const enum ast_event_ie_type *ast_security_event_get_required_ies(
+const struct ast_security_event_ie_type *ast_security_event_get_required_ies(
const enum ast_security_event_type event_type);
/*!
@@ -76,7 +82,7 @@
*
* \since 1.6.3
*/
-const enum ast_event_ie_type *ast_security_event_get_optional_ies(
+const struct ast_security_event_ie_type *ast_security_event_get_optional_ies(
const enum ast_security_event_type event_type);
/*!
Modified: team/group/security_events/include/asterisk/security_events_defs.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/include/asterisk/security_events_defs.h?view=diff&rev=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/include/asterisk/security_events_defs.h (original)
+++ team/group/security_events/include/asterisk/security_events_defs.h Fri Jun 5 13:58:10 2009
@@ -57,7 +57,7 @@
* during authentication. For example, if an invalid username is given,
* this event should be used.
*/
- AST_SECURITY_EVENT_INVALID_ACCOUNT_ID,
+ AST_SECURITY_EVENT_INVAL_ACCT_ID,
/* \brief This _must_ stay at the end. */
AST_SECURITY_EVENT_NUM_TYPES
};
@@ -72,6 +72,11 @@
};
#define AST_SEC_EVT(e) ((struct ast_security_event_common *) e)
+
+struct ast_security_event_ipv4_addr {
+ const struct sockaddr_in *sin;
+ enum ast_security_event_transport_type transport;
+};
/*!
* \brief Common structure elements
@@ -136,28 +141,23 @@
* \brief Local address the request came in on
* \note required
*/
- const struct sockaddr_in *sin_local;
+ struct ast_security_event_ipv4_addr local_addr;
/*!
* \brief Remote address the request came from
* \note required
*/
- const struct sockaddr_in *sin_remote;
- /*!
- * \brief Transport type in use
- * \note required
- */
- enum ast_security_event_transport_type transport;
+ struct ast_security_event_ipv4_addr remote_addr;
};
/*!
* \brief Invalid account ID specified (invalid username, for example)
*/
-struct ast_security_event_invalid_account_id {
+struct ast_security_event_inval_acct_id {
/*!
* \brief Event descriptor version
* \note This _must_ be changed if this event descriptor is changed.
*/
- #define AST_SECURITY_EVENT_INVALID_ACCOUNT_ID_VERSION 1
+ #define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION 1
/*! \brief Common security event descriptor elements */
struct ast_security_event_common common;
/*!
@@ -184,17 +184,12 @@
* \brief Local address the request came in on
* \note required
*/
- const struct sockaddr_in *sin_local;
+ struct ast_security_event_ipv4_addr local_addr;
/*!
* \brief Remote address the request came from
* \note required
*/
- const struct sockaddr_in *sin_remote;
- /*!
- * \brief Transport type in use
- * \note required
- */
- enum ast_security_event_transport_type transport;
+ struct ast_security_event_ipv4_addr remote_addr;
};
Modified: team/group/security_events/main/security_events.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/main/security_events.c?view=diff&rev=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/main/security_events.c (original)
+++ team/group/security_events/main/security_events.c Fri Jun 5 13:58:10 2009
@@ -35,57 +35,58 @@
static const size_t TIMESTAMP_STR_LEN = 32;
-static int handle_failed_acl(const struct ast_security_event_common *sec);
-static int handle_invalid_account_id(const struct ast_security_event_common *sec);
-
static const struct {
const char *name;
uint32_t version;
- int (*handler)(const struct ast_security_event_common *);
#define MAX_SECURITY_IES 8
- enum ast_event_ie_type required_ies[MAX_SECURITY_IES];
- enum ast_event_ie_type optional_ies[MAX_SECURITY_IES];
+ struct ast_security_event_ie_type required_ies[MAX_SECURITY_IES];
+ struct ast_security_event_ie_type optional_ies[MAX_SECURITY_IES];
#undef MAX_SECURITY_IES
} sec_events[AST_SECURITY_EVENT_NUM_TYPES] = {
- [AST_SECURITY_EVENT_FAILED_ACL] = {
- .name = "FailedACL",
- .version = AST_SECURITY_EVENT_FAILED_ACL_VERSION,
- .handler = handle_failed_acl,
- .required_ies = {
- AST_EVENT_IE_SERVICE,
- AST_EVENT_IE_EVENT_VERSION,
- AST_EVENT_IE_ACCOUNT_ID,
- AST_EVENT_IE_SESSION_ID,
- AST_EVENT_IE_LOCAL_ADDR,
- AST_EVENT_IE_REMOTE_ADDR,
- AST_EVENT_IE_END
- },
- .optional_ies = {
- AST_EVENT_IE_MODULE,
- AST_EVENT_IE_ACL_NAME,
- AST_EVENT_IE_SESSION_TV,
- AST_EVENT_IE_END
- },
+
+#define SEC_EVT_FIELD(e, field) (offsetof(struct ast_security_event_##e, field))
+
+[AST_SECURITY_EVENT_FAILED_ACL] = {
+ .name = "FailedACL",
+ .version = AST_SECURITY_EVENT_FAILED_ACL_VERSION,
+ .required_ies = {
+ { AST_EVENT_IE_SERVICE, SEC_EVT_FIELD(common, service) },
+ { AST_EVENT_IE_EVENT_VERSION, SEC_EVT_FIELD(common, version) },
+ { AST_EVENT_IE_ACCOUNT_ID, SEC_EVT_FIELD(failed_acl, account_id) },
+ { AST_EVENT_IE_SESSION_ID, SEC_EVT_FIELD(failed_acl, session_id) },
+ { AST_EVENT_IE_LOCAL_ADDR, SEC_EVT_FIELD(failed_acl, local_addr) },
+ { AST_EVENT_IE_REMOTE_ADDR, SEC_EVT_FIELD(failed_acl, remote_addr) },
+ { AST_EVENT_IE_END, 0 }
},
- [AST_SECURITY_EVENT_INVALID_ACCOUNT_ID] = {
- .name = "InvalidAccountID",
- .version = AST_SECURITY_EVENT_INVALID_ACCOUNT_ID_VERSION,
- .handler = handle_invalid_account_id,
- .required_ies = {
- AST_EVENT_IE_SERVICE,
- AST_EVENT_IE_EVENT_VERSION,
- AST_EVENT_IE_ACCOUNT_ID,
- AST_EVENT_IE_SESSION_ID,
- AST_EVENT_IE_LOCAL_ADDR,
- AST_EVENT_IE_REMOTE_ADDR,
- AST_EVENT_IE_END
- },
- .optional_ies = {
- AST_EVENT_IE_MODULE,
- AST_EVENT_IE_SESSION_TV,
- AST_EVENT_IE_END
- },
+ .optional_ies = {
+ { AST_EVENT_IE_MODULE, SEC_EVT_FIELD(failed_acl, module) },
+ { AST_EVENT_IE_ACL_NAME, SEC_EVT_FIELD(failed_acl, acl_name) },
+ { AST_EVENT_IE_SESSION_TV, SEC_EVT_FIELD(failed_acl, session_tv) },
+ { AST_EVENT_IE_END, 0 }
},
+},
+
+[AST_SECURITY_EVENT_INVAL_ACCT_ID] = {
+ .name = "InvalidAccountID",
+ .version = AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION,
+ .required_ies = {
+ { AST_EVENT_IE_SERVICE, SEC_EVT_FIELD(common, service) },
+ { AST_EVENT_IE_EVENT_VERSION, SEC_EVT_FIELD(common, version) },
+ { AST_EVENT_IE_ACCOUNT_ID, SEC_EVT_FIELD(inval_acct_id, account_id) },
+ { AST_EVENT_IE_SESSION_ID, SEC_EVT_FIELD(inval_acct_id, session_id) },
+ { AST_EVENT_IE_LOCAL_ADDR, SEC_EVT_FIELD(inval_acct_id, local_addr) },
+ { AST_EVENT_IE_REMOTE_ADDR, SEC_EVT_FIELD(inval_acct_id, remote_addr) },
+ { AST_EVENT_IE_END, 0 }
+ },
+ .optional_ies = {
+ { AST_EVENT_IE_MODULE, SEC_EVT_FIELD(inval_acct_id, module) },
+ { AST_EVENT_IE_SESSION_TV, SEC_EVT_FIELD(inval_acct_id, session_tv) },
+ { AST_EVENT_IE_END, 0 }
+ },
+},
+
+#undef SEC_EVT_FIELD
+
};
static int check_event_type(const enum ast_security_event_type event_type)
@@ -107,7 +108,7 @@
return sec_events[event_type].name;
}
-const enum ast_event_ie_type *ast_security_event_get_required_ies(
+const struct ast_security_event_ie_type *ast_security_event_get_required_ies(
const enum ast_security_event_type event_type)
{
if (check_event_type(event_type)) {
@@ -117,7 +118,7 @@
return sec_events[event_type].required_ies;
}
-const enum ast_event_ie_type *ast_security_event_get_optional_ies(
+const struct ast_security_event_ie_type *ast_security_event_get_optional_ies(
const enum ast_security_event_type event_type)
{
if (check_event_type(event_type)) {
@@ -149,6 +150,171 @@
AST_EVENT_IE_END);
}
+static int add_timeval_ie(struct ast_event **event, enum ast_event_ie_type ie_type,
+ const struct timeval *tv)
+{
+ struct ast_str *str = ast_str_alloca(TIMESTAMP_STR_LEN);
+
+ encode_timestamp(&str, tv);
+
+ return ast_event_append_ie_str(event, ie_type, ast_str_buffer(str));
+}
+
+static int add_ipv4_ie(struct ast_event **event, enum ast_event_ie_type ie_type,
+ const struct ast_security_event_ipv4_addr *addr)
+{
+ struct ast_str *str = ast_str_alloca(64);
+
+ ast_str_set(&str, 0, "IPV4/");
+
+ switch (addr->transport) {
+ case AST_SECURITY_EVENT_TRANSPORT_UDP:
+ ast_str_append(&str, 0, "UDP/");
+ break;
+ case AST_SECURITY_EVENT_TRANSPORT_TCP:
+ ast_str_append(&str, 0, "TCP/");
+ break;
+ case AST_SECURITY_EVENT_TRANSPORT_TLS:
+ ast_str_append(&str, 0, "TLS/");
+ break;
+ }
+
+ ast_str_append(&str, 0, "%s/%hu",
+ ast_inet_ntoa(addr->sin->sin_addr),
+ ntohs(addr->sin->sin_port));
+
+ return ast_event_append_ie_str(event, ie_type, ast_str_buffer(str));
+}
+
+enum ie_required {
+ NOT_REQUIRED,
+ REQUIRED
+};
+
+static int add_ie(struct ast_event **event, const struct ast_security_event_common *sec,
+ const struct ast_security_event_ie_type *ie_type, enum ie_required req)
+{
+ int res = 0;
+
+ switch (ie_type->ie_type) {
+ case AST_EVENT_IE_SERVICE:
+ case AST_EVENT_IE_ACCOUNT_ID:
+ case AST_EVENT_IE_SESSION_ID:
+ case AST_EVENT_IE_MODULE:
+ case AST_EVENT_IE_ACL_NAME:
+ {
+ const char *str;
+
+ str = *((const char **)(((const char *) sec) + ie_type->offset));
+
+ if (req && !str) {
+ ast_log(LOG_WARNING, "Required IE '%d' for security event "
+ "type '%d' not present\n", ie_type->ie_type,
+ sec->event_type);
+ res = -1;
+ }
+
+ if (str) {
+ res = ast_event_append_ie_str(event, ie_type->ie_type, str);
+ }
+
+ break;
+ }
+ case AST_EVENT_IE_EVENT_VERSION:
+ {
+ uint32_t val;
+ val = *((const uint32_t *)(((const char *) sec) + ie_type->offset));
+ res = ast_event_append_ie_uint(event, ie_type->ie_type, val);
+ break;
+ }
+ case AST_EVENT_IE_LOCAL_ADDR:
+ case AST_EVENT_IE_REMOTE_ADDR:
+ {
+ const struct ast_security_event_ipv4_addr *addr;
+
+ addr = (const struct ast_security_event_ipv4_addr *)(((const char *) sec) + ie_type->offset);
+
+ if (req && !addr->sin) {
+ ast_log(LOG_WARNING, "Required IE '%d' for security event "
+ "type '%d' not present\n", ie_type->ie_type,
+ sec->event_type);
+ res = -1;
+ }
+
+ if (addr->sin) {
+ res = add_ipv4_ie(event, ie_type->ie_type, addr);
+ }
+ break;
+ }
+ case AST_EVENT_IE_SESSION_TV:
+ {
+ const struct timeval *tval;
+
+ tval = *((const struct timeval **)(((const char *) sec) + ie_type->offset));
+
+ if (req && !tval) {
+ ast_log(LOG_WARNING, "Required IE '%d' for security event "
+ "type '%d' not present\n", ie_type->ie_type,
+ sec->event_type);
+ res = -1;
+ }
+
+ if (tval) {
+ add_timeval_ie(event, ie_type->ie_type, tval);
+ }
+
+ break;
+ }
+ default:
+ ast_log(LOG_WARNING, "Unhandled IE type '%d', this security event "
+ "will be missing data.\n", ie_type->ie_type);
+ break;
+ }
+
+ return res;
+}
+
+static int handle_security_event(const struct ast_security_event_common *sec)
+{
+ struct ast_event *event;
+ const struct ast_security_event_ie_type *ies;
+ unsigned int i;
+
+ if (!(event = alloc_event(sec))) {
+ return -1;
+ }
+
+ for (ies = ast_security_event_get_required_ies(sec->event_type), i = 0;
+ ies[i].ie_type != AST_EVENT_IE_END;
+ i++) {
+ if (add_ie(&event, sec, ies + i, REQUIRED)) {
+ goto return_error;
+ }
+ }
+
+ for (ies = ast_security_event_get_optional_ies(sec->event_type), i = 0;
+ ies[i].ie_type != AST_EVENT_IE_END;
+ i++) {
+ if (add_ie(&event, sec, ies + i, NOT_REQUIRED)) {
+ goto return_error;
+ }
+ }
+
+
+ if (ast_event_queue(event)) {
+ goto return_error;
+ }
+
+ return 0;
+
+return_error:
+ if (event) {
+ ast_event_destroy(event);
+ }
+
+ return -1;
+}
+
int ast_security_event_report(const struct ast_security_event_common *sec)
{
int res;
@@ -158,7 +324,7 @@
return -1;
}
- if (!sec_events[sec->event_type].handler) {
+ if (!sec_events[sec->event_type].name) {
ast_log(LOG_WARNING, "Security event type %u not handled\n",
sec->event_type);
return -1;
@@ -170,121 +336,9 @@
return -1;
}
- res = sec_events[sec->event_type].handler(sec);
+ res = handle_security_event(sec);
return res;
}
-static int add_timeval_ie(struct ast_event **event, enum ast_event_ie_type ie_type,
- const struct timeval *tv)
-{
- struct ast_str *str = ast_str_alloca(TIMESTAMP_STR_LEN);
-
- encode_timestamp(&str, tv);
-
- return ast_event_append_ie_str(event, ie_type, ast_str_buffer(str));
-}
-
-static int add_ipv4_ie(struct ast_event **event, enum ast_event_ie_type ie_type,
- const struct sockaddr_in *sin,
- enum ast_security_event_transport_type transport_type)
-{
- struct ast_str *str = ast_str_alloca(64);
-
- ast_str_set(&str, 0, "IPV4/");
-
- switch (transport_type) {
- case AST_SECURITY_EVENT_TRANSPORT_UDP:
- ast_str_append(&str, 0, "UDP/");
- break;
- case AST_SECURITY_EVENT_TRANSPORT_TCP:
- ast_str_append(&str, 0, "TCP/");
- break;
- case AST_SECURITY_EVENT_TRANSPORT_TLS:
- ast_str_append(&str, 0, "TLS/");
- break;
- }
-
- ast_str_append(&str, 0, "%s/%hu",
- ast_inet_ntoa(sin->sin_addr),
- ntohs(sin->sin_port));
-
- return ast_event_append_ie_str(event, ie_type, ast_str_buffer(str));
-}
-
-static int handle_failed_acl(const struct ast_security_event_common *sec)
-{
- const struct ast_security_event_failed_acl *failed_acl;
- struct ast_event *event;
-
- failed_acl = (const struct ast_security_event_failed_acl *) sec;
-
- if (!(event = alloc_event(sec))) {
- return -1;
- }
-
- if (!ast_strlen_zero(failed_acl->module)) {
- ast_event_append_ie_str(&event, AST_EVENT_IE_MODULE, failed_acl->module);
- }
-
- ast_event_append_ie_str(&event, AST_EVENT_IE_ACCOUNT_ID, failed_acl->account_id);
- ast_event_append_ie_str(&event, AST_EVENT_IE_SESSION_ID, failed_acl->session_id);
-
- if (!ast_strlen_zero(failed_acl->acl_name)) {
- ast_event_append_ie_str(&event, AST_EVENT_IE_ACL_NAME,
- failed_acl->acl_name);
- }
-
- if (failed_acl->session_tv) {
- add_timeval_ie(&event, AST_EVENT_IE_SESSION_TV, failed_acl->session_tv);
- }
-
- add_ipv4_ie(&event, AST_EVENT_IE_LOCAL_ADDR,
- failed_acl->sin_local, failed_acl->transport);
- add_ipv4_ie(&event, AST_EVENT_IE_REMOTE_ADDR,
- failed_acl->sin_remote, failed_acl->transport);
-
- if (event && ast_event_queue(event)) {
- ast_event_destroy(event);
- event = NULL;
- }
-
- return event ? 0 : -1;
-}
-
-static int handle_invalid_account_id(const struct ast_security_event_common *sec)
-{
- const struct ast_security_event_invalid_account_id *inval_acct_id;
- struct ast_event *event;
-
- inval_acct_id = (const struct ast_security_event_invalid_account_id *) sec;
-
- if (!(event = alloc_event(sec))) {
- return -1;
- }
-
- if (!ast_strlen_zero(inval_acct_id->module)) {
- ast_event_append_ie_str(&event, AST_EVENT_IE_MODULE, inval_acct_id->module);
- }
-
- ast_event_append_ie_str(&event, AST_EVENT_IE_ACCOUNT_ID, inval_acct_id->account_id);
- ast_event_append_ie_str(&event, AST_EVENT_IE_SESSION_ID, inval_acct_id->session_id);
-
- if (inval_acct_id->session_tv) {
- add_timeval_ie(&event, AST_EVENT_IE_SESSION_TV, inval_acct_id->session_tv);
- }
-
- add_ipv4_ie(&event, AST_EVENT_IE_LOCAL_ADDR,
- inval_acct_id->sin_local, inval_acct_id->transport);
- add_ipv4_ie(&event, AST_EVENT_IE_REMOTE_ADDR,
- inval_acct_id->sin_remote, inval_acct_id->transport);
-
- if (event && ast_event_queue(event)) {
- ast_event_destroy(event);
- event = NULL;
- }
-
- return event ? 0 : -1;
-
-}
-
+
Modified: team/group/security_events/res/res_security_log.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/res/res_security_log.c?view=diff&rev=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/res/res_security_log.c (original)
+++ team/group/security_events/res/res_security_log.c Fri Jun 5 13:58:10 2009
@@ -95,10 +95,12 @@
}
static void append_ies(struct ast_str **str, const struct ast_event *event,
- const enum ast_event_ie_type *ies, enum ie_required required)
+ const struct ast_security_event_ie_type *ies, enum ie_required required)
{
- for (; *ies != AST_EVENT_IE_END; ies++) {
- append_ie(str, event, *ies, required);
+ unsigned int i;
+
+ for (i = 0; ies[i].ie_type != AST_EVENT_IE_END; i++) {
+ append_ie(str, event, ies[i].ie_type, required);
}
}
Modified: team/group/security_events/tests/test_security_events.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/tests/test_security_events.c?view=diff&rev=199281&r1=199280&r2=199281
==============================================================================
--- team/group/security_events/tests/test_security_events.c (original)
+++ team/group/security_events/tests/test_security_events.c Fri Jun 5 13:58:10 2009
@@ -37,12 +37,12 @@
#include "asterisk/security_events.h"
static void evt_gen_failed_acl(void);
-static void evt_gen_invalid_account_id(void);
+static void evt_gen_inval_acct_id(void);
typedef void (*evt_generator)(void);
evt_generator evt_generators[AST_SECURITY_EVENT_NUM_TYPES] = {
- [AST_SECURITY_EVENT_FAILED_ACL] = evt_gen_failed_acl,
- [AST_SECURITY_EVENT_INVALID_ACCOUNT_ID] = evt_gen_invalid_account_id,
+ [AST_SECURITY_EVENT_FAILED_ACL] = evt_gen_failed_acl,
+ [AST_SECURITY_EVENT_INVAL_ACCT_ID] = evt_gen_inval_acct_id,
};
static void evt_gen_failed_acl(void)
@@ -64,9 +64,14 @@
.session_id = "Session123",
.acl_name = "TEST_ACL",
.session_tv = &session_tv,
- .sin_local = &sin_local,
- .sin_remote = &sin_remote,
- .transport = AST_SECURITY_EVENT_TRANSPORT_UDP,
+ .local_addr = {
+ .sin = &sin_local,
+ .transport = AST_SECURITY_EVENT_TRANSPORT_UDP,
+ },
+ .remote_addr = {
+ .sin = &sin_remote,
+ .transport = AST_SECURITY_EVENT_TRANSPORT_UDP,
+ },
};
inet_aton("192.168.1.1", &sin_local.sin_addr);
@@ -78,7 +83,7 @@
ast_security_event_report(AST_SEC_EVT(&failed_acl_event));
}
-static void evt_gen_invalid_account_id(void)
+static void evt_gen_inval_acct_id(void)
{
struct sockaddr_in sin_local = {
.sin_family = AF_INET
@@ -87,18 +92,23 @@
.sin_family = AF_INET
};
struct timeval session_tv = ast_tvnow();
- struct ast_security_event_invalid_account_id inval_acct_id = {
- .common.event_type = AST_SECURITY_EVENT_INVALID_ACCOUNT_ID,
- .common.version = AST_SECURITY_EVENT_INVALID_ACCOUNT_ID_VERSION,
+ 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 = "TEST",
.module = AST_MODULE,
.account_id = "FakeUser",
.session_id = "Session456",
.session_tv = &session_tv,
- .sin_local = &sin_local,
- .sin_remote = &sin_remote,
- .transport = AST_SECURITY_EVENT_TRANSPORT_TCP,
+ .local_addr = {
+ .sin = &sin_local,
+ .transport = AST_SECURITY_EVENT_TRANSPORT_TCP,
+ },
+ .remote_addr = {
+ .sin = &sin_remote,
+ .transport = AST_SECURITY_EVENT_TRANSPORT_TCP,
+ },
};
inet_aton("10.1.2.3", &sin_local.sin_addr);
More information about the asterisk-commits
mailing list