aboutsummaryrefslogtreecommitdiff
path: root/gitosis/sshkey.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitosis/sshkey.py')
-rw-r--r--gitosis/sshkey.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/gitosis/sshkey.py b/gitosis/sshkey.py
index ee0aa15..b948a5e 100644
--- a/gitosis/sshkey.py
+++ b/gitosis/sshkey.py
@@ -61,7 +61,10 @@ class SSHPublicKey:
"""
Returns the username from the comment, the first word of the comment.
"""
- return self._username
+ if isSafeUsername(self._username):
+ return self._username
+ else:
+ raise InsecureSSHKeyUsername(repr(self._username))
def options_string(self):
"""Return the options array as a suitable string."""
@@ -199,14 +202,6 @@ def isSafeUsername(user):
match = _ACCEPTABLE_USER_RE.match(user)
return (match is not None)
-def extract_user(pubkey):
- """Find the username for a given SSH public key line."""
- _, user = pubkey.rsplit(None, 1)
- if isSafeUsername(user):
- return user
- else:
- raise InsecureSSHKeyUsername(repr(user))
-
#X#key1 = 'no-X11-forwarding,command="x b c , d=e f \\"wham\\" \'
#before you go-go"
#ssh-rsa abc robbat2@foo foo\tbar#ignore'