summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-23 10:17:55 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-23 10:17:55 +0000
commitc4986ca6de5da6b5bdf4263032552f19bc3e1249 (patch)
tree1e80b5c4427ff3fb4dd6182d26d1bab8165121e5 /syslogd.c
parent81cb74af2e580d29cff01543119f646c3f4ff987 (diff)
downloadrsyslog-c4986ca6de5da6b5bdf4263032552f19bc3e1249.tar.gz
rsyslog-c4986ca6de5da6b5bdf4263032552f19bc3e1249.tar.xz
rsyslog-c4986ca6de5da6b5bdf4263032552f19bc3e1249.zip
added DropTrailingLFOnReception config directive
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/syslogd.c b/syslogd.c
index f2b78245..acb0d5e4 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -531,6 +531,7 @@ static struct code FacNames[] = {
};
/* global variables for config file state */
+static int bDropTrailingLF = 1; /* drop trailing LF's on reception? */
int Debug; /* debug flag - read-only after startup */
static int bFailOnChown; /* fail if chown fails? */
static uid_t fileUID; /* UID to be used for newly created files */
@@ -1932,6 +1933,16 @@ void printchopped(char *hname, char *msg, int len, int fd, int bParseHost)
dprintf("Message length: %d, File descriptor: %d.\n", len, fd);
+ /* we first check if we need to drop trailing LFs, which often make
+ * their way into syslog messages unintentionally. In order to remain
+ * compatible to recent IETF developments, we allow the user to
+ * turn on/off this handling. rgerhards, 2007-07-23
+ */
+ if(bDropTrailingLF && *(msg + len - 1) == '\n') {
+ *(msg + len - 1) = '\0';
+ len--;
+ }
+
iMsg = 0; /* initialize receiving buffer index */
pMsg = tmpline; /* set receiving buffer pointer */
pData = msg; /* set source buffer pointer */
@@ -4060,6 +4071,8 @@ void cfsysline(uchar *p)
doBinaryOptionLine(&p, &bDebugPrintTemplateList);
} else if(!strcasecmp((char*) szCmd, "failonchownfailure")) {
doBinaryOptionLine(&p, &bFailOnChown);
+ } else if(!strcasecmp((char*) szCmd, "droptrailinglfonreception")) {
+ doBinaryOptionLine(&p, &bDropTrailingLF);
} else if(!strcasecmp((char*) szCmd, "resetconfigvariables")) {
resetConfigVariables();
} else if(!strcasecmp((char*) szCmd, "modload")) {