summaryrefslogtreecommitdiff
path: root/main/logger.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-04-09 02:44:27 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-04-09 02:44:27 +0000
commitb5f8c632df92f51c86487efc7b280522ef837e34 (patch)
tree32bdb0325215391d2e4b4f026dbe68f724c3280c /main/logger.c
parentf57fddb5bb08dbf68cb51f7dcffc5bd808000f97 (diff)
add a dedicated log channel for modules to be able report security-related events, so that they can be fed into external processes for analysis and possible mitigation efforts
(inspired by this evening's Toronto Asterisk Users Group meeting and previous dicussions amongst various community members) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/logger.c b/main/logger.c
index 163548908..79fb730d3 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -162,7 +162,8 @@ static char *levels[] = {
"WARNING",
"ERROR",
"VERBOSE",
- "DTMF"
+ "DTMF",
+ "SECURITY",
};
/*! \brief Colors used in the console for logging */
@@ -204,6 +205,8 @@ static int make_components(const char *s, int lineno)
res |= (1 << __LOG_VERBOSE);
else if (!strcasecmp(w, "dtmf"))
res |= (1 << __LOG_DTMF);
+ else if (!strcasecmp(w, "security"))
+ res |= (1 << __LOG_SECURITY);
else {
fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
}
@@ -356,7 +359,7 @@ static void init_logger_chain(int locked)
if (!(chan = ast_calloc(1, sizeof(*chan))))
return;
chan->type = LOGTYPE_CONSOLE;
- chan->logmask = 28; /*warning,notice,error */
+ chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR);
if (!locked)
AST_RWLIST_WRLOCK(&logchannels);
AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);
@@ -802,6 +805,8 @@ static char *handle_logger_show_channels(struct ast_cli_entry *e, int cmd, struc
ast_cli(a->fd, "Debug ");
if (chan->logmask & (1 << __LOG_DTMF))
ast_cli(a->fd, "DTMF ");
+ if (chan->logmask & (1 << __LOG_SECURITY))
+ ast_cli(a->fd, "Security ");
if (chan->logmask & (1 << __LOG_VERBOSE))
ast_cli(a->fd, "Verbose ");
if (chan->logmask & (1 << __LOG_WARNING))