[syslog-ng]$MSG contains $PROGRAM

Loic Minier syslog-ng@lists.balabit.hu
Wed, 14 Apr 2004 17:27:07 +0200


--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Loic Minier <lool+syslog@via.ecp.fr> - Wed, Apr 14, 2004:

>  It is easy to fix with attached patch (remove a couple of lines at the
>  end of parse_msg in log.c).

 I was a bit in a hurry, sorry for previous patch.

 Here is a patch *really* correcting this.

-- 
Loïc Minier <lool@dooz.org>

--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="log.c-2.patch"

--- syslog-ng-1.6.2/src/log.c	2004-01-13 19:08:02.000000000 +0100
+++ syslog-ng-1.6.2.new/src/log.c	2004-04-14 17:21:43.000000000 +0200
@@ -225,8 +225,11 @@
 						oldleft - left, oldsrc);
 			} 
 			
-			src = oldsrc;
-			left = oldleft;
+			/* Skip whitespace and ':' */
+			while (left && (*src == ':' || *src == ' ')) {
+				src++;
+				left--;
+			}
 		}
 
 		/* If we did manage to find a hostname, store it. */
@@ -255,8 +258,11 @@
 			if (left) {
 				lm->program = c_format_cstring("%s", oldleft - left, oldsrc);
 			}
-			left = oldleft;
-			src = oldsrc;
+			/* Skip whitespace and ':' */
+			while (left && (*src == ':' && *src == ' ')) {
+				src++;
+				left--;
+			}
 		}
 		lm->stamp = now;
 	}

--KFztAG8eRSV9hGtP--