[augeas-devel] [PATCH 4 of 4] Support the @include syntax
David Lutterkort
dlutter at redhat.com
Sat May 31 00:41:08 UTC 2008
4 files changed, 18 insertions(+), 6 deletions(-)
lenses/pam.aug | 13 +++++++++++--
lenses/tests/test_pam.aug | 3 +++
tests/rec-append-record.rb | 4 ++--
tests/rec-ins-record.rb | 4 ++--
# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1212194275 25200
# Node ID 7bb6c8324e815e9c116dc58cc835e17025afb6a6
# Parent 7fc8131c96fe6ba42d28f0f5f63dd97c0e321a74
Support the @include syntax
Debian uses lines of the form '@include module' to reference other pam
configs. The official PAM docs don't mention it, but obviously it works.
diff -r 7fc8131c96fe -r 7bb6c8324e81 lenses/pam.aug
--- a/lenses/pam.aug Fri May 30 17:19:23 2008 -0700
+++ b/lenses/pam.aug Fri May 30 17:37:55 2008 -0700
@@ -8,14 +8,23 @@
(* pairs into an array and generate a subtree control/N/KEY = VALUE *)
let control = /(\[[^]#\n]*\]|[^[ \t][^ \t]*)/
let word = /[^# \t\n]+/
+ (* Allowed types. FIXME: Should be case insensitive *)
+ let types = /(auth|session|account|password)/
+
(* 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" ]
+ (* Not mentioned in the man page, but Debian uses the syntax *)
+ (* @include module *)
+ (* quite a bit *)
+ let include = [ Util.del_str "@" . key "include" .
+ Util.del_ws_spc . store word . eol ]
+
let record = [ seq "record" .
- [ label "type" . store word ] .
+ [ label "type" . store types ] .
Util.del_ws_tab .
[ label "control" . store control] .
Util.del_ws_tab .
@@ -23,7 +32,7 @@
[ Util.del_ws_tab . label "argument" . store argument ]* .
eol
]
- let lns = ( comment | record ) *
+ let lns = ( comment | include | record ) *
let xfm = transform lns ((incl "/etc/pam.d/*") . Util.stdexcl)
diff -r 7fc8131c96fe -r 7bb6c8324e81 lenses/tests/test_pam.aug
--- a/lenses/tests/test_pam.aug Fri May 30 17:19:23 2008 -0700
+++ b/lenses/tests/test_pam.aug Fri May 30 17:37:55 2008 -0700
@@ -30,6 +30,9 @@
set "1/type" "auth"
= trailing_ws
+ test Pam.lns get "@include common-password\n" =
+ { "include" = "common-password" }
+
(* Local Variables: *)
(* mode: caml *)
(* End: *)
diff -r 7fc8131c96fe -r 7bb6c8324e81 tests/rec-append-record.rb
--- a/tests/rec-append-record.rb Fri May 30 17:19:23 2008 -0700
+++ b/tests/rec-append-record.rb Fri May 30 17:37:55 2008 -0700
@@ -2,7 +2,7 @@
entry_last = "/files/etc/pam.d/newrole/10000"
commands="
ins entry after #{entry_last}
-set #{entry_last}/type test
+set #{entry_last}/type auth
set #{entry_last}/control include
set #{entry_last}/module system-auth
save
@@ -15,5 +15,5 @@
account include\tsystem-auth
password include\tsystem-auth
session required\tpam_namespace.so unmnt_remnt no_unmount_on_close
-+test\tinclude\tsystem-auth
++auth\tinclude\tsystem-auth
TXT
diff -r 7fc8131c96fe -r 7bb6c8324e81 tests/rec-ins-record.rb
--- a/tests/rec-ins-record.rb Fri May 30 17:19:23 2008 -0700
+++ b/tests/rec-ins-record.rb Fri May 30 17:37:55 2008 -0700
@@ -1,6 +1,6 @@
commands="
ins 10000 before /files/etc/pam.d/newrole/3
-set /files/etc/pam.d/newrole/10000/type test
+set /files/etc/pam.d/newrole/10000/type session
set /files/etc/pam.d/newrole/10000/control include
set /files/etc/pam.d/newrole/10000/module system-auth
save
@@ -13,7 +13,7 @@
#%PAM-1.0
auth include\tsystem-auth
account include\tsystem-auth
-+test\tinclude\tsystem-auth
++session\tinclude\tsystem-auth
password include\tsystem-auth
session required\tpam_namespace.so unmnt_remnt no_unmount_on_close
TXT
More information about the augeas-devel
mailing list