X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournald-syslog.c;h=c2770a53d0caf8791c4604cec44c7ad8cd1aa8f6;hb=7384146530ac083efbef62b9ef5bb82c56565cd4;hp=7cbb34608b3579f3cf3ca2f490aaff92d5831186;hpb=968f319679d9069af037240d0c3bcd126181cdac;p=elogind.git diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 7cbb34608..c2770a53d 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -236,7 +236,7 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid) return e; } -void syslog_parse_priority(char **p, int *priority) { +void syslog_parse_priority(char **p, int *priority, bool with_facility) { int a = 0, b = 0, c = 0; int k; @@ -265,10 +265,14 @@ void syslog_parse_priority(char **p, int *priority) { } else return; - if (a < 0 || b < 0 || c < 0) + if (a < 0 || b < 0 || c < 0 || + (!with_facility && (a || b || c > 7))) return; - *priority = (*priority & LOG_FACMASK) | (a*100 + b*10 + c); + if (with_facility) + *priority = a*100 + b*10 + c; + else + *priority = (*priority & LOG_FACMASK) | c; *p += k; } @@ -361,7 +365,7 @@ void server_process_syslog_message( assert(buf); orig = buf; - syslog_parse_priority((char**) &buf, &priority); + syslog_parse_priority((char**) &buf, &priority, true); if (s->forward_to_syslog) forward_syslog_raw(s, priority, orig, ucred, tv);