mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/strings.h"
|
#include "asterisk/strings.h"
|
||||||
#include "asterisk/network.h"
|
#include "asterisk/network.h"
|
||||||
|
#include "asterisk/event.h"
|
||||||
#include "asterisk/security_events.h"
|
#include "asterisk/security_events.h"
|
||||||
#include "asterisk/netsock2.h"
|
#include "asterisk/netsock2.h"
|
||||||
#include "asterisk/stasis.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));
|
str = *((const char **)(((const char *) sec) + ie_type->offset));
|
||||||
|
|
||||||
if (req && !str) {
|
if (req && !str) {
|
||||||
ast_log(LOG_WARNING, "Required IE '%d' for security event "
|
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
|
||||||
"type '%d' not present\n", ie_type->ie_type,
|
"type '%d' (%s) not present\n", ie_type->ie_type,
|
||||||
sec->event_type);
|
ast_event_get_ie_type_name(ie_type->ie_type),
|
||||||
|
sec->event_type, ast_security_event_get_name(sec->event_type));
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
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);
|
addr = (const struct ast_security_event_ip_addr *)(((const char *) sec) + ie_type->offset);
|
||||||
|
|
||||||
if (req && !addr->addr) {
|
if (req && !addr->addr) {
|
||||||
ast_log(LOG_WARNING, "Required IE '%d' for security event "
|
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
|
||||||
"type '%d' not present\n", ie_type->ie_type,
|
"type '%d' (%s) not present\n", ie_type->ie_type,
|
||||||
sec->event_type);
|
ast_event_get_ie_type_name(ie_type->ie_type),
|
||||||
|
sec->event_type, ast_security_event_get_name(sec->event_type));
|
||||||
res = -1;
|
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));
|
tval = *((const struct timeval **)(((const char *) sec) + ie_type->offset));
|
||||||
|
|
||||||
if (req && !tval) {
|
if (req && !tval) {
|
||||||
ast_log(LOG_WARNING, "Required IE '%d' for security event "
|
ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
|
||||||
"type '%d' not present\n", ie_type->ie_type,
|
"type '%d' (%s) not present\n", ie_type->ie_type,
|
||||||
sec->event_type);
|
ast_event_get_ie_type_name(ie_type->ie_type),
|
||||||
|
sec->event_type, ast_security_event_get_name(sec->event_type));
|
||||||
res = -1;
|
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. */
|
/* Added automatically, nothing to do here. */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_log(LOG_WARNING, "Unhandled IE type '%d', this security event "
|
ast_log(LOG_WARNING, "Unhandled IE type '%d' (%s), this security event "
|
||||||
"will be missing data.\n", ie_type->ie_type);
|
"will be missing data.\n", ie_type->ie_type,
|
||||||
|
ast_event_get_ie_type_name(ie_type->ie_type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user