[augeas-devel] augeas: master - Sudoers: allow backslashes inside sto_to_com and sto_to_com_user
David Lutterkort
lutter at fedoraproject.org
Wed Apr 8 19:55:00 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=633926e58dd91c4c1ccd7b6450c0e2183ed093a8
Commit: 633926e58dd91c4c1ccd7b6450c0e2183ed093a8
Parent: d03812392263cf095c67c868f369cd8be067e2d6
Author: Raphael Pinson <raphink at gmail.com>
AuthorDate: Wed Apr 8 12:21:27 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Apr 8 12:21:27 2009 -0700
Sudoers: allow backslashes inside sto_to_com and sto_to_com_user
This patch fixes ticket #60 which reports the possible usage of
backslashes in sudoers aliases (for use with e.g. Windows resources).
Backslashes are now allowed only in the middle of sto_to_com and
sto_to_com_cmnd.
Additionally, add a line with backslashes in test_sudoers to prevent
regressions.
---
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..f3d34c9 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"
More information about the augeas-devel
mailing list