mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
This patch from Vitezslav Batrla, is a cleaner fix for the
problem with syslogd logging the '<' char.
This commit is contained in:
parent
787ff55a69
commit
d4f90ed37e
@ -424,31 +424,21 @@ static int serveConnection(char *tmpbuf, int n_read)
|
|||||||
while (p < tmpbuf + n_read) {
|
while (p < tmpbuf + n_read) {
|
||||||
|
|
||||||
int pri = (LOG_USER | LOG_NOTICE);
|
int pri = (LOG_USER | LOG_NOTICE);
|
||||||
|
int num_lt = 0;
|
||||||
char line[MAXLINE + 1];
|
char line[MAXLINE + 1];
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
char *q = line;
|
char *q = line;
|
||||||
char *p1 = 0;
|
|
||||||
int oldpri;
|
|
||||||
|
|
||||||
while ((c = *p) && q < &line[sizeof(line) - 1]) {
|
while ((c = *p) && q < &line[sizeof(line) - 1]) {
|
||||||
if (c == '<' && p1 == 0) {
|
if (c == '<' && num_lt == 0) {
|
||||||
/* Parse the magic priority number. */
|
/* Parse the magic priority number. */
|
||||||
p1 = p;
|
num_lt++;
|
||||||
oldpri = pri;
|
|
||||||
pri = 0;
|
pri = 0;
|
||||||
while (isdigit(*(++p))) {
|
while (isdigit(*(++p))) {
|
||||||
pri = 10 * pri + (*p - '0');
|
pri = 10 * pri + (*p - '0');
|
||||||
}
|
}
|
||||||
if ( *p != '>') {
|
if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){
|
||||||
*q++ = c;
|
pri = (LOG_USER | LOG_NOTICE);
|
||||||
p=p1;
|
|
||||||
p1=0;
|
|
||||||
pri=oldpri;
|
|
||||||
} else {
|
|
||||||
if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){
|
|
||||||
pri = (LOG_USER | LOG_NOTICE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (c == '\n') {
|
} else if (c == '\n') {
|
||||||
*q++ = ' ';
|
*q++ = ' ';
|
||||||
} else if (iscntrl(c) && (c < 0177)) {
|
} else if (iscntrl(c) && (c < 0177)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user