changeset 8064:8fb1b9e7106a

lib: base64 followup from 82b1eaec25f5 Needed for py3.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 23 Dec 2019 02:59:05 +0100
parents 9bc709aa0614
children 0bbf505c804f
files kallithea/lib/ssh.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/ssh.py	Sat Dec 21 16:29:11 2019 +0100
+++ b/kallithea/lib/ssh.py	Mon Dec 23 02:59:05 2019 +0100
@@ -109,11 +109,12 @@
     'no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/srv/kallithea/venv/bin/kallithea-cli ssh-serve -c /srv/kallithea/my.ini 7 17" ssh-rsa AAAAB3NzaC1yc2EAAAALVGhpcyBpcyBmYWtlIQ==\\n'
     """
     try:
-        keytype, decoded, comment = parse_pub_key(key.public_key)
+        keytype, key_bytes, comment = parse_pub_key(key.public_key)
     except SshKeyParseError:
         return '# Invalid Kallithea SSH key: %s %s\n' % (key.user.user_id, key.user_ssh_key_id)
-    mimekey = decoded.encode('base64').replace('\n', '')
+    base64_key = base64.b64encode(key_bytes)
+    assert '\n' not in base64_key
     return '%s,command="%s ssh-serve -c %s %s %s" %s %s\n' % (
         SSH_OPTIONS, kallithea_cli_path, config_file,
         key.user.user_id, key.user_ssh_key_id,
-        keytype, mimekey)
+        keytype, base64_key)