[tac_plus] Escaping special characters within double quotes

Viswanathan, Vasanth vasanth.viswanathan at hpe.com
Fri Nov 8 19:29:49 UTC 2019


On 11/5/19, 6:12 PM, "john heasley" <heas at shrubbery.net> wrote:

>     Fri, Sep 13, 2019 at 12:06:06AM +0000, Viswanathan, Vasanth:
>    > Hi,
>    > 
>    > I am using tac_plus version F4.0.4.28. tac_plus man page suggests to use double-quotes when a string has white spaces. Here is an example of command authorization in tac_plus.conf file –
>    > 
 >   > cmd = ping {
 >   >     permit “10\.10\.10\.[2-9]+ -c 10” # allow 10 pings
 >   >     deny “10\.10\.10\.[2-9]+ -c 100” # don’t allow 100 pings
 >   > }
 >   > 
 >   > I have to enclose the regex in double-quotes because it has multiple arguments. But this causes tac_plus to not start due to parsing error.
 >   > However this works (without double-quotes) –
 >   > 
 >   > cmd = ping {
 >   >     permit 10\.10\.10\.[2-9]+
 >   >     deny 10\.10\.10\.[20-30]+
 >   > }
 >   > 
 >   > I looked the source code and it seems like tac_plus only allows backslash/quote/newline character after a backslash within a double-quoted string. I am trying to understand why we have this restriction.
 >   > 
 >   > Thanks!
 >   > Vasanth    
 >   there was an error in the error reporting.  fixed in the attached diff.
 >   
 >   and, the whitespace in a quoted string was not handled, nor was backslash-
 >   quoting the whitespace or any of the regex atoms.  In the diff I've also
>    changed this to only treat \" specially; anything else is just copied.  I
>    struggled with this decision, but I think it is acceptable.
>    
>    Please report if there are problems.

Thanks John ! It works now. I had done a similar change to get around the problem. But I was not sure if there was a special reason to only allowing certain characters after a backslash inside double quotes which is why I started the email. Will you merge the diff to tac_plus code base? And will it be available in a follow-up tac_plus version?




More information about the tac_plus mailing list