diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2007-12-22 22:52:44 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2007-12-22 22:52:44 -0800 |
commit | 76691f813a844e8c18d8de5fd2cc2d0117a9602e (patch) | |
tree | faf5b28af2984305060501f366b2ab1929f732af /gitosis/init.py | |
parent | Expand SSH authorized_keys option parsing. (diff) | |
download | gitosis-dakkar-76691f813a844e8c18d8de5fd2cc2d0117a9602e.tar.gz gitosis-dakkar-76691f813a844e8c18d8de5fd2cc2d0117a9602e.tar.bz2 gitosis-dakkar-76691f813a844e8c18d8de5fd2cc2d0117a9602e.zip |
Move the SSH username extraction to the ssh class, and the tests over as well.
Diffstat (limited to 'gitosis/init.py')
-rw-r--r-- | gitosis/init.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/gitosis/init.py b/gitosis/init.py index 94be4e1..f1f8121 100644 --- a/gitosis/init.py +++ b/gitosis/init.py @@ -27,20 +27,6 @@ def read_ssh_pubkey(fp=None): #pragma: no cover line = fp.readline() return line -class InsecureSSHKeyUsername(Exception): - """Username contains not allowed characters""" - - def __str__(self): - return '%s: %s' % (self.__doc__, ': '.join(self.args)) - -def ssh_extract_user(pubkey): - """Find the username for a given SSH public key line.""" - _, user = pubkey.rsplit(None, 1) - if ssh.isSafeUsername(user): - return user - else: - raise InsecureSSHKeyUsername(repr(user)) - def initial_commit(git_dir, cfg, pubkey, user): """Import the initial files into the gitosis-admin repository.""" repository.fast_import( @@ -126,7 +112,7 @@ class Main(app.App): log.info('Reading SSH public key...') pubkey = read_ssh_pubkey() - user = ssh_extract_user(pubkey) + user = ssh.extract_user(pubkey) if user is None: log.error('Cannot parse user from SSH public key.') sys.exit(1) |