Allow uppercase in usernames.
This commit is contained in:
parent
b5e966c107
commit
27bd3c9954
2 changed files with 10 additions and 1 deletions
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
log = logging.getLogger('gitosis.ssh')
|
||||
|
||||
_ACCEPTABLE_USER_RE = re.compile(r'^[a-z][a-z0-9_.-]*(@[a-z][a-z0-9.-]*)?$')
|
||||
_ACCEPTABLE_USER_RE = re.compile(r'^[a-zA-Z][a-zA-Z0-9_.-]*(@[a-zA-Z][a-zA-Z0-9.-]*)?$')
|
||||
|
||||
def isSafeUsername(user):
|
||||
match = _ACCEPTABLE_USER_RE.match(user)
|
||||
|
|
|
@ -72,6 +72,15 @@ def test_ssh_extract_user_no_at():
|
|||
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= fakeuser')
|
||||
eq(got, 'fakeuser')
|
||||
|
||||
def test_ssh_extract_user_caps():
|
||||
got = init.ssh_extract_user(
|
||||
'ssh-somealgo '
|
||||
+'0123456789ABCDEFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
||||
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
||||
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
||||
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= Fake.User@Domain.Example.Com')
|
||||
eq(got, 'Fake.User@Domain.Example.Com')
|
||||
|
||||
def test_ssh_extract_user_bad():
|
||||
e = assert_raises(
|
||||
init.InsecureSSHKeyUsername,
|
||||
|
|
Loading…
Reference in a new issue