Skip to content
Snippets Groups Projects
Commit efd7c407 authored by Scott Griepentrog's avatar Scott Griepentrog
Browse files

security_events: log events with descriptive names

This patch updates the log messages to include descriptive
names for event types.  This is an improvement over having
only cryptic type numbers.

(closes issue ASTERISK-22909)
Reported by: outtolunc
Review: https://reviewboard.asterisk.org/r/3081/
Patches:
     svn_security_events.c.names.diff.txt uploaded by outtolunc (license 5198)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent dbead14c
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/strings.h"
#include "asterisk/network.h"
#include "asterisk/event.h"
#include "asterisk/security_events.h"
#include "asterisk/netsock2.h"
#include "asterisk/stasis.h"
......@@ -622,9 +623,10 @@ static int add_json_object(struct ast_json *json, const struct ast_security_even
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);
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
"type '%d' (%s) not present\n", ie_type->ie_type,
ast_event_get_ie_type_name(ie_type->ie_type),
sec->event_type, ast_security_event_get_name(sec->event_type));
res = -1;
break;
}
......@@ -667,9 +669,10 @@ static int add_json_object(struct ast_json *json, const struct ast_security_even
addr = (const struct ast_security_event_ip_addr *)(((const char *) sec) + ie_type->offset);
if (req && !addr->addr) {
ast_log(LOG_WARNING, "Required IE '%d' for security event "
"type '%d' not present\n", ie_type->ie_type,
sec->event_type);
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
"type '%d' (%s) not present\n", ie_type->ie_type,
ast_event_get_ie_type_name(ie_type->ie_type),
sec->event_type, ast_security_event_get_name(sec->event_type));
res = -1;
}
......@@ -686,9 +689,10 @@ static int add_json_object(struct ast_json *json, const struct ast_security_even
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);
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
"type '%d' (%s) not present\n", ie_type->ie_type,
ast_event_get_ie_type_name(ie_type->ie_type),
sec->event_type, ast_security_event_get_name(sec->event_type));
res = -1;
}
......@@ -708,8 +712,9 @@ static int add_json_object(struct ast_json *json, const struct ast_security_even
/* Added automatically, nothing to do here. */
break;
default:
ast_log(LOG_WARNING, "Unhandled IE type '%d', this security event "
"will be missing data.\n", ie_type->ie_type);
ast_log(LOG_WARNING, "Unhandled IE type '%d' (%s), this security event "
"will be missing data.\n", ie_type->ie_type,
ast_event_get_ie_type_name(ie_type->ie_type));
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment