Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-9498

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.6.2, 4.7.1, 4.8.0, 4.8.1, 4.9.0
    • 4.9.1.0, 4.8.2.0, 4.10.1.0
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              murali.reddy Murali Reddy
              murali.reddy Murali Reddy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: