[augeas-devel] [PATCH] Small simplification of sshd_config tree structure

Dominique Dumont dominique.dumont at hp.com
Thu Nov 20 13:24:47 UTC 2008


Hello

Here's a small patch to simplify the structure of sshd_config tree.

The Condition lens (in the Match block) is reduced to a single lens
instead of a list. 

I.e. the Match lens structure is changed from :

       { "Match"
	  { "Condition" { "User" = "sarko"   } }
	  { "Condition" { "Group" = "pres.*" } }
 	  { "Settings"  { "Banner" = "/etc/bienvenue.txt" }
        	                { "X11Forwarding" = "no" } } }

to:

       { "Match"
	  { "Condition" { "User" = "sarko"   } 
	                { "Group" = "pres.*" } }
 	  { "Settings"  { "Banner" = "/etc/bienvenue.txt" }
        	                { "X11Forwarding" = "no" } } }


Could you apply this patch for the next release ?

All the best


diff -r 3b5126308492 lenses/sshd.aug
--- a/lenses/sshd.aug	Wed Nov 19 14:40:50 2008 +0100
+++ b/lenses/sshd.aug	Thu Nov 20 14:18:16 2008 +0100
@@ -41,15 +41,18 @@
          ([ seq "macs" . Util.del_str "," . mac_value])* .
          eol ]
 
+   let condition_entry = 
+    let value = store  /[^ \t\n]+/ in
+    [ sep . key /[A-Za-z0-9]+/ . sep . value ]
+
    let match_cond = 
-     [ label "Condition" . sep . [ key /[A-Za-z0-9]+/ . sep . 
-                             store /[^ \t\n]+/ ] ]
+     [ label "Condition" . condition_entry+ . eol ]
 
    let match_entry = 
      ( comment | (Util.indent . other_entry) )
 
    let match =
-     [ key "Match" . match_cond+ . del / */ "" . del "\n" "\n"
+     [ key "Match" . match_cond 
         . [ label "Settings" .  match_entry+ ]
      ]
 
diff -r 3b5126308492 lenses/tests/test_sshd.aug
--- a/lenses/tests/test_sshd.aug	Wed Nov 19 14:40:50 2008 +0100
+++ b/lenses/tests/test_sshd.aug	Thu Nov 20 14:18:16 2008 +0100
@@ -49,16 +49,17 @@
   test Sshd.lns get match_blocks =
     { "X11Forwarding" = "yes"}
       { "Match"
-	  { "Condition" { "User" = "sarko"   } }
-	  { "Condition" { "Group" = "pres.*" } }
+	  { "Condition" { "User" = "sarko"   } 
+	                { "Group" = "pres.*" } }
 	  { "Settings"  { "Banner" = "/etc/bienvenue.txt" }
        	                { "X11Forwarding" = "no" } } }
       { "Match"
-	  { "Condition" { "User" = "bush"    } }
-	  { "Condition" { "Group" = "pres.*" } }
-	  { "Condition" { "Host"  = "white.house.*" } }
+	  { "Condition" { "User" = "bush"    }
+	                { "Group" = "pres.*" }
+	                { "Host"  = "white.house.*" } }
 	  { "Settings"  { "Banner" = "/etc/welcome.txt" } } }
 
 (* Local Variables: *)
 (* mode: caml       *)
 (* End:             *)
+

-- 
Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner




More information about the augeas-devel mailing list