[augeas-devel] [PATCH 3 of 4] Handle trailing whitespace in pam.d; split module-arguments
David Lutterkort
dlutter at redhat.com
Sat May 31 00:41:07 UTC 2008
5 files changed, 17 insertions(+), 7 deletions(-)
lenses/pam.aug | 8 +++++---
lenses/tests/test_pam.aug | 10 +++++++++-
tests/rec-mod-field.rb | 2 +-
tests/rec-rm-inner-field.rb | 2 +-
tests/rec-rm-tail-field.rb | 2 +-
# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1212193163 25200
# Node ID 7fc8131c96fe6ba42d28f0f5f63dd97c0e321a74
# Parent 3832130b0bbe5067bf1d4f3d2d20ba736ca66f8e
Handle trailing whitespace in pam.d; split module-arguments
diff -r 3832130b0bbe -r 7fc8131c96fe lenses/pam.aug
--- a/lenses/pam.aug Fri May 30 16:35:32 2008 -0700
+++ b/lenses/pam.aug Fri May 30 17:19:23 2008 -0700
@@ -2,13 +2,15 @@
module Pam =
autoload xfm
- let eol = Util.del_str "\n"
+ let eol = del /[ \t]*\n/ "\n"
(* For the control syntax of [key=value ..] we could split the key value *)
(* pairs into an array and generate a subtree control/N/KEY = VALUE *)
let control = /(\[[^]#\n]*\]|[^[ \t][^ \t]*)/
let word = /[^# \t\n]+/
- let opts = /[^#\n \t][^#\n]*/
+ (* This isn't entirely right: arguments enclosed in [ .. ] are allowed *)
+ (* and should be parsed as one *)
+ let argument = /[^#\n \t]+/
let comment = [ del /[ \t]*(#.*)?\n/ "#\n" ]
@@ -18,7 +20,7 @@
[ label "control" . store control] .
Util.del_ws_tab .
[ label "module" . store word ] .
- ( [ Util.del_ws_tab . label "opts" . store opts ] )? .
+ [ Util.del_ws_tab . label "argument" . store argument ]* .
eol
]
let lns = ( comment | record ) *
diff -r 3832130b0bbe -r 7fc8131c96fe lenses/tests/test_pam.aug
--- a/lenses/tests/test_pam.aug Fri May 30 16:35:32 2008 -0700
+++ b/lenses/tests/test_pam.aug Fri May 30 17:19:23 2008 -0700
@@ -13,7 +13,8 @@
{ "2" { "type" = "session" }
{ "control" = "optional" }
{ "module" = "pam_keyinit.so" }
- { "opts" = "force revoke" } }
+ { "argument" = "force" }
+ { "argument" = "revoke" } }
test Pam.lns put example after
set "1/control" "requisite"
@@ -22,6 +23,13 @@
session optional pam_keyinit.so force revoke
"
+ (* Check that trailing whitespace is handled & preserved *)
+ let trailing_ws = "auth\trequired\tpam_unix.so \n"
+
+ test Pam.lns put trailing_ws after
+ set "1/type" "auth"
+ = trailing_ws
+
(* Local Variables: *)
(* mode: caml *)
(* End: *)
diff -r 3832130b0bbe -r 7fc8131c96fe tests/rec-mod-field.rb
--- a/tests/rec-mod-field.rb Fri May 30 16:35:32 2008 -0700
+++ b/tests/rec-mod-field.rb Fri May 30 17:19:23 2008 -0700
@@ -1,6 +1,6 @@
commands="
set /files/etc/pam.d/newrole/3/module other_module
-set /files/etc/pam.d/newrole/3/opts other_module_opts
+set /files/etc/pam.d/newrole/3/argument other_module_opts
save
"
diff -r 3832130b0bbe -r 7fc8131c96fe tests/rec-rm-inner-field.rb
--- a/tests/rec-rm-inner-field.rb Fri May 30 16:35:32 2008 -0700
+++ b/tests/rec-rm-inner-field.rb Fri May 30 17:19:23 2008 -0700
@@ -1,5 +1,5 @@
commands="
-rm /files/etc/pam.d/newrole/4/opts
+rm /files/etc/pam.d/newrole/4/argument
save
"
diff -r 3832130b0bbe -r 7fc8131c96fe tests/rec-rm-tail-field.rb
--- a/tests/rec-rm-tail-field.rb Fri May 30 16:35:32 2008 -0700
+++ b/tests/rec-rm-tail-field.rb Fri May 30 17:19:23 2008 -0700
@@ -1,6 +1,6 @@
# -*- ruby -*-
commands="
-rm /files/etc/pam.d/newrole/4/opts
+rm /files/etc/pam.d/newrole/4/argument
save
"
refresh = 1
More information about the augeas-devel
mailing list