change user access name limit from 32 to 255 characters

Currently, The username is limited to 32 characters in python-manilaclient,
but actually the user access name is longer than 32 characters. so we need
to change user access name limit from 32 to 255 characters

Change-Id: Ic41508b9792e304fe32b4af6cb5885a11a8e6d4d
Closes-bug: 1674915
This commit is contained in:
zhongjun 2017-03-22 16:55:57 +08:00
parent cbf8a5eda0
commit c9f0544242
3 changed files with 9 additions and 4 deletions

View File

@ -346,7 +346,7 @@ class SharesTest(utils.TestCase):
'action_name': 'os-allow_access', 'microversion': '2.0'},
{'access_to': '1' * 4, 'access_type': 'user',
'action_name': 'os-allow_access', 'microversion': '2.0'},
{'access_to': '1' * 32, 'access_type': 'user',
{'access_to': '1' * 255, 'access_type': 'user',
'action_name': 'os-allow_access', 'microversion': '2.0'},
{'access_to': 'fake\\]{.-_\'`;}[', 'access_type': 'user',
'action_name': 'os-allow_access', 'microversion': '2.0'},
@ -400,7 +400,7 @@ class SharesTest(utils.TestCase):
'microversion': '2.0'},
{'access_to': '1' * 3, 'access_type': 'user',
'microversion': '2.0'},
{'access_to': '1' * 33, 'access_type': 'user',
{'access_to': '1' * 256, 'access_type': 'user',
'microversion': '2.0'},
{'access_to': 'root^', 'access_type': 'user',
'microversion': '2.0'},

View File

@ -423,10 +423,10 @@ class ShareManager(base.ManagerWithFind):
@staticmethod
def _validate_username(access):
valid_username_re = '[\w\.\-_\`;\'\{\}\[\]\\\\]{4,32}$'
valid_username_re = '[\w\.\-_\`;\'\{\}\[\]\\\\]{4,255}$'
username = access
if not re.match(valid_username_re, username):
exc_str = ('Invalid user or group name. Must be 4-32 characters '
exc_str = ('Invalid user or group name. Must be 4-255 characters '
'and consist of alphanumeric characters and '
'special characters ]{.-_\'`;}[\\')
raise exceptions.CommandError(exc_str)

View File

@ -0,0 +1,5 @@
---
fixes:
- Changed user access name limit from 32 to 255 characters
since there are security services that allow user names
longer than 32 characters.