[augeas-devel] [PATCH] Access: field separator need not be surrounded by spaces

Michael Chapman mike at very.puzzling.org
Sun Oct 23 11:26:36 UTC 2011


For compatibility with the old behaviour and to match the examples in
the PAM documentation, new entries are still emitted with spaces.

Signed-off-by: Michael Chapman <mike at very.puzzling.org>
---
 lenses/access.aug            |    2 +-
 lenses/tests/test_access.aug |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lenses/access.aug b/lenses/access.aug
index 2f85492..3f1d948 100644
--- a/lenses/access.aug
+++ b/lenses/access.aug
@@ -33,7 +33,7 @@ let empty     = Util.empty
 (* Variable: colon
  *  this is the standard field separator " : "
  *)
-let colon     = Sep.space . Sep.colon . Sep.space
+let colon     = del (Rx.opt_space . ":" . Rx.opt_space) " : "
 
 
 (************************************************************************
diff --git a/lenses/tests/test_access.aug b/lenses/tests/test_access.aug
index 3d31fbd..58ef231 100644
--- a/lenses/tests/test_access.aug
+++ b/lenses/tests/test_access.aug
@@ -8,6 +8,8 @@ let conf = "+ : ALL : LOCAL
 + : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
 # Except
 + : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
+# No spaces
++:root:.example.com
 "
 
 test Access.lns get conf =
@@ -49,6 +51,10 @@ test Access.lns get conf =
         { "except"
            { "origin" = "LOCAL" }
            { "origin" = ".win.tue.nl" } } }
+    { "#comment" = "No spaces" }
+    { "access" = "+"
+        { "user" = "root" }
+        { "origin" = ".example.com" } }
 
 test Access.lns put conf after
     insa "access" "access[last()]" ;
@@ -63,6 +69,8 @@ test Access.lns put conf after
 + : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64
 # Except
 + : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl
+# No spaces
++:root:.example.com
 - : ALL : ALL
 "
 
-- 
1.7.6.4




More information about the augeas-devel mailing list