Fix allow the use of blank in user group name to access the share
Allows the use of blank in user group name, manila api also need to fix Change-Id: I9ba2387198ce9e6a03be05d90e3b9455add76dcf Partial-Bug: #1733494
This commit is contained in:
parent
a0a833fb56
commit
3eeb76250e
@ -381,9 +381,11 @@ class SharesTest(utils.TestCase):
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': '1' * 255, 'access_type': 'user',
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': 'fake$\\]{.-_\'`;}[', 'access_type': 'user',
|
||||
{'access_to': 'fake${.-_\'`}', 'access_type': 'user',
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': 'MYDOMAIN\\Administrator', 'access_type': 'user',
|
||||
{'access_to': 'MYDOMAIN-Administrator', 'access_type': 'user',
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': 'test group name', 'access_type': 'user',
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': 'x', 'access_type': 'cert',
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
@ -393,12 +395,16 @@ class SharesTest(utils.TestCase):
|
||||
'action_name': 'os-allow_access', 'microversion': '2.0'},
|
||||
{'access_to': '127.0.0.1', 'access_type': 'ip',
|
||||
'action_name': 'allow_access', 'microversion': '2.7'},
|
||||
{'access_to': 'test group name', 'access_type': 'user',
|
||||
'action_name': 'allow_access', 'microversion': '2.7'},
|
||||
{'access_to': 'alice', 'access_type': 'cephx',
|
||||
'action_name': 'allow_access', 'microversion': '2.13'},
|
||||
{'access_to': 'alice_bob', 'access_type': 'cephx',
|
||||
'action_name': 'allow_access', 'microversion': '2.13'},
|
||||
{'access_to': 'alice bob', 'access_type': 'cephx',
|
||||
'action_name': 'allow_access', 'microversion': '2.13'},
|
||||
{'access_to': 'test group name', 'access_type': 'user',
|
||||
'action_name': 'allow_access', 'microversion': '2.13'},
|
||||
{'access_to': 'AD80:0000:0000:0000:ABAA:0000:00C2:0002',
|
||||
'access_type': 'ip', 'action_name': 'allow_access',
|
||||
'microversion': '2.38'},
|
||||
@ -411,6 +417,8 @@ class SharesTest(utils.TestCase):
|
||||
{'access_to': 'ad80::abaa:0:c2:2',
|
||||
'access_type': 'ip', 'action_name': 'allow_access',
|
||||
'microversion': '2.38'},
|
||||
{'access_to': 'test group name', 'access_type': 'user',
|
||||
'action_name': 'allow_access', 'microversion': '2.38'},
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_allow_access_to_share(self, access_to, access_type,
|
||||
@ -447,7 +455,7 @@ class SharesTest(utils.TestCase):
|
||||
'microversion': '2.0'},
|
||||
{'access_to': '1' * 256, 'access_type': 'user',
|
||||
'microversion': '2.0'},
|
||||
{'access_to': 'root^', 'access_type': 'user',
|
||||
{'access_to': 'root+=', 'access_type': 'user',
|
||||
'microversion': '2.0'},
|
||||
{'access_to': '', 'access_type': 'cert',
|
||||
'microversion': '2.0'},
|
||||
|
@ -445,14 +445,29 @@ class ShareManager(base.ManagerWithFind):
|
||||
exc_str = ('Invalid CN (common name). Must be 1-64 chars long.')
|
||||
raise exceptions.CommandError(exc_str)
|
||||
|
||||
'''
|
||||
for the reference specification for AD usernames, reference below links:
|
||||
|
||||
1:https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/
|
||||
windows-server-2008-R2-and-2008/cc733146(v=ws.11)
|
||||
2:https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/
|
||||
windows-server-2000/bb726984(v=technet.10)
|
||||
'''
|
||||
@staticmethod
|
||||
def _validate_username(access):
|
||||
valid_username_re = '[\w\$\.\-_\`;\'\{\}\[\]\\\\]{4,255}$'
|
||||
sole_periods_spaces_re = '[\s|\.]+$'
|
||||
valid_username_re = '.[^\"\/\\\[\]\:\;\|\=\,\+\*\?\<\>]{3,254}$'
|
||||
username = access
|
||||
|
||||
if re.match(sole_periods_spaces_re, username):
|
||||
exc_str = ('Invalid user or group name,cannot consist solely '
|
||||
'of periods or spaces.')
|
||||
raise exceptions.CommandError(exc_str)
|
||||
|
||||
if not re.match(valid_username_re, username):
|
||||
exc_str = ('Invalid user or group name. Must be 4-255 characters '
|
||||
'and consist of alphanumeric characters and '
|
||||
'special characters $]{.-_\'`;}[\\')
|
||||
'exclude special characters "/\[]:;|=,+*?<>')
|
||||
raise exceptions.CommandError(exc_str)
|
||||
|
||||
@staticmethod
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Allows the use of blank in user group name since
|
||||
the AD allow user group name to include blank.
|
Loading…
Reference in New Issue
Block a user