You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Murali Reddy (JIRA)" <ji...@apache.org> on 2016/09/13 06:49:21 UTC

[jira] [Created] (CLOUDSTACK-9498) VR CsFile search utility methods fail when search string has char *, + etc

Murali Reddy created CLOUDSTACK-9498:
----------------------------------------

             Summary: VR CsFile search utility methods fail when search string has char *, + etc
                 Key: CLOUDSTACK-9498
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9498
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
    Affects Versions: 4.7.1, 4.6.2, 4.9.2.0, 4.8.2.0
            Reporter: Murali Reddy
             Fix For: 4.9.2.0




VR CsFile search utility methods fail when search string has char *, + etc.

These utility methods in CsFile 1 uses python regular expression module to search a string in a file. However, if caller passes a search string, that has chars *, +, . etc that are also happen to be express wild card / match expression in regular expression results in exceptions from python 're' module.

For instance searching for VPN user 2 passes "username * password *" as search string, if password has chars the interfer with regular expression metacharecters then search will result in exception.

2016-09-12 13:55:48,976 configure.py add_l2tp_ipsec_user:569 Adding vpn user murali * abcd++efgh## *
2016-09-12 13:55:48,976 CsFile.py load:39 Reading file /etc/ppp/chap-secrets
2016-09-12 13:55:48,976 CsFile.py searchString:140 Searching for murali * abcd++efgh## * string
2016-09-12 13:55:48,976 configure.py main:1020 Exception while configuring router
Traceback (most recent call last):
File "/opt/cloud/bin/configure.py", line 965, in main
vpnuser.process()
File "/opt/cloud/bin/configure.py", line 559, in process
self.add_l2tp_ipsec_user(user, userconfig)
File "/opt/cloud/bin/configure.py", line 572, in add_l2tp_ipsec_user
userfound = file.searchString(userSearchEntry, '#')
File "/opt/cloud/bin/cs/CsFile.py", line 146, in searchString
if re.search(search, line):
File "/usr/lib/python2.7/re.py", line 142, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression

1 https://github.com/apache/cloudstack/blob/master/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
2 https://github.com/apache/cloudstack/blob/master/systemvm/patches/debian/config/opt/cloud/bin/configure.py#L572




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)