[augeas-devel] augeas: master - Iptables: allow quoted strings as arguments

David Lutterkort lutter at fedoraproject.org
Mon Dec 7 18:58:12 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=a8d97e30ec4435e9af310a04aea6e51f2074bc9e
Commit:        a8d97e30ec4435e9af310a04aea6e51f2074bc9e
Parent:        38f790df6a03f9edfa62234188ee71773ef2c95f
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Mon Dec 7 10:57:10 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Mon Dec 7 10:57:10 2009 -0800

Iptables: allow quoted strings as arguments

---
 lenses/iptables.aug            |    3 ++-
 lenses/tests/test_iptables.aug |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lenses/iptables.aug b/lenses/iptables.aug
index 64a195e..11034e2 100644
--- a/lenses/iptables.aug
+++ b/lenses/iptables.aug
@@ -32,8 +32,9 @@ let param (long:string) (short:string) =
 let ipt_match =
   let any_key = /[a-zA-Z-][a-zA-Z-]+/ -
     /protocol|source|destination|jump|goto|in-interface|out-interface|fragment|match/ in
+  let any_val = /([^\" \t\n-][^ \t\n]*)|\"([^\"\\\n]|\\\\.)*\"/ in
   let any_param =
-    [ spc . dels "--" . key any_key . (spc . store /[^ \t\n-][^ \t\n]*/)? ] in
+    [ spc . dels "--" . key any_key . (spc . store any_val)? ] in
     (param "protocol" "p"
     |param "source" "s"
     |param "destination" "d"
diff --git a/lenses/tests/test_iptables.aug b/lenses/tests/test_iptables.aug
index 5faa0c3..59b4a75 100644
--- a/lenses/tests/test_iptables.aug
+++ b/lenses/tests/test_iptables.aug
@@ -164,3 +164,7 @@ test Iptables.lns get conf =
       { "to-source" = "195.233.192.1" } }
     { "#comment" = "and now commit" } }
   { "#comment" = "Completed on Wed Apr 24 10:19:55 2002" }
+
+test ipt_match get " -m comment --comment \"A comment\"" =
+  { "match" = "comment" }
+  { "comment" = "\"A comment\"" }




More information about the augeas-devel mailing list