From 3ebb66f56e5ee96ec173358641e6bafc0c404077 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Mon, 24 Dec 2007 17:31:21 -0800 Subject: Remove old extract_user function, replaced by username property of SSHPublicKey class. --- gitosis/sshkey.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'gitosis/sshkey.py') 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' -- cgit v1.2.3