aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommi Virtanen <tv@eagain.net>2007-12-17 19:08:36 +0200
committerTommi Virtanen <tv@eagain.net>2007-12-17 19:08:36 +0200
commit27bd3c9954fa8e4c4a5d900b0e63eaae3f88e64c (patch)
tree9c89ff3d67298e7854039bb0d42a61c722812f53
parentAllow underscores, dots and dashes in SSH username local parts. (diff)
downloadgitosis-gentoo-27bd3c9954fa8e4c4a5d900b0e63eaae3f88e64c.tar.gz
gitosis-gentoo-27bd3c9954fa8e4c4a5d900b0e63eaae3f88e64c.tar.bz2
gitosis-gentoo-27bd3c9954fa8e4c4a5d900b0e63eaae3f88e64c.zip
Allow uppercase in usernames.
-rw-r--r--gitosis/ssh.py2
-rw-r--r--gitosis/test/test_init.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/gitosis/ssh.py b/gitosis/ssh.py
index 3fe846f..a315a5c 100644
--- a/gitosis/ssh.py
+++ b/gitosis/ssh.py
@@ -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)
diff --git a/gitosis/test/test_init.py b/gitosis/test/test_init.py
index e7f0150..fb6b286 100644
--- a/gitosis/test/test_init.py
+++ b/gitosis/test/test_init.py
@@ -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,