Blob Blame Raw
From 46460e6d15a217dd0b73e515f8edd480cd95654f Mon Sep 17 00:00:00 2001
From: Dominic Cleal <dcleal@redhat.com>
Date: Wed, 3 Sep 2014 16:27:41 +0100
Subject: [PATCH] Syslog: permit IPv6 loghost addresses

Fixes RHBZ#1129388

(cherry picked from commit a94ad3e6ca467acd03b38c9964f9c3c773a646a5)

Conflicts:
	NEWS
---
 lenses/syslog.aug            | 3 ++-
 lenses/tests/test_syslog.aug | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lenses/syslog.aug b/lenses/syslog.aug
index caa1ce0..97c721e 100644
--- a/lenses/syslog.aug
+++ b/lenses/syslog.aug
@@ -120,7 +120,8 @@ module Syslog =
 	(* Variable: loghost_r
 	 Matches a hostname, that is labels speparated by dots, labels can't
 	 start or end with a "-".  maybe a bit too complicated for what it's worth *)
-	let loghost_r = /[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/
+	let loghost_r = /[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/ |
+                    "[" . Rx.ipv6 . "]"
 
 	(* Group: Function *)
 
diff --git a/lenses/tests/test_syslog.aug b/lenses/tests/test_syslog.aug
index 8fe24c3..51f1e2d 100644
--- a/lenses/tests/test_syslog.aug
+++ b/lenses/tests/test_syslog.aug
@@ -15,6 +15,7 @@ daemon.!<=info					/var/log/foo
 *.*						@syslog.far.away:123
 *.*						@@syslog.far.away
 *.*						@@syslog.far.away:123
+*.*						@[2001::1]:514
 *.*						foo,bar
 *.*						|\"/usr/bin/soft arg\"
 !startslip
@@ -105,6 +106,10 @@ daemon.info                                     /var/log/cvsupd.log
 	  }
 	  { "entry"
 	    { "selector" { "facility" = "*" } { "level" = "*" } }
+	    { "action" { "hostname" = "[2001::1]" } { "port" = "514" } }
+	  }
+	  { "entry"
+	    { "selector" { "facility" = "*" } { "level" = "*" } }
 	    { "action" { "user" = "foo" } { "user" = "bar" } }
 	  }
 	  { "entry"