[augeas-devel] Re: [Augeas] #48: sudoers lens does not handle multiline strings

Augeas trac at fedorahosted.org
Mon Mar 23 04:47:26 UTC 2009


#48: sudoers lens does not handle multiline strings
------------------------+---------------------------------------------------
  Reporter:  fsweetser  |       Owner:  raphink 
      Type:  defect     |      Status:  assigned
  Priority:  minor      |   Milestone:  next    
 Component:  Augeas     |     Version:  0.4.1   
Resolution:             |    Keywords:  sudoers 
------------------------+---------------------------------------------------
Comment (by lutter):

 Replying to [comment:3 raphink]:
 > Here is at least one thing that doesn't work with this patch :[[BR]]

 I haven't had time to review your patch in detail, but I think the below
 can actually addressed:

 > Let's say we have an env_keep with only one value put within double
 quotes (which is optional, but possible) :[[BR]]
 >
 >
 > Defaults env_keep = "TEST"[[BR]]
 >
 >
 > which will get mapped as[[BR]]
 > /files/etc/sudoers/Defaults/env_keep[[BR]]
 > /files/etc/sudoers/Defaults/env_keep/var[1] = "\"TEST\""[[BR]]
 >
 >
 > If we add a second variable to this env_keep, we will get :[[BR]]
 > /files/etc/sudoers/Defaults/env_keep[[BR]]
 > /files/etc/sudoers/Defaults/env_keep/var[1] = "\"TEST\""[[BR]]
 > /files/etc/sudoers/Defaults/env_keep/var[2] = "TEST2"[[BR]]
 >
 > which fails to save because "\"TEST\"" is only an acceptable value if
 you have only one variable. [[BR]]

 You can write a lens l = l1 | l2, where l1 covers the single-element case,
 and l2 the more-than-one element case; even though 'get' might use l1,
 'put' can use l2 when a second 'var' node is added.

 In pseudo-notation that hopefully gets the point across, it would look
 something like
 {{{
   let var = label "var" . store one_env_var_re
   let l1 = [ del /"?/ "" . var . del /"?/ "" ]
   let l2 = [ del /"/ "\"" . var ] . [ del / */ " " . var ]* . [ var . del
 /"/ "\"" ]
 }}}

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/48#comment:5>
Augeas <http://augeas.net/>
a configuration API




More information about the augeas-devel mailing list