Add a -8 switch to syslogd to prevent it from mangling 8-bit data.

This commit is contained in:
Brian Somers 2008-05-14 00:22:21 +00:00
parent 6d327415c9
commit d7022add17
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178986
2 changed files with 26 additions and 5 deletions

View File

@ -28,7 +28,7 @@
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd April 13, 2005
.Dd May 13, 2008
.Dt SYSLOGD 8
.Os
.Sh NAME
@ -36,7 +36,7 @@
.Nd log systems messages
.Sh SYNOPSIS
.Nm
.Op Fl 46ACcdknosuv
.Op Fl 468ACcdknosuv
.Op Fl a Ar allowed_peer
.Op Fl b Ar bind_address
.Op Fl f Ar config_file
@ -60,6 +60,23 @@ to use IPv4 addresses only.
Force
.Nm
to use IPv6 addresses only.
.It Fl 8
Tells
.Nm
not to interfere with 8-bit data. Normally
.Nm
will replace C1 control characters
.Pq ISO 8859 and Unicode characters
with their
.Dq M- Ns Em x
equivalent.
Note, this option does not change the way
.Nm
alters control characters
.Pq see Xr iscntrl 3 .
They will always be replaced with their
.Dq ^ Ns Em x
equivalent.
.It Fl A
Ordinarily,
.Nm

View File

@ -283,6 +283,7 @@ static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
#else
static int family = PF_INET; /* protocol family (IPv4 only) */
#endif
static int mask_C1 = 1; /* mask characters from 0x80 - 0x9F */
static int send_to_all; /* send message to all IPv4/IPv6 addresses */
static int use_bootfile; /* log entire bootfile for every kern msg */
static int no_compress; /* don't compress messages (1=pipes, 2=all) */
@ -351,7 +352,7 @@ main(int argc, char *argv[])
socklen_t len;
bindhostname = NULL;
while ((ch = getopt(argc, argv, "46Aa:b:cCdf:kl:m:nop:P:sS:uv")) != -1)
while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nop:P:sS:uv")) != -1)
switch (ch) {
case '4':
family = PF_INET;
@ -361,6 +362,9 @@ main(int argc, char *argv[])
family = PF_INET6;
break;
#endif
case '8':
mask_C1 = 0;
break;
case 'A':
send_to_all++;
break;
@ -693,7 +697,7 @@ usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n%s\n",
"usage: syslogd [-46ACcdknosuv] [-a allowed_peer]",
"usage: syslogd [-468ACcdknosuv] [-a allowed_peer]",
" [-b bind_address] [-f config_file]",
" [-l [mode:]path] [-m mark_interval]",
" [-P pid_file] [-p log_socket]");
@ -738,7 +742,7 @@ printline(const char *hname, char *msg)
while ((c = (unsigned char)*p++) != '\0' &&
q < &line[sizeof(line) - 4]) {
if ((c & 0x80) && c < 0xA0) {
if (mask_C1 && (c & 0x80) && c < 0xA0) {
c &= 0x7F;
*q++ = 'M';
*q++ = '-';