[augeas-devel] [PATCH] Allow backslashes in the middle of sto_to_com and sto_to_com_user

Raphael Pinson raphink at gmail.com
Wed Apr 8 06:26:39 UTC 2009


From: Raphaël Pinson <raphink at raphink.net>

---
 lenses/sudoers.aug            |   10 ++++++----
 lenses/tests/test_sudoers.aug |   10 ++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lenses/sudoers.aug b/lenses/sudoers.aug
index 39d7d12..4591066 100644
--- a/lenses/sudoers.aug
+++ b/lenses/sudoers.aug
@@ -84,11 +84,13 @@ let sep_dquote   = Util.del_str "\""
 (* Variable: sto_to_com_cmnd
 sto_to_com_cmnd does not begin or end with a space
 
-TODO: there could be a \ in the middle of a command... *)
-let sto_to_com_cmnd = store /([^,=:#() \t\n\\\\][^,=:#()\n\\\\]*[^,=:#() \t\n\\\\])|[^,=:#() \t\n\\\\]/
+There could be a \ in the middle of a command *)
+let sto_to_com_cmnd = store /([^,=:#() \t\n\\\\][^,=:#()\n]*[^,=:#() \t\n\\\\])|[^,=:#() \t\n\\\\]/
 
-(* Variable: sto_to_com *)
-let sto_to_com      = store /[^,=:#() \t\n\\\\]+/
+(* Variable: sto_to_com 
+
+There could be a \ in the middle of a command *)
+let sto_to_com      = store /([^,=:#() \t\n\\\\][^,=:#()\n]*[^,=:#() \t\n\\\\])|[^,=:#() \t\n\\\\]/
 
 (* Variable: sto_to_com_user *)
 let sto_to_com_user = store ( /[^,=:#() \t\n]+/
diff --git a/lenses/tests/test_sudoers.aug b/lenses/tests/test_sudoers.aug
index 86cf119..561de85 100644
--- a/lenses/tests/test_sudoers.aug
+++ b/lenses/tests/test_sudoers.aug
@@ -5,6 +5,9 @@ module Test_sudoers =
 
    # User alias specification
 
+User_Alias EXAMPLE_ADMINS = cslack, EXAMPLE\\\\cslack,\
+          EXAMPLE\\\\jmalstrom
+
 # Cmnd alias specification
 
 Cmnd_Alias \
@@ -46,6 +49,13 @@ www-data +biglab=(rpinson)NOEXEC: ICAL \
       {}
       { "#comment" = "User alias specification" }
       {}
+      { "User_Alias"
+          { "alias"
+              { "name" = "EXAMPLE_ADMINS" }
+              { "user" = "cslack" }
+              { "user" = "EXAMPLE\\\\cslack" }
+              { "user" = "EXAMPLE\\\\jmalstrom" } } }
+      {}
       { "#comment" = "Cmnd alias specification" }
       {}
       { "Cmnd_Alias"
-- 
1.5.6.3




More information about the augeas-devel mailing list