cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9498) VR CsFile search utility methods fail when search string has char *, + etc
Date Wed, 23 Nov 2016 09:03:59 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15689445#comment-15689445
] 

ASF subversion and git services commented on CLOUDSTACK-9498:
-------------------------------------------------------------

Commit 1e88ad45a714cb2f234b4721bbe3f6c09a51923c in cloudstack's branch refs/heads/4.9 from
[~rohit.yadav@shapeblue.com]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=1e88ad4 ]

Merge pull request #1680 from murali-reddy/vr_csfile_search

CLOUDSTACK-9498: VR CsFile search utility methods fail when search stThere is no real use
of python 're' module  in CsFile.py utility methods searchString, deleteLine. Regular string
search is sufficient. These methods are used only for VPN user add/delete. Since VPN user
password can have python 're' module meta characters, it interfere with search functionality.

Replacing re.search() with regular string search instead.

Change is confined to VPN add/delete users. Have run the test/integration/component/test_vpn_users.py

VPN remote access user limit tests ... === TestName: test_01_VPN_user_limit | Status : SUCCESS
===
ok
Test create VPN when L2TP port in use ... === TestName: test_02_use_vpn_port | Status : SUCCESS
===
ok
Test create NAT rule when VPN when L2TP enabled ... === TestName: test_03_enable_vpn_use_port
| Status : SUCCESS ===
ok
Test add new users to existing VPN ... === TestName: test_04_add_new_users | Status : SUCCESS
===
ok
Test add duplicate user to existing VPN ... === TestName: test_05_add_duplicate_user | Status
: SUCCESS ===
ok
Test as global admin, add a new VPN user to an existing VPN entry ... === TestName: test_06_add_VPN_user_global_admin
| Status : SUCCESS ===
ok
Test as domain admin, add a new VPN user to an existing VPN entry ... === TestName: test_07_add_VPN_user_domain_admin
| Status : SUCCESS ===
ok

* pr/1680:
  CLOUDSTACK-9498: VR CsFile search utility methods fail when search string has 're' meta
chars, and causing VPN user add/deelte to fail

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


> 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.6.2, 4.7.1, 4.8.0, 4.8.1, 4.9.0
>            Reporter: Murali Reddy
>            Assignee: Murali Reddy
>             Fix For: 4.10.0.0, 4.9.1.0, 4.8.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)

Mime
View raw message